diff --git a/.github/workflows/contracts-testing.yml b/.github/workflows/contracts-testing.yml index 70ba22fe9..fac5dc6e0 100644 --- a/.github/workflows/contracts-testing.yml +++ b/.github/workflows/contracts-testing.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v3 - name: Cache node modules - uses: actions/cache@v3.0.5 + uses: actions/cache@v3.0.7 env: cache-name: cache-node-modules with: diff --git a/.github/workflows/deploy-bots.yml b/.github/workflows/deploy-bots.yml new file mode 100644 index 000000000..32a0fc80c --- /dev/null +++ b/.github/workflows/deploy-bots.yml @@ -0,0 +1,24 @@ +on: [workflow_dispatch] + +jobs: + build-deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v2 + - uses: aws-actions/setup-sam@v1 + - uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.STAGING_AWS_ACCESS_KEY }} + aws-secret-access-key: ${{ secrets.STAGING_AWS_SECRET_KEY }} + aws-region: us-east-2 + + # sam build + - run: sam build --use-container + working-directory: bots + + # Run Unit tests- Specify unit tests here + + # sam deploy + - run: sam deploy --no-confirm-changeset --no-fail-on-empty-changeset --stack-name kleros-v2-bots --s3-bucket kleros-v2-bots --capabilities CAPABILITY_IAM --region us-east-2 + working-directory: bots diff --git a/README.md b/README.md index 9f504c355..57f51e123 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@

Netlify Build Status + GitPoap badge
Security Rating Quality Gate Status diff --git a/bot-pinner/.gitignore b/bot-pinner/.gitignore new file mode 100644 index 000000000..f9c23fa5e --- /dev/null +++ b/bot-pinner/.gitignore @@ -0,0 +1,24 @@ +court +compose + +# DAppNodeSDK release directories +build_* +releases.json + +### yarn ### +# https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored + +# .yarn/unplugged and .yarn/build-state.yml should likely always be ignored since +# they typically hold machine-specific build artifacts. Ignoring them might however +# prevent Zero-Installs from working (to prevent this, set enableScripts to false). +.yarn/unplugged +.yarn/build-state.yml + +# .yarn/cache and .pnp.* may be safely ignored, but you'll need to run yarn install +# to regenerate them between each branch switch. +# Uncomment the following lines if you're not using Zero-Installs: +# .yarn/cache +# .pnp.* + +# End of https://www.toptal.com/developers/gitignore/api/yarn + diff --git a/bot-pinner/Dockerfile b/bot-pinner/Dockerfile new file mode 100644 index 000000000..2f4ebe767 --- /dev/null +++ b/bot-pinner/Dockerfile @@ -0,0 +1,10 @@ +FROM python:3 + +WORKDIR /usr/src/app + +COPY requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY src/* . + +CMD [ "python", "-u", "./add_hashes.py" ] \ No newline at end of file diff --git a/bot-pinner/Dockerfile-dappnode b/bot-pinner/Dockerfile-dappnode new file mode 100644 index 000000000..bbc8b1983 --- /dev/null +++ b/bot-pinner/Dockerfile-dappnode @@ -0,0 +1,10 @@ +FROM python:3 + +WORKDIR /usr/src/app + +COPY requirements.txt src/* ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY watchlist/* /var/lib/watchlist/ + +CMD [ "python", "-u", "./add_hashes.py" ] \ No newline at end of file diff --git a/bot-pinner/README.md b/bot-pinner/README.md new file mode 100644 index 000000000..069993909 --- /dev/null +++ b/bot-pinner/README.md @@ -0,0 +1,85 @@ +# Kleros Court V2 Evidence: Containers to replicate and decentralize data + +## Quick start + +If you don't have a local RPC node, add a RPC to the docker-compose file. + +```bash +$ git clone git@github.com:kleros/kleros-v2.git +$ cd bot-pinner/ +$ docker-compose build +$ docker-compose up -d +``` + +### In the box + +1. Standard IPFS container which creates a local mount for data +2. Evidence container that awaits new events and then scrapes the latest hashes and submits it to IPFS. + +## DappNode + +:warning: For the following steps, you need access to [a DappNode](https://dappnode.io) system with the IPFS service running. + +The IPFS service is expected by default at `http://ipfs-cluster.dappnode:9094`, it can be configured at build time in `docker-compose-dappnode.yml` or at runtime in the Config tab of the package in the dAppnode UI. + +```bash +# first time only +$ yarn install +``` + +### Package installation without publishing + +```bash +$ yarn build:dappnode + ✔ Verify connection + ✔ Create release dir + ✔ Validate files + ✔ Copy files + ✔ Build docker image + ✔ Save and compress image + ✔ Upload release to IPFS node + ✔ Save upload results + + DNP (DAppNode Package) built and uploaded + Release hash : /ipfs/Qma773qBk3PqTDQk6biRagcjiNutmit2rpKStq5WbH16XJ + http://my.dappnode/#/installer/%2Fipfs%2FQma773qBk3PqTDQk6biRagcjiNutmit2rpKStq5WbH16XJ +``` + +Then follow the url to install the package, or open the DappStore page and paste the ipfs hash. + +![DappNode package](docs/image.png) + +### Publishing + +```bash +# Increase the version number, specify either: major, minor, patch. +$ yarn bump:dappnode patch +0.1.1 + +# Upload to IPFS +$ yarn publish:dappnode patch + ✔ Fetch current version from APM (next version: 0.1.1) + ✔ Build and upload + ✔ Generate transaction + + DNP (DAppNode Package) published (version 0.1.1) + Release hash : /ipfs/xxxx + http://my.dappnode/#/installer/%2Fipfs%2Fxxxx + + You must execute this transaction in mainnet to publish a new version of this DNP. + + To : 0x988b3A538b618C7A603e1c11Ab82Cd16dbE28069 + Value : 0 + Data : 0x32ab6afxxxxx + Gas : 1100000 + + You can also execute this transaction with Metamask by following this pre-filled link + + https://dappnode.github.io/sdk-publish/?r=data-pinner.kleros.eth&v=0.1.1&h=%2Fipfs%2Fxxxxx + +``` + +## Contributions + +Please visit [contribution.kleros.io](contributing.kleros.io.). +For any questions, please join the Kleros Discord or Telegram. diff --git a/bot-pinner/avatar-default.png b/bot-pinner/avatar-default.png new file mode 100644 index 000000000..90b63b61b Binary files /dev/null and b/bot-pinner/avatar-default.png differ diff --git a/bot-pinner/dappnode_package.json b/bot-pinner/dappnode_package.json new file mode 100644 index 000000000..9384d3554 --- /dev/null +++ b/bot-pinner/dappnode_package.json @@ -0,0 +1,27 @@ +{ + "name": "kleros-data-pinner.public.dappnode.eth", + "version": "0.1.0", + "shortDescription": "IPFS data pinner for Kleros", + "description": "IPFS data pinner for Kleros", + "type": "service", + "author": "Kleros (https://github.com/kleros)", + "contributors": [ + "JayBuidl (https://github.com/jaybuidl)", + "George (https://github.com/geaxed)" + ], + "categories": [ + "Storage", + "Developer tools" + ], + "links": { + "homepage": "https://kleros.io" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/kleros/kleros-v2.git" + }, + "bugs": { + "url": "https://github.com/kleros/kleros-v2/issues" + } +} diff --git a/bot-pinner/docker-compose-dappnode.yml b/bot-pinner/docker-compose-dappnode.yml new file mode 100644 index 000000000..94a46cc17 --- /dev/null +++ b/bot-pinner/docker-compose-dappnode.yml @@ -0,0 +1,17 @@ +version: "3.5" +services: + data-pinner.kleros.eth: + build: + context: . + dockerfile: Dockerfile-dappnode + image: "data-pinner.kleros.eth.kleros-data-pinner.public.dappnode.eth:0.1.0" + restart: unless-stopped + volumes: + - "data:/var/lib/data/" + environment: + RPC: "https://rinkeby.arbitrum.io/rpc" + IPFS: "http://ipfs-cluster.dappnode:9094" + INTERVAL: 60 + RETRY: 2 +volumes: + data: {} diff --git a/bot-pinner/docker-compose.yml b/bot-pinner/docker-compose.yml new file mode 100644 index 000000000..059f8c5df --- /dev/null +++ b/bot-pinner/docker-compose.yml @@ -0,0 +1,27 @@ +version: "3.4" +services: + ipfs1: + container_name: ipfs1 + image: ipfs/go-ipfs:latest + ports: +# - "4001:4001" # ipfs swarm - expose if needed/wanted + - "5001:5001" # ipfs api - expose if needed/wanted + - "8080:8080" # ipfs gateway - expose if needed/wanted + volumes: + - ./compose/ipfs0:/data/ipfs + + kleros-court-v2-evidence: + depends_on: + - ipfs1 + network_mode: host + container_name: court-v2-evidence + build: . + volumes: + - ./court/:/var/lib/data/ + - ./watchlist/:/var/lib/watchlist/ + environment: + RPC: "https://rinkeby.arbitrum.io/rpc" + IPFS: "http://localhost:5001/api/v0" + INTERVAL: 300 + RETRY: 2 + diff --git a/bot-pinner/docs/image.png b/bot-pinner/docs/image.png new file mode 100644 index 000000000..b87583c7f Binary files /dev/null and b/bot-pinner/docs/image.png differ diff --git a/bot-pinner/package.json b/bot-pinner/package.json new file mode 100644 index 000000000..61fb68b78 --- /dev/null +++ b/bot-pinner/package.json @@ -0,0 +1,24 @@ +{ + "name": "@kleros/kleros-v2-bot-pinner", + "version": "0.1.0", + "description": "Pinning of the court data to decentralized storage.", + "author": "Kleros", + "license": "MIT", + "packageManager": "yarn@3.1.0", + "volta": { + "node": "16.13.0" + }, + "scripts": { + "build:local": "docker-compose build", + "build:dappnode": "dappnodesdk build --compose_file_name docker-compose-dappnode.yml", + "bump:dappnode": "dappnodesdk increase --compose_file_name docker-compose-dappnode.yml", + "publish:dappnode": "dappnodesdk publish --compose_file_name docker-compose-dappnode.yml", + "run:local": "docker-compose up" + }, + "engines": { + "node": ">=16.13.0" + }, + "devDependencies": { + "@dappnode/dappnodesdk": "^0.2.65" + } +} diff --git a/bot-pinner/requirements.txt b/bot-pinner/requirements.txt new file mode 100644 index 000000000..0261717d4 --- /dev/null +++ b/bot-pinner/requirements.txt @@ -0,0 +1,2 @@ +web3 +requests \ No newline at end of file diff --git a/bot-pinner/src/add_hashes.py b/bot-pinner/src/add_hashes.py new file mode 100644 index 000000000..38b350cd5 --- /dev/null +++ b/bot-pinner/src/add_hashes.py @@ -0,0 +1,109 @@ +from web3 import Web3 +import requests +import os +import time +from tooling import motd, create_logger, port_up +import json +import glob + + +logger = create_logger() +motd() + +# Init +RPC = os.environ.get("RPC", "http://localhost:8545") +IPFS = os.environ.get("IPFS", "http://ipfs-cluster.dappnode:9094") +INTERVAL = os.environ.get("INTERVAL", 600) # Events are not constantly listened to, instead it checks per INTERVAL. +RETRY = int(os.environ.get("RETRY", 0)) # Retry interval value +attempted_retries = dict() + +# Contract / RPC +w3 = Web3(Web3.HTTPProvider(RPC)) + +# Read block height from disk or pull latest +block = 0 +try: + with open("/var/lib/data/block") as file: + block = file.read() +except FileNotFoundError: + block = w3.eth.getBlock("latest")['number'] + +# Read want-list from disk +hashes_wanted = list() +try: + with open("/var/lib/data/missed_hashes") as file: + hashes_wanted = file.read().splitlines() +except FileNotFoundError: + pass + +def main(): + block_number = block + tasks = ["Evidence"] + contracts = get_contracts() + while True: + logger.info(f"Cycle starting from block #{block_number}. WANTED HASHES: {len(hashes_wanted)}") + latest = w3.eth.getBlock('latest')['number'] + for contract in contracts: + for task in tasks: + event_filter = eval(str(f'contract.events.{task}.createFilter(fromBlock={block_number}, toBlock={latest})')) + for event in event_filter.get_all_entries(): + try: + add_hash(event['args']['_evidence']) + except Exception as e: + logger.error(f"Failure {e} at {block_number}") + block_number = latest + + # Keep track of block height + with open("/var/lib/data/block", "w") as file: + file.write(str(latest)) + + if len(hashes_wanted) > 0: + retry_hashes() + + # Persist want-list + with open('/var/lib/data/missed_hashes', 'w') as f: + for line in hashes_wanted: + f.write(f"{line}\n") + time.sleep(int(INTERVAL)) + + +def retry_hashes(): + for _hash in hashes_wanted: + if not _hash in attempted_retries: + attempted_retries[_hash] = 0 + else: + attempted_retries[_hash] += 1 + if RETRY == 0 or attempted_retries[_hash] < RETRY: + add_hash(_hash) + elif attempted_retries[_hash] > int(RETRY + 10): + attempted_retries[_hash] = int(RETRY - 2) # Reset the search + +def check_hash(_hash): + return _hash.rsplit('/', 1)[0] # Recursive pin // i.e. strip _hash/something.json + +def add_hash(_hash): + _hash = check_hash(_hash) + try: + r = requests.post(f"{IPFS}/pin/add/{_hash}", timeout=30) + logger.info(f"Added {_hash}") + if _hash in hashes_wanted: hashes_wanted.remove(_hash) + except requests.exceptions.ReadTimeout: + logger.warning(f"Time-out: Couldn't find {_hash} on the IPFS network") + if _hash not in hashes_wanted: hashes_wanted.append(_hash) + +def get_contracts(): + contracts = [] + for f in glob.glob('/var/lib/watchlist/**/*.json', recursive=True): + try: + with open(f) as fio: + data=json.load(fio) + abi = data["abi"] + address = w3.toChecksumAddress(data["address"]) + contracts.append(w3.eth.contract(address=address, abi=abi)) + logger.info(f"Adding to the watchlist: {address}") + except FileNotFoundError: + pass + return contracts + +if __name__ == '__main__': + main() diff --git a/bot-pinner/src/tooling.py b/bot-pinner/src/tooling.py new file mode 100644 index 000000000..0b8193421 --- /dev/null +++ b/bot-pinner/src/tooling.py @@ -0,0 +1,59 @@ +import time +import socket +import logging +import sys +import glob +import json +from web3 import Web3 + +def create_logger(): + # create a logger object + logger = logging.getLogger('kleros-v2-evidence-collector') + logger.setLevel(logging.INFO) + logfile = logging.StreamHandler(sys.stdout) + fmt = '%(asctime)s %(levelname)s %(message)s' + formatter = logging.Formatter(fmt) + logfile.setFormatter(formatter) + logger.addHandler(logfile) + return logger + + +def motd(): + kleros = """ + _-_. + _-',^. `-_. + ._-' ,' `. `-_ + !`-_._________`-'::: + ! /\ /\:::: + ; / \ /..\::: + ! / \ /....\:: + !/ \ /......\: + ;--.___. \/_.__.--;; + '-_ `:!;;;;;;;' + `-_, :!;;;'' + `-!' + """ + print("Booting...") + print(kleros) + print("Kleros Court V2 Evidence Collector!") + time.sleep(10) # Wait for IPFS to come up + print(additional_info()) + + +def additional_info(): + ipfs_api = port_up(8080) + ipfs_gw = port_up(5001) + if ipfs_api == 0 and ipfs_gw == 0: + return "Gateway and API are up. IPFS WebUI: http://127.0.0.1:5001/webui" + if ipfs_api == 0: + return "API is up" + return "API or Gateway unavailable. (If running on different ports, disregard this check)" + + +def port_up(port: int, host="127.0.0.1"): + sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + result = sock.connect_ex((host, port)) + sock.close() + return result + + diff --git a/bot-pinner/watchlist/DisputeKitClassic.json b/bot-pinner/watchlist/DisputeKitClassic.json new file mode 100644 index 000000000..a8b496bea --- /dev/null +++ b/bot-pinner/watchlist/DisputeKitClassic.json @@ -0,0 +1,1480 @@ +{ + "address": "0xA2c538AA05BBCc44c213441f6f3777223D2BF9e5", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract KlerosCore", + "name": "_core", + "type": "address" + }, + { + "internalType": "contract RNG", + "name": "_rng", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + } + ], + "name": "ChoiceFunded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "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": "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": "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": "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" + } + ], + "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" + } + ], + "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": "getLastRoundResult", + "outputs": [ + { + "internalType": "uint256", + "name": "winningChoice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "tied", + "type": "bool" + } + ], + "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": "rng", + "outputs": [ + { + "internalType": "contract RNG", + "name": "", + "type": "address" + } + ], + "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" + } + ], + "transactionHash": "0x4b45304bb73451188e13c640f8469233418c330fbc60347b56b467d18268389e", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xA2c538AA05BBCc44c213441f6f3777223D2BF9e5", + "transactionIndex": 1, + "gasUsed": "3795502", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x55bd2d69b9b0a124bb59bdcdf9d6df315b912dac22ab468cd6fc9f4badba4404", + "transactionHash": "0x4b45304bb73451188e13c640f8469233418c330fbc60347b56b467d18268389e", + "logs": [], + "blockNumber": 14452891, + "cumulativeGasUsed": "3795502", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x0000000000000000000000000000000000000000", + "0x078dAd05373d19d7fd6829735b765F12242a4300" + ], + "numDeployments": 4, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"ChoiceFunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"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\":\"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\":\"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\":\"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\"}],\"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\"}],\"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\":\"getLastRoundResult\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"}],\"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\":\"rng\",\"outputs\":[{\"internalType\":\"contract RNG\",\"name\":\"\",\"type\":\"address\"}],\"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)\":{\"details\":\"Changes the `_rng` storage variable.\",\"params\":{\"_rng\":\"The new value for the `RNGenerator` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_core\":\"The KlerosCore arbitrator.\",\"_governor\":\"The governor's address.\",\"_rng\":\"The random number generator.\"}},\"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\":{\"ruling\":\"The current ruling.\"}},\"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.\"}},\"getLastRoundResult(uint256)\":{\"details\":\"Returns the voting data from the most relevant round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\"},\"returns\":{\"tied\":\"Whether it's a tie or not.\",\"winningChoice\":\"The winning choice of this round.\"}},\"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\":200},\"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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling);\\n\\n /** @dev Returns the voting data from the most relevant round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @return winningChoice The winning choice of this round.\\n * @return tied Whether it's a tie or not.\\n */\\n function getLastRoundResult(uint256 _coreDisputeID) external view returns (uint256 winningChoice, bool tied);\\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(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) 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 )\\n external\\n view\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n );\\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\":\"0x235f027aa27fa972c56d863cfbc33832c8100135cf32d6827294de138e97dd44\",\"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 subcourtID; // The ID of the subcourt 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[] subcourtIDs; // The IDs of subcourts 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 subcourt in the form `stakedTokens[subcourtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the subcourt in the form `lockedTokens[subcourtID]`.\\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 subcourtID; // The ID of the subcourt.\\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 subcourts.\\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 _subcourtID, 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 SubcourtCreated(\\n uint256 indexed _subcourtID,\\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 SubcourtModified(uint96 indexed _subcourtID, string _param);\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _subcourtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromSubcourtID,\\n uint96 _toSubcourtID\\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 SubcourtCreated.\\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 SubcourtCreated(\\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 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 * @param _supportedDisputeKits Indexes of dispute kits that this subcourt will support.\\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 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 subcourtID = 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(subcourtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(subcourtID);\\n emit SubcourtCreated(\\n subcourtID,\\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 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(\\n _subcourtID == GENERAL_COURT || courts[courts[_subcourtID].parent].minStake <= _minStake,\\n \\\"MinStake lower than parent court\\\"\\n );\\n for (uint256 i = 0; i < courts[_subcourtID].children.length; i++) {\\n require(courts[courts[_subcourtID].children[i]].minStake >= _minStake, \\\"MinStake lower than parent court\\\");\\n }\\n\\n courts[_subcourtID].minStake = _minStake;\\n emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeHiddenVotes(uint96 _subcourtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_subcourtID].hiddenVotes = _hiddenVotes;\\n emit SubcourtModified(_subcourtID, \\\"hiddenVotes\\\");\\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(uint96 _subcourtID, uint256[4] memory _timesPerPeriod)\\n external\\n onlyByGovernor\\n {\\n courts[_subcourtID].timesPerPeriod = _timesPerPeriod;\\n emit SubcourtModified(_subcourtID, \\\"timesPerPeriod\\\");\\n }\\n\\n /** @dev Adds/removes court's support for specified dispute kits.\\n * @param _subcourtID The ID of the subcourt.\\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 subcourt.\\n */\\n function enableDisputeKits(\\n uint96 _subcourtID,\\n uint256[] memory _disputeKitIDs,\\n bool _enable\\n ) external onlyByGovernor {\\n Court storage subcourt = courts[_subcourtID];\\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(_subcourtID, _disputeKitIDs[i], true);\\n } else {\\n require(\\n !(_subcourtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't disable Root DK in General\\\"\\n );\\n enableDisputeKit(_subcourtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\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, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _subcourtID, _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.subcourtID, 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 subcourt (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(uint256 _numberOfChoices, bytes memory _extraData)\\n external\\n payable\\n override\\n returns (uint256 disputeID)\\n {\\n require(msg.value >= arbitrationCost(_extraData), \\\"ETH too low for arbitration cost\\\");\\n\\n (uint96 subcourtID, , uint256 disputeKitID) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n require(courts[subcourtID].supportedDisputeKits[disputeKitID], \\\"DK unsupported by subcourt\\\");\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.subcourtID = subcourtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.subcourtID];\\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.subcourtID];\\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.subcourtID] += round.tokensAtStakePerJuror;\\n round.drawnJurors.push(drawnAddress);\\n emit Draw(drawnAddress, _disputeID, currentRound, i);\\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(\\n uint256 _disputeID,\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) 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 newSubcourtID = dispute.subcourtID;\\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[newDisputeKitID].jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n newSubcourtID = courts[newSubcourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newSubcourtID].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 newSubcourtID = courts[newSubcourtID].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[newSubcourtID].supportedDisputeKits[newDisputeKitID]) {\\n newSubcourtID = GENERAL_COURT;\\n }\\n\\n if (newSubcourtID != dispute.subcourtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.subcourtID, newSubcourtID);\\n }\\n }\\n\\n dispute.subcourtID = newSubcourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newSubcourtID];\\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(\\n uint256 _disputeID,\\n uint256 _round,\\n uint256 _iterations\\n ) 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.subcourtID] -= 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.subcourtID] >= courts[dispute.subcourtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.subcourtID] - penalty;\\n setStakeForAccount(account, dispute.subcourtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.subcourtID] != 0) {\\n setStakeForAccount(account, dispute.subcourtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n for (uint256 j = 0; j < jurors[account].subcourtIDs.length; j++) {\\n setStakeForAccount(account, jurors[account].subcourtIDs[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.subcourtID] -=\\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.subcourtID] == 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 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)\\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 subcourtID, uint256 minJurors, ) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[subcourtID].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.subcourtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n if (dispute.subcourtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent subcourt.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current subcourt.\\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.subcourtID].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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n return disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round)\\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 _subcourtID)\\n external\\n view\\n returns (uint256 staked, uint256 locked)\\n {\\n staked = jurors[_juror].stakedTokens[_subcourtID];\\n locked = jurors[_juror].lockedTokens[_subcourtID];\\n }\\n\\n function isSupported(uint96 _subcourtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_subcourtID].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 _subcourtID 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 _subcourtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_subcourtID];\\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(bytes32 _key, uint256 _nodeIndex)\\n public\\n view\\n returns (\\n uint256 K,\\n uint256 length,\\n bytes32 ID\\n )\\n {\\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.subcourtID];\\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 getLastRoundResult(uint256 _disputeID) external view returns (uint256 winningChoice, bool tied) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (winningChoice, tied) = disputeKitNodes[round.disputeKitID].disputeKit.getLastRoundResult(_disputeID);\\n }\\n\\n function getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function enableDisputeKit(\\n uint96 _subcourtID,\\n uint256 _disputeKitID,\\n bool _enable\\n ) internal {\\n courts[_subcourtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_subcourtID, _disputeKitID, _enable);\\n }\\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 * @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 _subcourtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_subcourtID == FORKING_COURT || _subcourtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_subcourtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_subcourtID].minStake || _stake < juror.lockedTokens[_subcourtID]) return false;\\n if (currentStake == 0 && juror.subcourtIDs.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 subcourtID: _subcourtID,\\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.subcourtIDs.push(_subcourtID);\\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[_subcourtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\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 }\\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[_subcourtID] - currentStake + _stake;\\n juror.stakedTokens[_subcourtID] = newTotalStake;\\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 == GENERAL_COURT) finished = true;\\n else currentSubcourtID = courts[currentSubcourtID].parent;\\n }\\n\\n emit StakeSet(_account, _subcourtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a subcourt 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 subcourt ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return subcourtID The subcourt ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\n function extraDataToSubcourtIDMinJurorsDisputeKit(bytes memory _extraData)\\n internal\\n view\\n returns (\\n uint96 subcourtID,\\n uint256 minJurors,\\n uint256 disputeKitID\\n )\\n {\\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 subcourtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (subcourtID == FORKING_COURT || subcourtID >= courts.length) {\\n subcourtID = 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 subcourtID = GENERAL_COURT;\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n /** @dev Packs an account and a subcourt ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _subcourtID The subcourt ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndSubcourtIDToStakePathID(address _account, uint96 _subcourtID)\\n internal\\n pure\\n returns (bytes32 stakePathID)\\n {\\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 /** @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(\\n address _from,\\n address _to,\\n uint256 _value\\n ) 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\":\"0xd8593fcedfc04eba288fded13f7ccdfe51224d65b75117bad4baee156037949f\",\"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 RNBlock; // The block number when the random number was requested.\\n uint256 public RN; // 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 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 */\\n constructor(\\n address _governor,\\n KlerosCore _core,\\n RNG _rng\\n ) BaseDisputeKit(_governor, _core) {\\n rng = _rng;\\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 */\\n function changeRandomNumberGenerator(RNG _rng) external onlyByGovernor {\\n rng = _rng;\\n // TODO: if current phase is generating, call rng.requestRN() for the next block\\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 }\\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 require(block.number >= core.freezeBlock() + 20, \\\"Too soon: L1 finality required\\\");\\n // TODO: RNG process is currently unfinished.\\n RNBlock = block.number;\\n rng.requestRN(block.number);\\n phase = Phase.generating;\\n } else if (phase == Phase.generating) {\\n RN = rng.getRN(RNBlock);\\n require(RN != 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(uint256 _coreDisputeID)\\n external\\n override\\n onlyByCore\\n notJumped(_coreDisputeID)\\n returns (address drawnAddress)\\n {\\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 subcourtID, , , , ) = core.disputes(_coreDisputeID);\\n bytes32 key = bytes32(uint256(subcourtID)); // Get the ID of the tree.\\n uint256 drawnNumber = getRandomNumber();\\n\\n (uint256 K, uint256 nodesLength, ) = core.getSortitionSumTree(key, 0);\\n uint256 treeIndex = 0;\\n uint256 currentDrawnNumber = drawnNumber % 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 }\\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 subcourtID, , , , ) = core.disputes(_coreDisputeID);\\n (, bool hiddenVotes, , , , ) = core.courts(subcourtID);\\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 subcourts 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 if (this.currentRuling(_coreDisputeID) == _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 /** @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 */\\n function currentRuling(uint256 _coreDisputeID) external view override returns (uint256 ruling) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n ruling = round.tied ? 0 : round.winningChoice;\\n }\\n\\n function getLastRoundResult(uint256 _coreDisputeID)\\n external\\n view\\n override\\n returns (uint256 winningChoice, bool tied)\\n {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage lastRound = dispute.rounds[dispute.rounds.length - 1];\\n return (lastRound.winningChoice, lastRound.tied);\\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.getLastRoundResult(_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.getLastRoundResult(_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 )\\n external\\n view\\n override\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n )\\n {\\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 subcourtID, , , , ) = core.disputes(_coreDisputeID);\\n (uint256 lockedAmountPerJuror, , , , , ) = core.getRoundInfo(\\n _coreDisputeID,\\n core.getNumberOfRounds(_coreDisputeID) - 1\\n );\\n (uint256 stakedTokens, uint256 lockedTokens) = core.getJurorBalance(_juror, subcourtID);\\n return stakedTokens >= lockedTokens + lockedAmountPerJuror;\\n }\\n\\n /** @dev RNG function\\n * @return rn A random number.\\n */\\n function getRandomNumber() internal returns (uint256) {\\n return rng.getUncorrelatedRN(block.number);\\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\":\"0x9142ba7ec4cde26b876011bd9c782c75b906d1d9ab8465938ceeb3b3c2bd705f\",\"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\\n/**\\n * @authors: [@clesaege]\\n * @reviewers: [@remedcu]\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title Random Number Generator Standard\\n * @author Cl\\u00e9ment Lesaege - \\n * @dev This is an abstract contract\\n */\\nabstract contract RNG {\\n /**\\n * @dev Contribute to the reward of a random number.\\n * @param _block Block the random number is linked to.\\n */\\n function contribute(uint256 _block) public payable virtual;\\n\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRN(uint256 _block) public payable {\\n contribute(_block);\\n }\\n\\n /**\\n * @dev Get the random number.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getRN(uint256 _block) public virtual returns (uint256 RN);\\n\\n /**\\n * @dev Get a uncorrelated random number. Act like getRN but give a different number for each sender.\\n * This is to prevent users from getting correlated numbers.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getUncorrelatedRN(uint256 _block) public returns (uint256 RN) {\\n uint256 baseRN = getRN(_block);\\n if (baseRN == 0) return 0;\\n else return uint256(keccak256(abi.encode(msg.sender, baseRN)));\\n }\\n}\\n\",\"keccak256\":\"0x854bcb147fe44383cba7a5fdbcb69b3c0a9a71435c80eb73c172222da472a855\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620043c0380380620043c0833981016040819052620000349162000090565b600080546001600160a01b039485166001600160a01b031991821617909155600180549385169382169390931790925560028054919093169116179055620000e4565b6001600160a01b03811681146200008d57600080fd5b50565b600080600060608486031215620000a657600080fd5b8351620000b38162000077565b6020850151909350620000c68162000077565b6040850151909250620000d98162000077565b809150509250925092565b6142cc80620000f46000396000f3fe6080604052600436106102045760003560e01c8063796490f911610118578063ba66fde7116100a0578063d605787b1161006f578063d605787b14610638578063da3beb8c14610658578063e349ad3014610479578063e4c0aaf414610678578063f2f4eb261461069857600080fd5b8063ba66fde7146105cd578063be467604146105ed578063c41bda6114610603578063c86ed8921461062357600080fd5b8063a6a7f0eb116100e7578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b8063796490f9146104795780637c04034e1461048f5780638e426460146104af5780639b05c261146104cf57600080fd5b80633b3041471161019b5780635c92e2f61161016a5780635c92e2f6146103b65780635e4a627d146103d657806369f3f041146103ec5780636d4cd8ea14610439578063751accd01461045957600080fd5b80633b304147146103345780634b2f0ea0146103545780634fe264fb14610367578063564a565d1461038757600080fd5b80630c340a24116101d75780630c340a241461028f5780631200aabc146102c75780631c3db16d146102f4578063362c34791461031457600080fd5b8063023d44df1461020957806303432744146102325780630b274f2e146102485780630baa64d11461025f575b600080fd5b34801561021557600080fd5b5061021f60035481565b6040519081526020015b60405180910390f35b34801561023e57600080fd5b5061021f60065481565b34801561025457600080fd5b5061025d6106b8565b005b34801561026b57600080fd5b5061027f61027a36600461380a565b610c8a565b6040519015158152602001610229565b34801561029b57600080fd5b506000546102af906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102d357600080fd5b5061021f6102e236600461380a565b60086020526000908152604090205481565b34801561030057600080fd5b5061021f61030f36600461380a565b610d01565b34801561032057600080fd5b5061021f61032f36600461383b565b610d8b565b34801561034057600080fd5b506102af61034f36600461380a565b611179565b61025d610362366004613878565b611731565b34801561037357600080fd5b5061021f61038236600461389a565b611fcb565b34801561039357600080fd5b506103a76103a236600461380a565b61211b565b6040516102299392919061391e565b3480156103c257600080fd5b5061025d6103d1366004613994565b6121e1565b3480156103e257600080fd5b5061021f60045481565b3480156103f857600080fd5b5061040c61040736600461389a565b6124ed565b604080519687529415156020870152938501929092526060840152608083015260a082015260c001610229565b34801561044557600080fd5b5061027f61045436600461380a565b6125a5565b34801561046557600080fd5b5061025d610474366004613a86565b61261c565b34801561048557600080fd5b5061021f61271081565b34801561049b57600080fd5b5061025d6104aa366004613af3565b6126ee565b3480156104bb57600080fd5b5061025d6104ca366004613b8c565b612e26565b3480156104db57600080fd5b506104ef6104ea36600461380a565b612e72565b60408051928352901515602083015201610229565b34801561051057600080fd5b5061025d61051f366004613beb565b612ef5565b34801561053057600080fd5b5061054461053f36600461389a565b612f47565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610229565b34801561057c57600080fd5b5060055461058a9060ff1681565b6040516102299190613c4d565b3480156105a357600080fd5b5061021f614e2081565b3480156105b957600080fd5b5061025d6105c8366004613c75565b61300d565b3480156105d957600080fd5b5061027f6105e836600461389a565b6131c6565b3480156105f957600080fd5b5061021f61138881565b34801561060f57600080fd5b5061025d61061e366004613b8c565b613261565b34801561062f57600080fd5b5061027f6132ad565b34801561064457600080fd5b506002546102af906001600160a01b031681565b34801561066457600080fd5b5061021f610673366004613878565b6132cd565b34801561068457600080fd5b5061025d610693366004613b8c565b61342d565b3480156106a457600080fd5b506001546102af906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106fd57600080fd5b505afa158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190613cd0565b600181111561074657610746613c37565b14806107d35750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190613d06565b1561085e57600060055460ff1660028111156107f1576107f1613c37565b14156108445760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600580546000919060ff19166001835b0217905550610c49565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ad57600080fd5b505afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e59190613cd0565b60018111156108f6576108f6613c37565b1415610c4957600060055460ff16600281111561091557610915613c37565b1415610ac45760006006541161096d5760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f727300000000604482015260640161083b565b600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f39190613d21565b6109fe906014613d50565b431015610a4d5760405162461bcd60e51b815260206004820152601e60248201527f546f6f20736f6f6e3a204c312066696e616c6974792072657175697265640000604482015260640161083b565b4360038190556002546040516303dce1a760e51b815260048101929092526001600160a01b031690637b9c34e090602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050600580546001935090915060ff19168280610854565b600160055460ff166002811115610add57610add613c37565b1415610bcf5760025460035460405163ca4742f160e01b81526001600160a01b039092169163ca4742f191610b189160040190815260200190565b602060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613d21565b6004819055610bbb5760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161083b565b600580546002919060ff1916600183610854565b600260055460ff166002811115610be857610be8613c37565b1415610c495760065415610c3e5760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e67207068617365000000604482015260640161083b565b6005805460ff191690555b6005546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c809160ff90911690613c4d565b60405180910390a1565b600081815260086020526040812054600780548392908110610cae57610cae613d68565b60009182526020822060059091020180549092508290610cd090600190613d7e565b81548110610ce057610ce0613d68565b60009182526020909120600c90910201805460059091015414949350505050565b600081815260086020526040812054600780548392908110610d2557610d25613d68565b60009182526020822060059091020180549092508290610d4790600190613d7e565b81548110610d5757610d57613d68565b60009182526020909120600c90910201600381015490915060ff16610d80578060010154610d83565b60005b949350505050565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610dd457600080fd5b505afa158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c9190613dac565b50935050505080610e5f5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e0000000000604482015260640161083b565b600086815260086020526040812054600780549091908110610e8357610e83613d68565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610eb757610eb7613d68565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160206040518083038186803b158015610f0d57600080fd5b505afa158015610f21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f459190613d21565b600087815260078401602052604090205490915060ff16610f8d576001600160a01b0388166000908152600883016020908152604080832089845290915290205494506110d3565b80861415611003576000868152600683016020526040902054610fb1576000610ffc565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b8652909352922054610ff29190613e13565b610ffc9190613e48565b94506110d3565b600081815260078301602052604090205460ff166110d35781600601600083600a0160018154811061103757611037613d68565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061106d5761106d613d68565b90600052602060002001548152602001908152602001600020546110919190613d50565b60098301546001600160a01b038a16600090815260088501602090815260408083208b84529091529020546110c69190613e13565b6110d09190613e48565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561116d576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146111a65760405162461bcd60e51b815260040161083b90613e5c565b6000828152600860205260409020546007805484929081106111ca576111ca613d68565b600091825260209091206002600590920201015460ff16156111fe5760405162461bcd60e51b815260040161083b90613ea0565b600260055460ff16600281111561121757611217613c37565b146112645760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e67207068617365000000000000604482015260640161083b565b60008381526008602052604081205460078054909190811061128857611288613d68565b600091825260208220600590910201805490925082906112aa90600190613d7e565b815481106112ba576112ba613d68565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561131057600080fd5b505afa158015611324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113489190613dac565b50929350506001600160601b038316915060009050611365613479565b60015460405163bfabfe8f60e01b81526004810185905260006024820181905292935082916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156113b557600080fd5b505afa1580156113c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ed9190613ed7565b50600154604051630a48b58160e21b81526004810188905260006024820181905293955091935082916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561144357600080fd5b505afa158015611457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147b9190613d21565b6114859086613f05565b90505b826114938386613e13565b61149e906001613d50565b101561158b5760015b848111611585576000816114bb8588613e13565b6114c59190613d50565b600154604051630a48b58160e21b8152600481018b9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561151657600080fd5b505afa15801561152a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154e9190613d21565b9050808410611568576115618185613d7e565b9350611570565b509250611585565b5050808061157d90613f19565b9150506114a7565b50611488565b60015460405163bfabfe8f60e01b815260048101889052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156115d757600080fd5b505afa1580156115eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160f9190613ed7565b9250505061161c816134fc565b9b506116288d8d613527565b1561171c578860000160405180608001604052808e6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505088600b015489600001805490501415611717576006805490600061171183613f34565b91905055505b611721565b60009b505b5050505050505050505050919050565b60008281526008602052604090205460078054849290811061175557611755613d68565b600091825260209091206002600590920201015460ff16156117895760405162461bcd60e51b815260040161083b90613ea0565b6000838152600860205260408120546007805490919081106117ad576117ad613d68565b9060005260206000209060050201905080600101548311156118115760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e604482015260640161083b565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118919190613f4b565b915091508142101580156118a457508042105b6118e95760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b604482015260640161083b565b604051631c3db16d60e01b81526004810187905260009086903090631c3db16d9060240160206040518083038186803b15801561192557600080fd5b505afa158015611939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195d9190613d21565b141561196c57506127106119ec565b61271061138861197c8585613d7e565b6119869190613e13565b6119909190613e48565b61199a8442613d7e565b106119e75760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f73657200604482015260640161083b565b50614e205b835460009085906119ff90600190613d7e565b81548110611a0f57611a0f613d68565b60009182526020822060018054604051637e37c78b60e11b8152600481018e9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611a6957600080fd5b505afa158015611a7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa19190613d21565b611aab9190613d7e565b600089815260078401602052604090205490915060ff1615611b0f5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e0000000000604482015260640161083b565b600154604051632cf6413f60e11b8152600481018b90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611b5457600080fd5b505afa158015611b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8c9190613d21565b90506000612710611b9d8684613e13565b611ba79190613e48565b611bb19083613d50565b60008b815260068601602052604081205491925090821115611c545760008b81526006860160205260409020543490611bea9084613d7e565b11611c0f5760008b8152600686016020526040902054611c0a9083613d7e565b611c11565b345b604080518d815260208101839052919250339186918f917fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c0910160405180910390a45b33600090815260088601602090815260408083208e845290915281208054839290611c80908490613d50565b909155505060008b815260068601602052604081208054839290611ca5908490613d50565b909155505060008b81526006860160205260409020548211611d4f5760008b815260068601602052604081205460098701805491929091611ce7908490613d50565b9091555050600a8501805460018181018355600092835260208084209092018e90558d8352600788019091526040808320805460ff1916909217909155518c9186918f917fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00991a45b600a85015460011015611f8f57828560090154611d6c9190613d7e565b60098601556001546040516319b8152960e01b8152600481018e90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611db557600080fd5b505afa158015611dc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ded9190613d06565b15611e065760028901805460ff19166001179055611f0f565b885460038a016000611e19876001613d50565b8152602001908152602001600020819055506000896000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538e6040518263ffffffff1660e01b8152600401611e9491815260200190565b60206040518083038186803b158015611eac57600080fd5b505afa158015611ec0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee49190613d21565b600b82015560038101805460ff1916600117905560068054906000611f0883613f19565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848e8c600101548d6004016040518563ffffffff1660e01b8152600401611f5c93929190613faa565b6000604051808303818588803b158015611f7557600080fd5b505af1158015611f89573d6000803e3d6000fd5b50505050505b80341115611fbd57336108fc611fa58334613d7e565b6040518115909202916000818181858888f150505050505b505050505050505050505050565b600083815260086020526040812054600780548392908110611fef57611fef613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061202357612023613d68565b90600052602060002090600c0201600001848154811061204557612045613d68565b600091825260208220600154604051639b05c26160e01b815260048082018c905293909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561209d57600080fd5b505afa1580156120b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d59190614062565b6003850154919350915060ff1680156120f8575081836002015414806120f85750805b1561210b57612710945050505050612114565b60009450505050505b9392505050565b6007818154811061212b57600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161215e90613f6f565b80601f016020809104026020016040519081016040528092919081815260200182805461218a90613f6f565b80156121d75780601f106121ac576101008083540402835291602001916121d7565b820191906000526020600020905b8154815290600101906020018083116121ba57829003601f168201915b5050505050905083565b60008481526008602052604090205460078054869290811061220557612205613d68565b600091825260209091206002600590920201015460ff16156122395760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561227e57600080fd5b505afa158015612292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b69190613dac565b50909350600192506122c6915050565b8160048111156122d8576122d8613c37565b146123355760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b606482015260840161083b565b826123725760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b604482015260640161083b565b60008681526008602052604081205460078054909190811061239657612396613d68565b600091825260208220600590910201805490925082906123b890600190613d7e565b815481106123c8576123c8613d68565b90600052602060002090600c0201905060005b868110156124c65733828989848181106123f7576123f7613d68565b905060200201358154811061240e5761240e613d68565b60009182526020909120600490910201546001600160a01b0316146124755760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b858289898481811061248957612489613d68565b90506020020135815481106124a0576124a0613d68565b6000918252602090912060016004909202010155806124be81613f19565b9150506123db565b50868690508160050160008282546124de9190613d50565b90915550505050505050505050565b60008060008060008060006007600860008c8152602001908152602001600020548154811061251e5761251e613d68565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061255257612552613d68565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b6000818152600860205260408120546007805483929081106125c9576125c9613d68565b600091825260208220600590910201805490925082906125eb90600190613d7e565b815481106125fb576125fb613d68565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146126465760405162461bcd60e51b815260040161083b9061408e565b6000836001600160a01b0316838360405161266191906140d0565b60006040518083038185875af1925050503d806000811461269e576040519150601f19603f3d011682016040523d82523d6000602084013e6126a3565b606091505b50509050806126e85760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b604482015260640161083b565b50505050565b60008681526008602052604090205460078054889290811061271257612712613d68565b600091825260209091206002600590920201015460ff16156127465760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561278b57600080fd5b505afa15801561279f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c39190613dac565b50909350600292506127d3915050565b8160048111156127e5576127e5613c37565b146128405760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b606482015260840161083b565b856128825760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b604482015260640161083b565b6000888152600860205260408120546007805490919081106128a6576128a6613d68565b9060005260206000209060050201905080600101548611156129015760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b604482015260640161083b565b8054600090829061291490600190613d7e565b8154811061292457612924613d68565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561297a57600080fd5b505afa15801561298e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b29190613dac565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612a0857600080fd5b505afa158015612a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4091906140ec565b5050505091505060005b8a811015612cee5733848d8d84818110612a6657612a66613d68565b9050602002013581548110612a7d57612a7d613d68565b60009182526020909120600490910201546001600160a01b031614612ae45760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b811580612b58575089888a604051602001612b0193929190614144565b60405160208183030381529060405280519060200120846000018d8d84818110612b2d57612b2d613d68565b9050602002013581548110612b4457612b44613d68565b906000526020600020906004020160010154145b612bcc576040805162461bcd60e51b81526020600482015260248101919091527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20737562636f7572747320776974682068696464656e20766f7465732e606482015260840161083b565b838c8c83818110612bdf57612bdf613d68565b9050602002013581548110612bf657612bf6613d68565b600091825260209091206003600490920201015460ff1615612c4f5760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b604482015260640161083b565b89848d8d84818110612c6357612c63613d68565b9050602002013581548110612c7a57612c7a613d68565b60009182526020909120600260049092020101556001848d8d84818110612ca357612ca3613d68565b9050602002013581548110612cba57612cba613d68565b60009182526020909120600490910201600301805460ff191691151591909117905580612ce681613f19565b915050612a4a565b508a8a9050836004016000828254612d069190613d50565b90915550506000898152600284016020526040812080548c9290612d2b908490613d50565b90915550506001830154891415612d5b57600383015460ff1615612d565760038301805460ff191690555b612dd5565b60018301546000908152600284016020526040808220548b83529120541415612d9e57600383015460ff16612d565760038301805460ff19166001179055612dd5565b60018301546000908152600284016020526040808220548b83529120541115612dd5576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a604051612e109190614171565b60405180910390a4505050505050505050505050565b6000546001600160a01b03163314612e505760405162461bcd60e51b815260040161083b9061408e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120546007805483928392918110612e9857612e98613d68565b60009182526020822060059091020180549092508290612eba90600190613d7e565b81548110612eca57612eca613d68565b60009182526020909120600c909102016001810154600390910154909660ff90911695509350505050565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c90612f3a9087908790614184565b60405180910390a4505050565b60008060008060006007600860008a81526020019081526020016000205481548110612f7557612f75613d68565b600091825260208083208a8452600360059093020191820190526040822054815491935083918110612fa957612fa9613d68565b90600052602060002090600c02016000018781548110612fcb57612fcb613d68565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146130375760405162461bcd60e51b815260040161083b90613e5c565b60078054600181018255600091909152600581027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68981018690557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101906130c2907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c018686613771565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561311457600080fd5b505afa158015613128573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061314c9190613d21565b6131569190613d7e565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600890925282208490556006805491926131b783613f19565b91905055505050505050505050565b6000838152600860205260408120546007805483929081106131ea576131ea613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061321e5761321e613d68565b90600052602060002090600c0201600001848154811061324057613240613d68565b600091825260209091206004909102016003015460ff169695505050505050565b6000546001600160a01b0316331461328b5760405162461bcd60e51b815260040161083b9061408e565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008060055460ff1660028111156132c7576132c7613c37565b14905090565b6000828152600860205260408120546007805483929081106132f1576132f1613d68565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061332557613325613d68565b600091825260208220600154604051639b05c26160e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561337e57600080fd5b505afa158015613392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b69190614062565b915091508260040154600014806133e45750801580156133e457506000828152600284016020526040902054155b156133f6576000945050505050613427565b801561340b5750506004015491506134279050565b5060009081526002909101602052604090205491506134279050565b92915050565b6000546001600160a01b031633146134575760405162461bcd60e51b815260040161083b9061408e565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254604051630e39b00f60e11b81524360048201526000916001600160a01b031690631c73601e90602401602060405180830381600087803b1580156134bf57600080fd5b505af11580156134d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f79190613d21565b905090565b600060405160005b601481101561351f5783811a81600c84010153600101613504565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b15801561357057600080fd5b505afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190613dac565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561360257600080fd5b505afa158015613616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363a9190613d21565b6136449190613d7e565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b15801561368057600080fd5b505afa158015613694573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136bc91908101906141b3565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561371c57600080fd5b505afa158015613730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137549190613f4b565b90925090506137638382613d50565b909110159695505050505050565b82805461377d90613f6f565b90600052602060002090601f01602090048101928261379f57600085556137e5565b82601f106137b85782800160ff198235161785556137e5565b828001600101855582156137e5579182015b828111156137e55782358255916020019190600101906137ca565b506137f19291506137f5565b5090565b5b808211156137f157600081556001016137f6565b60006020828403121561381c57600080fd5b5035919050565b6001600160a01b038116811461383857600080fd5b50565b6000806000806080858703121561385157600080fd5b84359350602085013561386381613823565b93969395505050506040820135916060013590565b6000806040838503121561388b57600080fd5b50508035926020909101359150565b6000806000606084860312156138af57600080fd5b505081359360208301359350604090920135919050565b60005b838110156138e15781810151838201526020016138c9565b838111156126e85750506000910152565b6000815180845261390a8160208601602086016138c6565b601f01601f19169290920160200192915050565b838152821515602082015260606040820152600061393f60608301846138f2565b95945050505050565b60008083601f84011261395a57600080fd5b50813567ffffffffffffffff81111561397257600080fd5b6020830191508360208260051b850101111561398d57600080fd5b9250929050565b600080600080606085870312156139aa57600080fd5b84359350602085013567ffffffffffffffff8111156139c857600080fd5b6139d487828801613948565b9598909750949560400135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613a2657613a266139e7565b604052919050565b600067ffffffffffffffff831115613a4857613a486139e7565b613a5b601f8401601f19166020016139fd565b9050828152838383011115613a6f57600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613a9b57600080fd5b8335613aa681613823565b925060208401359150604084013567ffffffffffffffff811115613ac957600080fd5b8401601f81018613613ada57600080fd5b613ae986823560208401613a2e565b9150509250925092565b60008060008060008060a08789031215613b0c57600080fd5b86359550602087013567ffffffffffffffff80821115613b2b57600080fd5b613b378a838b01613948565b909750955060408901359450606089013593506080890135915080821115613b5e57600080fd5b508701601f81018913613b7057600080fd5b613b7f89823560208401613a2e565b9150509295509295509295565b600060208284031215613b9e57600080fd5b813561211481613823565b60008083601f840112613bbb57600080fd5b50813567ffffffffffffffff811115613bd357600080fd5b60208301915083602082850101111561398d57600080fd5b600080600060408486031215613c0057600080fd5b83359250602084013567ffffffffffffffff811115613c1e57600080fd5b613c2a86828701613ba9565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613c6f57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613c8d57600080fd5b8535945060208601359350604086013567ffffffffffffffff811115613cb257600080fd5b613cbe88828901613ba9565b96999598509660600135949350505050565b600060208284031215613ce257600080fd5b81516002811061211457600080fd5b80518015158114613d0157600080fd5b919050565b600060208284031215613d1857600080fd5b61211482613cf1565b600060208284031215613d3357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613d6357613d63613d3a565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613d9057613d90613d3a565b500390565b80516001600160601b0381168114613d0157600080fd5b600080600080600060a08688031215613dc457600080fd5b613dcd86613d95565b94506020860151613ddd81613823565b604087015190945060058110613df257600080fd5b9250613e0060608701613cf1565b9150608086015190509295509295909350565b6000816000190483118215151615613e2d57613e2d613d3a565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613e5757613e57613e32565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600080600060608486031215613eec57600080fd5b8351925060208401519150604084015190509250925092565b600082613f1457613f14613e32565b500690565b6000600019821415613f2d57613f2d613d3a565b5060010190565b600081613f4357613f43613d3a565b506000190190565b60008060408385031215613f5e57600080fd5b505080516020909101519092909150565b600181811c90821680613f8357607f821691505b60208210811415613fa457634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c915080831680613fd857607f831692505b858310811415613ff657634e487b7160e01b85526022600452602485fd5b6060880183905260808801818015614015576001811461402657614051565b60ff19861682528782019650614051565b60008b81526020902060005b8681101561404b57815484820152908501908901614032565b83019750505b50949b9a5050505050505050505050565b6000806040838503121561407557600080fd5b8251915061408560208401613cf1565b90509250929050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600082516140e28184602087016138c6565b9190910192915050565b60008060008060008060c0878903121561410557600080fd5b61410e87613d95565b955061411c60208801613cf1565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b8381526000835161415c8160208501602088016138c6565b60209201918201929092526040019392505050565b60208152600061211460208301846138f2565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008060008060008060c087890312156141cc57600080fd5b8651955060208088015195506040880151945060608801519350608088015167ffffffffffffffff8082111561420157600080fd5b818a0191508a601f83011261421557600080fd5b815181811115614227576142276139e7565b8060051b91506142388483016139fd565b818152918301840191848101908d84111561425257600080fd5b938501935b8385101561427c578451925061426c83613823565b8282529385019390850190614257565b80975050505050505060a08701519050929550929550929556fea264697066735822122093e1025e8596baad92b8acbc1dfd801832f0c4845d9b926d2b306bac5cf1c9ee64736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106102045760003560e01c8063796490f911610118578063ba66fde7116100a0578063d605787b1161006f578063d605787b14610638578063da3beb8c14610658578063e349ad3014610479578063e4c0aaf414610678578063f2f4eb261461069857600080fd5b8063ba66fde7146105cd578063be467604146105ed578063c41bda6114610603578063c86ed8921461062357600080fd5b8063a6a7f0eb116100e7578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b8063796490f9146104795780637c04034e1461048f5780638e426460146104af5780639b05c261146104cf57600080fd5b80633b3041471161019b5780635c92e2f61161016a5780635c92e2f6146103b65780635e4a627d146103d657806369f3f041146103ec5780636d4cd8ea14610439578063751accd01461045957600080fd5b80633b304147146103345780634b2f0ea0146103545780634fe264fb14610367578063564a565d1461038757600080fd5b80630c340a24116101d75780630c340a241461028f5780631200aabc146102c75780631c3db16d146102f4578063362c34791461031457600080fd5b8063023d44df1461020957806303432744146102325780630b274f2e146102485780630baa64d11461025f575b600080fd5b34801561021557600080fd5b5061021f60035481565b6040519081526020015b60405180910390f35b34801561023e57600080fd5b5061021f60065481565b34801561025457600080fd5b5061025d6106b8565b005b34801561026b57600080fd5b5061027f61027a36600461380a565b610c8a565b6040519015158152602001610229565b34801561029b57600080fd5b506000546102af906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102d357600080fd5b5061021f6102e236600461380a565b60086020526000908152604090205481565b34801561030057600080fd5b5061021f61030f36600461380a565b610d01565b34801561032057600080fd5b5061021f61032f36600461383b565b610d8b565b34801561034057600080fd5b506102af61034f36600461380a565b611179565b61025d610362366004613878565b611731565b34801561037357600080fd5b5061021f61038236600461389a565b611fcb565b34801561039357600080fd5b506103a76103a236600461380a565b61211b565b6040516102299392919061391e565b3480156103c257600080fd5b5061025d6103d1366004613994565b6121e1565b3480156103e257600080fd5b5061021f60045481565b3480156103f857600080fd5b5061040c61040736600461389a565b6124ed565b604080519687529415156020870152938501929092526060840152608083015260a082015260c001610229565b34801561044557600080fd5b5061027f61045436600461380a565b6125a5565b34801561046557600080fd5b5061025d610474366004613a86565b61261c565b34801561048557600080fd5b5061021f61271081565b34801561049b57600080fd5b5061025d6104aa366004613af3565b6126ee565b3480156104bb57600080fd5b5061025d6104ca366004613b8c565b612e26565b3480156104db57600080fd5b506104ef6104ea36600461380a565b612e72565b60408051928352901515602083015201610229565b34801561051057600080fd5b5061025d61051f366004613beb565b612ef5565b34801561053057600080fd5b5061054461053f36600461389a565b612f47565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610229565b34801561057c57600080fd5b5060055461058a9060ff1681565b6040516102299190613c4d565b3480156105a357600080fd5b5061021f614e2081565b3480156105b957600080fd5b5061025d6105c8366004613c75565b61300d565b3480156105d957600080fd5b5061027f6105e836600461389a565b6131c6565b3480156105f957600080fd5b5061021f61138881565b34801561060f57600080fd5b5061025d61061e366004613b8c565b613261565b34801561062f57600080fd5b5061027f6132ad565b34801561064457600080fd5b506002546102af906001600160a01b031681565b34801561066457600080fd5b5061021f610673366004613878565b6132cd565b34801561068457600080fd5b5061025d610693366004613b8c565b61342d565b3480156106a457600080fd5b506001546102af906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106fd57600080fd5b505afa158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190613cd0565b600181111561074657610746613c37565b14806107d35750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190613d06565b1561085e57600060055460ff1660028111156107f1576107f1613c37565b14156108445760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600580546000919060ff19166001835b0217905550610c49565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ad57600080fd5b505afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e59190613cd0565b60018111156108f6576108f6613c37565b1415610c4957600060055460ff16600281111561091557610915613c37565b1415610ac45760006006541161096d5760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f727300000000604482015260640161083b565b600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f39190613d21565b6109fe906014613d50565b431015610a4d5760405162461bcd60e51b815260206004820152601e60248201527f546f6f20736f6f6e3a204c312066696e616c6974792072657175697265640000604482015260640161083b565b4360038190556002546040516303dce1a760e51b815260048101929092526001600160a01b031690637b9c34e090602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050600580546001935090915060ff19168280610854565b600160055460ff166002811115610add57610add613c37565b1415610bcf5760025460035460405163ca4742f160e01b81526001600160a01b039092169163ca4742f191610b189160040190815260200190565b602060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613d21565b6004819055610bbb5760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161083b565b600580546002919060ff1916600183610854565b600260055460ff166002811115610be857610be8613c37565b1415610c495760065415610c3e5760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e67207068617365000000604482015260640161083b565b6005805460ff191690555b6005546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c809160ff90911690613c4d565b60405180910390a1565b600081815260086020526040812054600780548392908110610cae57610cae613d68565b60009182526020822060059091020180549092508290610cd090600190613d7e565b81548110610ce057610ce0613d68565b60009182526020909120600c90910201805460059091015414949350505050565b600081815260086020526040812054600780548392908110610d2557610d25613d68565b60009182526020822060059091020180549092508290610d4790600190613d7e565b81548110610d5757610d57613d68565b60009182526020909120600c90910201600381015490915060ff16610d80578060010154610d83565b60005b949350505050565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610dd457600080fd5b505afa158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c9190613dac565b50935050505080610e5f5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e0000000000604482015260640161083b565b600086815260086020526040812054600780549091908110610e8357610e83613d68565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610eb757610eb7613d68565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160206040518083038186803b158015610f0d57600080fd5b505afa158015610f21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f459190613d21565b600087815260078401602052604090205490915060ff16610f8d576001600160a01b0388166000908152600883016020908152604080832089845290915290205494506110d3565b80861415611003576000868152600683016020526040902054610fb1576000610ffc565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b8652909352922054610ff29190613e13565b610ffc9190613e48565b94506110d3565b600081815260078301602052604090205460ff166110d35781600601600083600a0160018154811061103757611037613d68565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061106d5761106d613d68565b90600052602060002001548152602001908152602001600020546110919190613d50565b60098301546001600160a01b038a16600090815260088501602090815260408083208b84529091529020546110c69190613e13565b6110d09190613e48565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561116d576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146111a65760405162461bcd60e51b815260040161083b90613e5c565b6000828152600860205260409020546007805484929081106111ca576111ca613d68565b600091825260209091206002600590920201015460ff16156111fe5760405162461bcd60e51b815260040161083b90613ea0565b600260055460ff16600281111561121757611217613c37565b146112645760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e67207068617365000000000000604482015260640161083b565b60008381526008602052604081205460078054909190811061128857611288613d68565b600091825260208220600590910201805490925082906112aa90600190613d7e565b815481106112ba576112ba613d68565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561131057600080fd5b505afa158015611324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113489190613dac565b50929350506001600160601b038316915060009050611365613479565b60015460405163bfabfe8f60e01b81526004810185905260006024820181905292935082916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156113b557600080fd5b505afa1580156113c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ed9190613ed7565b50600154604051630a48b58160e21b81526004810188905260006024820181905293955091935082916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561144357600080fd5b505afa158015611457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147b9190613d21565b6114859086613f05565b90505b826114938386613e13565b61149e906001613d50565b101561158b5760015b848111611585576000816114bb8588613e13565b6114c59190613d50565b600154604051630a48b58160e21b8152600481018b9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561151657600080fd5b505afa15801561152a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154e9190613d21565b9050808410611568576115618185613d7e565b9350611570565b509250611585565b5050808061157d90613f19565b9150506114a7565b50611488565b60015460405163bfabfe8f60e01b815260048101889052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156115d757600080fd5b505afa1580156115eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160f9190613ed7565b9250505061161c816134fc565b9b506116288d8d613527565b1561171c578860000160405180608001604052808e6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505088600b015489600001805490501415611717576006805490600061171183613f34565b91905055505b611721565b60009b505b5050505050505050505050919050565b60008281526008602052604090205460078054849290811061175557611755613d68565b600091825260209091206002600590920201015460ff16156117895760405162461bcd60e51b815260040161083b90613ea0565b6000838152600860205260408120546007805490919081106117ad576117ad613d68565b9060005260206000209060050201905080600101548311156118115760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e604482015260640161083b565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118919190613f4b565b915091508142101580156118a457508042105b6118e95760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b604482015260640161083b565b604051631c3db16d60e01b81526004810187905260009086903090631c3db16d9060240160206040518083038186803b15801561192557600080fd5b505afa158015611939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195d9190613d21565b141561196c57506127106119ec565b61271061138861197c8585613d7e565b6119869190613e13565b6119909190613e48565b61199a8442613d7e565b106119e75760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f73657200604482015260640161083b565b50614e205b835460009085906119ff90600190613d7e565b81548110611a0f57611a0f613d68565b60009182526020822060018054604051637e37c78b60e11b8152600481018e9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611a6957600080fd5b505afa158015611a7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa19190613d21565b611aab9190613d7e565b600089815260078401602052604090205490915060ff1615611b0f5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e0000000000604482015260640161083b565b600154604051632cf6413f60e11b8152600481018b90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611b5457600080fd5b505afa158015611b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8c9190613d21565b90506000612710611b9d8684613e13565b611ba79190613e48565b611bb19083613d50565b60008b815260068601602052604081205491925090821115611c545760008b81526006860160205260409020543490611bea9084613d7e565b11611c0f5760008b8152600686016020526040902054611c0a9083613d7e565b611c11565b345b604080518d815260208101839052919250339186918f917fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c0910160405180910390a45b33600090815260088601602090815260408083208e845290915281208054839290611c80908490613d50565b909155505060008b815260068601602052604081208054839290611ca5908490613d50565b909155505060008b81526006860160205260409020548211611d4f5760008b815260068601602052604081205460098701805491929091611ce7908490613d50565b9091555050600a8501805460018181018355600092835260208084209092018e90558d8352600788019091526040808320805460ff1916909217909155518c9186918f917fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00991a45b600a85015460011015611f8f57828560090154611d6c9190613d7e565b60098601556001546040516319b8152960e01b8152600481018e90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611db557600080fd5b505afa158015611dc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ded9190613d06565b15611e065760028901805460ff19166001179055611f0f565b885460038a016000611e19876001613d50565b8152602001908152602001600020819055506000896000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538e6040518263ffffffff1660e01b8152600401611e9491815260200190565b60206040518083038186803b158015611eac57600080fd5b505afa158015611ec0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee49190613d21565b600b82015560038101805460ff1916600117905560068054906000611f0883613f19565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848e8c600101548d6004016040518563ffffffff1660e01b8152600401611f5c93929190613faa565b6000604051808303818588803b158015611f7557600080fd5b505af1158015611f89573d6000803e3d6000fd5b50505050505b80341115611fbd57336108fc611fa58334613d7e565b6040518115909202916000818181858888f150505050505b505050505050505050505050565b600083815260086020526040812054600780548392908110611fef57611fef613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061202357612023613d68565b90600052602060002090600c0201600001848154811061204557612045613d68565b600091825260208220600154604051639b05c26160e01b815260048082018c905293909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561209d57600080fd5b505afa1580156120b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d59190614062565b6003850154919350915060ff1680156120f8575081836002015414806120f85750805b1561210b57612710945050505050612114565b60009450505050505b9392505050565b6007818154811061212b57600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161215e90613f6f565b80601f016020809104026020016040519081016040528092919081815260200182805461218a90613f6f565b80156121d75780601f106121ac576101008083540402835291602001916121d7565b820191906000526020600020905b8154815290600101906020018083116121ba57829003601f168201915b5050505050905083565b60008481526008602052604090205460078054869290811061220557612205613d68565b600091825260209091206002600590920201015460ff16156122395760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561227e57600080fd5b505afa158015612292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b69190613dac565b50909350600192506122c6915050565b8160048111156122d8576122d8613c37565b146123355760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b606482015260840161083b565b826123725760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b604482015260640161083b565b60008681526008602052604081205460078054909190811061239657612396613d68565b600091825260208220600590910201805490925082906123b890600190613d7e565b815481106123c8576123c8613d68565b90600052602060002090600c0201905060005b868110156124c65733828989848181106123f7576123f7613d68565b905060200201358154811061240e5761240e613d68565b60009182526020909120600490910201546001600160a01b0316146124755760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b858289898481811061248957612489613d68565b90506020020135815481106124a0576124a0613d68565b6000918252602090912060016004909202010155806124be81613f19565b9150506123db565b50868690508160050160008282546124de9190613d50565b90915550505050505050505050565b60008060008060008060006007600860008c8152602001908152602001600020548154811061251e5761251e613d68565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061255257612552613d68565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b6000818152600860205260408120546007805483929081106125c9576125c9613d68565b600091825260208220600590910201805490925082906125eb90600190613d7e565b815481106125fb576125fb613d68565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146126465760405162461bcd60e51b815260040161083b9061408e565b6000836001600160a01b0316838360405161266191906140d0565b60006040518083038185875af1925050503d806000811461269e576040519150601f19603f3d011682016040523d82523d6000602084013e6126a3565b606091505b50509050806126e85760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b604482015260640161083b565b50505050565b60008681526008602052604090205460078054889290811061271257612712613d68565b600091825260209091206002600590920201015460ff16156127465760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561278b57600080fd5b505afa15801561279f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c39190613dac565b50909350600292506127d3915050565b8160048111156127e5576127e5613c37565b146128405760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b606482015260840161083b565b856128825760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b604482015260640161083b565b6000888152600860205260408120546007805490919081106128a6576128a6613d68565b9060005260206000209060050201905080600101548611156129015760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b604482015260640161083b565b8054600090829061291490600190613d7e565b8154811061292457612924613d68565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561297a57600080fd5b505afa15801561298e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b29190613dac565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612a0857600080fd5b505afa158015612a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4091906140ec565b5050505091505060005b8a811015612cee5733848d8d84818110612a6657612a66613d68565b9050602002013581548110612a7d57612a7d613d68565b60009182526020909120600490910201546001600160a01b031614612ae45760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b811580612b58575089888a604051602001612b0193929190614144565b60405160208183030381529060405280519060200120846000018d8d84818110612b2d57612b2d613d68565b9050602002013581548110612b4457612b44613d68565b906000526020600020906004020160010154145b612bcc576040805162461bcd60e51b81526020600482015260248101919091527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20737562636f7572747320776974682068696464656e20766f7465732e606482015260840161083b565b838c8c83818110612bdf57612bdf613d68565b9050602002013581548110612bf657612bf6613d68565b600091825260209091206003600490920201015460ff1615612c4f5760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b604482015260640161083b565b89848d8d84818110612c6357612c63613d68565b9050602002013581548110612c7a57612c7a613d68565b60009182526020909120600260049092020101556001848d8d84818110612ca357612ca3613d68565b9050602002013581548110612cba57612cba613d68565b60009182526020909120600490910201600301805460ff191691151591909117905580612ce681613f19565b915050612a4a565b508a8a9050836004016000828254612d069190613d50565b90915550506000898152600284016020526040812080548c9290612d2b908490613d50565b90915550506001830154891415612d5b57600383015460ff1615612d565760038301805460ff191690555b612dd5565b60018301546000908152600284016020526040808220548b83529120541415612d9e57600383015460ff16612d565760038301805460ff19166001179055612dd5565b60018301546000908152600284016020526040808220548b83529120541115612dd5576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a604051612e109190614171565b60405180910390a4505050505050505050505050565b6000546001600160a01b03163314612e505760405162461bcd60e51b815260040161083b9061408e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120546007805483928392918110612e9857612e98613d68565b60009182526020822060059091020180549092508290612eba90600190613d7e565b81548110612eca57612eca613d68565b60009182526020909120600c909102016001810154600390910154909660ff90911695509350505050565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c90612f3a9087908790614184565b60405180910390a4505050565b60008060008060006007600860008a81526020019081526020016000205481548110612f7557612f75613d68565b600091825260208083208a8452600360059093020191820190526040822054815491935083918110612fa957612fa9613d68565b90600052602060002090600c02016000018781548110612fcb57612fcb613d68565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146130375760405162461bcd60e51b815260040161083b90613e5c565b60078054600181018255600091909152600581027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68981018690557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101906130c2907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c018686613771565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561311457600080fd5b505afa158015613128573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061314c9190613d21565b6131569190613d7e565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600890925282208490556006805491926131b783613f19565b91905055505050505050505050565b6000838152600860205260408120546007805483929081106131ea576131ea613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061321e5761321e613d68565b90600052602060002090600c0201600001848154811061324057613240613d68565b600091825260209091206004909102016003015460ff169695505050505050565b6000546001600160a01b0316331461328b5760405162461bcd60e51b815260040161083b9061408e565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008060055460ff1660028111156132c7576132c7613c37565b14905090565b6000828152600860205260408120546007805483929081106132f1576132f1613d68565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061332557613325613d68565b600091825260208220600154604051639b05c26160e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561337e57600080fd5b505afa158015613392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b69190614062565b915091508260040154600014806133e45750801580156133e457506000828152600284016020526040902054155b156133f6576000945050505050613427565b801561340b5750506004015491506134279050565b5060009081526002909101602052604090205491506134279050565b92915050565b6000546001600160a01b031633146134575760405162461bcd60e51b815260040161083b9061408e565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254604051630e39b00f60e11b81524360048201526000916001600160a01b031690631c73601e90602401602060405180830381600087803b1580156134bf57600080fd5b505af11580156134d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f79190613d21565b905090565b600060405160005b601481101561351f5783811a81600c84010153600101613504565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b15801561357057600080fd5b505afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190613dac565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561360257600080fd5b505afa158015613616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363a9190613d21565b6136449190613d7e565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b15801561368057600080fd5b505afa158015613694573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136bc91908101906141b3565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561371c57600080fd5b505afa158015613730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137549190613f4b565b90925090506137638382613d50565b909110159695505050505050565b82805461377d90613f6f565b90600052602060002090601f01602090048101928261379f57600085556137e5565b82601f106137b85782800160ff198235161785556137e5565b828001600101855582156137e5579182015b828111156137e55782358255916020019190600101906137ca565b506137f19291506137f5565b5090565b5b808211156137f157600081556001016137f6565b60006020828403121561381c57600080fd5b5035919050565b6001600160a01b038116811461383857600080fd5b50565b6000806000806080858703121561385157600080fd5b84359350602085013561386381613823565b93969395505050506040820135916060013590565b6000806040838503121561388b57600080fd5b50508035926020909101359150565b6000806000606084860312156138af57600080fd5b505081359360208301359350604090920135919050565b60005b838110156138e15781810151838201526020016138c9565b838111156126e85750506000910152565b6000815180845261390a8160208601602086016138c6565b601f01601f19169290920160200192915050565b838152821515602082015260606040820152600061393f60608301846138f2565b95945050505050565b60008083601f84011261395a57600080fd5b50813567ffffffffffffffff81111561397257600080fd5b6020830191508360208260051b850101111561398d57600080fd5b9250929050565b600080600080606085870312156139aa57600080fd5b84359350602085013567ffffffffffffffff8111156139c857600080fd5b6139d487828801613948565b9598909750949560400135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613a2657613a266139e7565b604052919050565b600067ffffffffffffffff831115613a4857613a486139e7565b613a5b601f8401601f19166020016139fd565b9050828152838383011115613a6f57600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613a9b57600080fd5b8335613aa681613823565b925060208401359150604084013567ffffffffffffffff811115613ac957600080fd5b8401601f81018613613ada57600080fd5b613ae986823560208401613a2e565b9150509250925092565b60008060008060008060a08789031215613b0c57600080fd5b86359550602087013567ffffffffffffffff80821115613b2b57600080fd5b613b378a838b01613948565b909750955060408901359450606089013593506080890135915080821115613b5e57600080fd5b508701601f81018913613b7057600080fd5b613b7f89823560208401613a2e565b9150509295509295509295565b600060208284031215613b9e57600080fd5b813561211481613823565b60008083601f840112613bbb57600080fd5b50813567ffffffffffffffff811115613bd357600080fd5b60208301915083602082850101111561398d57600080fd5b600080600060408486031215613c0057600080fd5b83359250602084013567ffffffffffffffff811115613c1e57600080fd5b613c2a86828701613ba9565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613c6f57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613c8d57600080fd5b8535945060208601359350604086013567ffffffffffffffff811115613cb257600080fd5b613cbe88828901613ba9565b96999598509660600135949350505050565b600060208284031215613ce257600080fd5b81516002811061211457600080fd5b80518015158114613d0157600080fd5b919050565b600060208284031215613d1857600080fd5b61211482613cf1565b600060208284031215613d3357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613d6357613d63613d3a565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613d9057613d90613d3a565b500390565b80516001600160601b0381168114613d0157600080fd5b600080600080600060a08688031215613dc457600080fd5b613dcd86613d95565b94506020860151613ddd81613823565b604087015190945060058110613df257600080fd5b9250613e0060608701613cf1565b9150608086015190509295509295909350565b6000816000190483118215151615613e2d57613e2d613d3a565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613e5757613e57613e32565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600080600060608486031215613eec57600080fd5b8351925060208401519150604084015190509250925092565b600082613f1457613f14613e32565b500690565b6000600019821415613f2d57613f2d613d3a565b5060010190565b600081613f4357613f43613d3a565b506000190190565b60008060408385031215613f5e57600080fd5b505080516020909101519092909150565b600181811c90821680613f8357607f821691505b60208210811415613fa457634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c915080831680613fd857607f831692505b858310811415613ff657634e487b7160e01b85526022600452602485fd5b6060880183905260808801818015614015576001811461402657614051565b60ff19861682528782019650614051565b60008b81526020902060005b8681101561404b57815484820152908501908901614032565b83019750505b50949b9a5050505050505050505050565b6000806040838503121561407557600080fd5b8251915061408560208401613cf1565b90509250929050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600082516140e28184602087016138c6565b9190910192915050565b60008060008060008060c0878903121561410557600080fd5b61410e87613d95565b955061411c60208801613cf1565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b8381526000835161415c8160208501602088016138c6565b60209201918201929092526040019392505050565b60208152600061211460208301846138f2565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008060008060008060c087890312156141cc57600080fd5b8651955060208088015195506040880151945060608801519350608088015167ffffffffffffffff8082111561420157600080fd5b818a0191508a601f83011261421557600080fd5b815181811115614227576142276139e7565b8060051b91506142388483016139fd565b818152918301840191848101908d84111561425257600080fd5b938501935b8385101561427c578451925061426c83613823565b8282529385019390850190614257565b80975050505050505060a08701519050929550929550929556fea264697066735822122093e1025e8596baad92b8acbc1dfd801832f0c4845d9b926d2b306bac5cf1c9ee64736f6c63430008090033", + "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)": { + "details": "Changes the `_rng` storage variable.", + "params": { + "_rng": "The new value for the `RNGenerator` storage variable." + } + }, + "constructor": { + "details": "Constructor.", + "params": { + "_core": "The KlerosCore arbitrator.", + "_governor": "The governor's address.", + "_rng": "The random number generator." + } + }, + "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": { + "ruling": "The current ruling." + } + }, + "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." + } + }, + "getLastRoundResult(uint256)": { + "details": "Returns the voting data from the most relevant round.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core, not in the Dispute Kit." + }, + "returns": { + "tied": "Whether it's a tie or not.", + "winningChoice": "The winning choice of this round." + } + }, + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 6201, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 6204, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "core", + "offset": 0, + "slot": "1", + "type": "t_contract(KlerosCore)5813" + }, + { + "astId": 6378, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "rng", + "offset": 0, + "slot": "2", + "type": "t_contract(RNG)24354" + }, + { + "astId": 6380, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "RNBlock", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 6382, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "RN", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 6385, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "phase", + "offset": 0, + "slot": "5", + "type": "t_enum(Phase)6301" + }, + { + "astId": 6387, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "disputesWithoutJurors", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 6391, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "disputes", + "offset": 0, + "slot": "7", + "type": "t_array(t_struct(Dispute)6316_storage)dyn_storage" + }, + { + "astId": 6395, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "coreDisputeIDToLocal", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint256,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(Dispute)6316_storage)dyn_storage": { + "base": "t_struct(Dispute)6316_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassic.Dispute[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Round)6354_storage)dyn_storage": { + "base": "t_struct(Round)6354_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassic.Round[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Vote)6363_storage)dyn_storage": { + "base": "t_struct(Vote)6363_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassic.Vote[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(KlerosCore)5813": { + "encoding": "inplace", + "label": "contract KlerosCore", + "numberOfBytes": "20" + }, + "t_contract(RNG)24354": { + "encoding": "inplace", + "label": "contract RNG", + "numberOfBytes": "20" + }, + "t_enum(Phase)6301": { + "encoding": "inplace", + "label": "enum DisputeKitClassic.Phase", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_uint256,t_bool)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Dispute)6316_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassic.Dispute", + "members": [ + { + "astId": 6305, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "rounds", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(Round)6354_storage)dyn_storage" + }, + { + "astId": 6307, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "numberOfChoices", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 6309, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "jumped", + "offset": 0, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 6313, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "coreRoundIDToLocal", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 6315, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "extraData", + "offset": 0, + "slot": "4", + "type": "t_bytes_storage" + } + ], + "numberOfBytes": "160" + }, + "t_struct(Round)6354_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassic.Round", + "members": [ + { + "astId": 6320, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "votes", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(Vote)6363_storage)dyn_storage" + }, + { + "astId": 6322, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "winningChoice", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 6326, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "counts", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 6328, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "tied", + "offset": 0, + "slot": "3", + "type": "t_bool" + }, + { + "astId": 6330, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "totalVoted", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 6332, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "totalCommitted", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 6336, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "paidFees", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 6340, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "hasPaid", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint256,t_bool)" + }, + { + "astId": 6346, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "contributions", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 6348, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "feeRewards", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 6351, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "fundedChoices", + "offset": 0, + "slot": "10", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 6353, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "nbVotes", + "offset": 0, + "slot": "11", + "type": "t_uint256" + } + ], + "numberOfBytes": "384" + }, + "t_struct(Vote)6363_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassic.Vote", + "members": [ + { + "astId": 6356, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "account", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 6358, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "commit", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 6360, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "choice", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 6362, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "voted", + "offset": 0, + "slot": "3", + "type": "t_bool" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/README.md b/contracts/README.md index 33e25bbdb..718a16889 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -8,37 +8,46 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments ### v2-prealpha-3 -#### Arbitrum Rinkeby +#### Goerli -- [PNK](https://testnet.arbiscan.io/token/0x364530164a2338cdba211f72c1438eb811b5c639) -- [DisputeKitClassic](https://testnet.arbiscan.io/address/0x6b9268082415b5499175849E46AaE4EDf819916F) -- [DisputeResolver](https://testnet.arbiscan.io/address/0x9cE885713c7459d571593e2793cd2b258B018995) -- [IncrementalNG](https://testnet.arbiscan.io/address/0x078dAd05373d19d7fd6829735b765F12242a4300) -- [KlerosCore](https://testnet.arbiscan.io/address/0x140Cae40BD7eEF075e15c30CF84d1EAa0F4932b8) -- [SortitionSumTreeFactory](https://testnet.arbiscan.io/address/0x48ce286978C74c288eA6Bc9a536BcC899DF8D177) +- [PNK](https://goerli.etherscan.io/token/0xA3B02bA6E10F55fb177637917B1b472da0110CcC) +- [ArbitrableExample](https://goerli.etherscan.io/address/0x04Fb43F2Ce076867b5ba38750Ecb2cc6BDe78D61) +- [FastBridgeReceiverOnEthereum](https://goerli.etherscan.io/address/0x87142b7E9C7D026776499120D902AF8896C07894) +- [ForeignGatewayOnEthereum](https://goerli.etherscan.io/address/0xf08273e2B35E78509B027f6FAa32485844EA7cCA) -### v2-prealpha-1 +#### Arbitrum Goerli (Nitro) + +- [PNK](https://goerli-rollup-explorer.arbitrum.io/token/0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610/token-transfers) +- [DisputeKitClassic](https://goerli-rollup-explorer.arbitrum.io/address/0x8F1a2B8F9b04320375856580Fc6B1669Cb12a9EE) +- [DisputeResolver](https://goerli-rollup-explorer.arbitrum.io/address/0x04Fb43F2Ce076867b5ba38750Ecb2cc6BDe78D61) +- [FastBridgeSender](https://goerli-rollup-explorer.arbitrum.io/address/0xcFc0b84419583ff7b32fD5139B789cE858517d4C) +- [HomeGatewayToEthereum](https://goerli-rollup-explorer.arbitrum.io/address/0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636) +- [IncrementalNG](https://goerli-rollup-explorer.arbitrum.io/address/0x99c1f883f0f5de1737099F1BCB268d1f8D450f8b) +- [KlerosCore](https://goerli-rollup-explorer.arbitrum.io/address/0x87142b7E9C7D026776499120D902AF8896C07894) +- [PolicyRegistry](https://goerli-rollup-explorer.arbitrum.io/address/0xf637A0a4415CCFB97407846486b6be663d3C33ef) +- [SortitionSumTreeFactory](https://goerli-rollup-explorer.arbitrum.io/address/0x26858D60FE92b50b34e236B46874e02724344275) #### Rinkeby - [PNK](https://rinkeby.etherscan.io/token/0x14aba1fa8a31a8649e8098ad067b739cc5708f30) -- [ArbitrableExample](https://rinkeby.etherscan.io/address/0xf2a59723c5d625D646668E0B615B5764c3F81540) -- [FastBridgeReceiver](https://rinkeby.etherscan.io/address/0xD78DCddE2C5a2Bd4BB246Bc7dB6994b95f7c442C) -- [ForeignGateway](https://rinkeby.etherscan.io/address/0xf02733d9e5CbfE67B54F165b0277E1995106D526) +- [ArbitrableExample](https://rinkeby.etherscan.io/address/0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b) +- [FastBridgeReceiverOnEthereum](https://rinkeby.etherscan.io/address/0x545C731e84c0034d58e57E476A3b7C3929d070CC) +- [ForeignGatewayOnEthereum](https://rinkeby.etherscan.io/address/0x8681CE0CA5706Cf4732d9060e8eC9f865F7d546a) #### Arbitrum Rinkeby - [PNK](https://testnet.arbiscan.io/token/0x364530164a2338cdba211f72c1438eb811b5c639) -- [ConstantNG](https://testnet.arbiscan.io/address/0x4401A368dea8D5761AEEFfd3c4a674086dea0666) -- [DisputeKitClassic](https://testnet.arbiscan.io/address/0xed12799915180a257985631fbD2ead261eD838cf) -- [FastBridgeSender](https://testnet.arbiscan.io/address/0x0b9e03455Fed83f209Fa7ce596c93ba6aBAd1f46) -- [HomeGateway](https://testnet.arbiscan.io/address/0x2Aa1f82d363f79c1E7a4CcF955Fb7E4306b9B260) -- [IncrementalNG](https://testnet.arbiscan.io/address/0x95Ad12eF4B5baF332aa46d1EaE9922066Fd6fE4A) -- [KlerosCore](https://testnet.arbiscan.io/address/0xd08452AEE7ab5bE3BF6733BA0d3F0CFdaf060Aa2) -- [SafeBridgeArbitrum](https://testnet.arbiscan.io/address/0x1406bC99873d16Cde3491F809f1Af9442cb5A338) -- [SortitionSumTreeFactory](https://testnet.arbiscan.io/address/0xf02733d9e5CbfE67B54F165b0277E1995106D526) +- [DisputeKitClassic](https://testnet.arbiscan.io/address/0xA2c538AA05BBCc44c213441f6f3777223D2BF9e5) +- [DisputeResolver](https://testnet.arbiscan.io/address/0x67e8191F61466c57A17542A52F9f39f336A242fD) +- [FastBridgeSender](https://testnet.arbiscan.io/address/0xf8A4a85e7153374A1b9BDA763a84252eC286843b) +- [HomeGatewayToEthereum](https://testnet.arbiscan.io/address/0x4e894c2B60214beC53B60D09F39544518296C07B) +- [IncrementalNG](https://testnet.arbiscan.io/address/0x078dAd05373d19d7fd6829735b765F12242a4300) +- [KlerosCore](https://testnet.arbiscan.io/address/0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F) +- [PNK](https://testnet.arbiscan.io/address/0x364530164a2338cdba211f72c1438eb811b5c639) +- [PolicyRegistry](https://testnet.arbiscan.io/address/0x76262035D1b280cC0b08024177b837893bcAd3DA) +- [SortitionSumTreeFactory](https://testnet.arbiscan.io/address/0x48ce286978C74c288eA6Bc9a536BcC899DF8D177) -## Contributing +## Getting Started ### Install the Dependencies @@ -116,6 +125,12 @@ yarn hardhat deploy --network localhost --tags HomeChain #### 3. Deploy to Public Testnets ```bash +# Goerli +yarn hardhat deploy --network arbitrumGoerli --tags Arbitration +yarn hardhat deploy --network goerli --tags ForeignChain +yarn hardhat deploy --network arbitrumGoerli --tags HomeChain + +# Rinkeby yarn hardhat deploy --network arbitrumRinkeby --tags Arbitration yarn hardhat deploy --network rinkeby --tags ForeignChain yarn hardhat deploy --network arbitrumRinkeby --tags HomeChain @@ -143,5 +158,38 @@ yarn hardhat test --network localhost test/pre-alpha1/index.ts This must be done for each network separately. ```bash -yarn hardhat --network etherscan-verify +yarn hardhat --network etherscan-verify +``` + +## Ad-hoc procedures + +### Populating the policy registry and courts + +#### 1/ Export the registry data from V1 + +```bash +yarn hardhat run scripts/getPoliciesV1.ts --network mainnet | tee policies.v1.json +yarn hardhat run scripts/getCourtsV1.ts --network mainnet | tee courts.v1.json +``` + +#### 2/ Import the data to V2 - Local Network + +Shell 1: + +```bash +yarn hardhat node --tags Arbitration +``` + +Shell 2: + +```bash +yarn hardhat run scripts/populatePolicyRegistry.ts --network localhost +yarn hardhat run scripts/populateCourts.ts --network localhost +``` + +#### 3/ Import the data to V2 - Public Testnet + +```bash +yarn hardhat run scripts/populatePolicyRegistry.ts --network arbitrumRinkeby +yarn hardhat run scripts/populateCourts.ts --network arbitrumRinkeby ``` diff --git a/contracts/deploy/00-home-chain-arbitration.ts b/contracts/deploy/00-home-chain-arbitration.ts index cdbe86f60..123beeeb5 100644 --- a/contracts/deploy/00-home-chain-arbitration.ts +++ b/contracts/deploy/00-home-chain-arbitration.ts @@ -6,12 +6,14 @@ import getContractAddress from "../deploy-helpers/getContractAddress"; enum HomeChains { ARBITRUM_ONE = 42161, ARBITRUM_RINKEBY = 421611, + ARBITRUM_GOERLI = 421613, HARDHAT = 31337, } const pnkByChain = new Map([ [HomeChains.ARBITRUM_ONE, "0x330bD769382cFc6d50175903434CCC8D206DCAE5"], [HomeChains.ARBITRUM_RINKEBY, "0x364530164a2338cdba211f72c1438eb811b5c639"], + [HomeChains.ARBITRUM_GOERLI, "0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610"], ]); const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { @@ -31,9 +33,15 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) const chainId = Number(await getChainId()); console.log("deploying to %s with deployer %s", HomeChains[chainId], deployer); - const rng = await deploy("IncrementalNG", { + await deploy("PolicyRegistry", { from: deployer, - args: [67193503189], + args: [deployer], + log: true, + }); + + const rng = await deploy("BlockHashRNG", { + from: deployer, + args: [], log: true, }); @@ -43,6 +51,7 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) log: true, }); + let nonce; if (chainId === HomeChains.HARDHAT) { pnkByChain.set( HomeChains.HARDHAT, @@ -53,18 +62,21 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) }) ).address ); + nonce = await ethers.provider.getTransactionCount(deployer); + nonce += 1; + } else { + const homeChainProvider = new providers.JsonRpcProvider(homeNetworks[chainId].url); + nonce = await homeChainProvider.getTransactionCount(deployer); + // TODO: Nonce hasn't been determined for this part of the condition. + nonce += 1; } - let nonce; - const homeChainProvider = new providers.JsonRpcProvider(homeNetworks[chainId].url); - nonce = await homeChainProvider.getTransactionCount(deployer); - nonce += 4; const KlerosCoreAddress = getContractAddress(deployer, nonce); console.log("calculated future KlerosCore address for nonce %d: %s", nonce, KlerosCoreAddress); const sortitionModule = await deploy("SortitionModule", { from: deployer, - args: [KlerosCoreAddress, 120, 120], // minStakingTime, maxFreezingTime + args: [KlerosCoreAddress, 1800, 1800], // minStakingTime, maxFreezingTime log: true, }); @@ -84,7 +96,6 @@ const deployArbitration: DeployFunction = async (hre: HardhatRuntimeEnvironment) [0, 0, 0, 0], // evidencePeriod, commitPeriod, votePeriod, appealPeriod 0xfa, // Extra data for sortition module will return the default value of K sortitionModule.address, - 7, // all 3 flags set to 'true' ], log: true, }); diff --git a/contracts/deploy/01-foreign-chain.ts b/contracts/deploy/01-foreign-chain.ts index 2b5e558a0..0940ffbc7 100644 --- a/contracts/deploy/01-foreign-chain.ts +++ b/contracts/deploy/01-foreign-chain.ts @@ -8,6 +8,7 @@ import getContractAddress from "../deploy-helpers/getContractAddress"; enum ForeignChains { ETHEREUM_MAINNET = 1, ETHEREUM_RINKEBY = 4, + ETHEREUM_GOERLI = 5, HARDHAT = 31337, } const paramsByChainId = { @@ -25,6 +26,13 @@ const paramsByChainId = { homeChainId: 421611, arbitrumInbox: "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e", }, + 5: { + deposit: parseEther("0.1"), + epochPeriod: 86400, // 24 hours + challengePeriod: 14400, // 4 hours + homeChainId: 421613, + arbitrumInbox: "0x6BEbC4925716945D46F0Ec336D5C2564F419682C", + }, 31337: { deposit: parseEther("0.1"), epochPeriod: 86400, // 24 hours @@ -48,6 +56,7 @@ const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironme const homeNetworks = { 1: config.networks.arbitrum, 4: config.networks.arbitrumRinkeby, + 5: config.networks.arbitrumGoerli, 31337: config.networks.localhost, }; diff --git a/contracts/deploy/02-home-chain.ts b/contracts/deploy/02-home-chain.ts index f4b45c5fa..93bc9410d 100644 --- a/contracts/deploy/02-home-chain.ts +++ b/contracts/deploy/02-home-chain.ts @@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types"; import { DeployFunction } from "hardhat-deploy/types"; import { ethers } from "hardhat"; -const HOME_CHAIN_IDS = [42161, 421611, 31337]; // ArbOne, ArbRinkeby, Hardhat +const HOME_CHAIN_IDS = [42161, 421611, 421613, 31337]; // ArbOne, ArbRinkeby, ArbiGoerli, Hardhat const epochPeriod = 86400; // 24 hours // TODO: use deterministic deployments @@ -21,7 +21,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const fastBridgeReceiver = await deployments.get("FastBridgeReceiverOnEthereum"); const arbSysMock = await deploy("ArbSysMock", { from: deployer, log: true }); - const fastBridgeSender = await deploy("FastBridgeSenderToEthereumMock", { + const fastBridgeSender = await deploy("FastBridgeSenderMock", { from: deployer, contract: "FastBridgeSenderMock", args: [epochPeriod, fastBridgeReceiver.address, arbSysMock.address], @@ -63,7 +63,7 @@ const deployHomeGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) const liveDeployer = async () => { const fastBridgeReceiver = await hre.companionNetworks.foreign.deployments.get("FastBridgeReceiverOnEthereum"); - const fastBridgeSender = await deploy("FastBridgeSenderToEthereum", { + const fastBridgeSender = await deploy("FastBridgeSender", { from: deployer, contract: "FastBridgeSender", args: [epochPeriod, fastBridgeReceiver.address], diff --git a/contracts/deployments/arbitrumGoerli/.chainId b/contracts/deployments/arbitrumGoerli/.chainId new file mode 100644 index 000000000..16be23a37 --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/.chainId @@ -0,0 +1 @@ +421613 \ No newline at end of file diff --git a/contracts/deployments/arbitrumGoerli/DisputeKitClassic.json b/contracts/deployments/arbitrumGoerli/DisputeKitClassic.json new file mode 100644 index 000000000..052f0b093 --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/DisputeKitClassic.json @@ -0,0 +1,1480 @@ +{ + "address": "0x8F1a2B8F9b04320375856580Fc6B1669Cb12a9EE", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract KlerosCore", + "name": "_core", + "type": "address" + }, + { + "internalType": "contract RNG", + "name": "_rng", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_coreRoundID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_choice", + "type": "uint256" + } + ], + "name": "ChoiceFunded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_coreDisputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "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": "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": "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": "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" + } + ], + "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" + } + ], + "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": "getLastRoundResult", + "outputs": [ + { + "internalType": "uint256", + "name": "winningChoice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "tied", + "type": "bool" + } + ], + "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": "rng", + "outputs": [ + { + "internalType": "contract RNG", + "name": "", + "type": "address" + } + ], + "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" + } + ], + "transactionHash": "0x222a3fed2eec47f5cfbc2fce4d35d23f0c01d601b238c8e6ab140308803358a4", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x8F1a2B8F9b04320375856580Fc6B1669Cb12a9EE", + "transactionIndex": 1, + "gasUsed": "3795514", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xa3ca778b5fb34a9080c93637233118eef385b25643c14d78fe1b5896aa7e8891", + "transactionHash": "0x222a3fed2eec47f5cfbc2fce4d35d23f0c01d601b238c8e6ab140308803358a4", + "logs": [], + "blockNumber": 133629, + "cumulativeGasUsed": "3795514", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x0000000000000000000000000000000000000000", + "0x99c1f883f0f5de1737099F1BCB268d1f8D450f8b" + ], + "numDeployments": 2, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"ChoiceFunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"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\":\"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\":\"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\":\"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\"}],\"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\"}],\"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\":\"getLastRoundResult\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"}],\"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\":\"rng\",\"outputs\":[{\"internalType\":\"contract RNG\",\"name\":\"\",\"type\":\"address\"}],\"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)\":{\"details\":\"Changes the `_rng` storage variable.\",\"params\":{\"_rng\":\"The new value for the `RNGenerator` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_core\":\"The KlerosCore arbitrator.\",\"_governor\":\"The governor's address.\",\"_rng\":\"The random number generator.\"}},\"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\":{\"ruling\":\"The current ruling.\"}},\"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.\"}},\"getLastRoundResult(uint256)\":{\"details\":\"Returns the voting data from the most relevant round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\"},\"returns\":{\"tied\":\"Whether it's a tie or not.\",\"winningChoice\":\"The winning choice of this round.\"}},\"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\":200},\"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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling);\\n\\n /** @dev Returns the voting data from the most relevant round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @return winningChoice The winning choice of this round.\\n * @return tied Whether it's a tie or not.\\n */\\n function getLastRoundResult(uint256 _coreDisputeID) external view returns (uint256 winningChoice, bool tied);\\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(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) 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 )\\n external\\n view\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n );\\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\":\"0x235f027aa27fa972c56d863cfbc33832c8100135cf32d6827294de138e97dd44\",\"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 subcourtID; // The ID of the subcourt 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[] subcourtIDs; // The IDs of subcourts 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 subcourt in the form `stakedTokens[subcourtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the subcourt in the form `lockedTokens[subcourtID]`.\\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 subcourtID; // The ID of the subcourt.\\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 subcourts.\\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 _subcourtID, 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 SubcourtCreated(\\n uint256 indexed _subcourtID,\\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 SubcourtModified(uint96 indexed _subcourtID, string _param);\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _subcourtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromSubcourtID,\\n uint96 _toSubcourtID\\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 SubcourtCreated.\\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 SubcourtCreated(\\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 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 * @param _supportedDisputeKits Indexes of dispute kits that this subcourt will support.\\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 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 subcourtID = 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(subcourtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(subcourtID);\\n emit SubcourtCreated(\\n subcourtID,\\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 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(\\n _subcourtID == GENERAL_COURT || courts[courts[_subcourtID].parent].minStake <= _minStake,\\n \\\"MinStake lower than parent court\\\"\\n );\\n for (uint256 i = 0; i < courts[_subcourtID].children.length; i++) {\\n require(courts[courts[_subcourtID].children[i]].minStake >= _minStake, \\\"MinStake lower than parent court\\\");\\n }\\n\\n courts[_subcourtID].minStake = _minStake;\\n emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeHiddenVotes(uint96 _subcourtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_subcourtID].hiddenVotes = _hiddenVotes;\\n emit SubcourtModified(_subcourtID, \\\"hiddenVotes\\\");\\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(uint96 _subcourtID, uint256[4] memory _timesPerPeriod)\\n external\\n onlyByGovernor\\n {\\n courts[_subcourtID].timesPerPeriod = _timesPerPeriod;\\n emit SubcourtModified(_subcourtID, \\\"timesPerPeriod\\\");\\n }\\n\\n /** @dev Adds/removes court's support for specified dispute kits.\\n * @param _subcourtID The ID of the subcourt.\\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 subcourt.\\n */\\n function enableDisputeKits(\\n uint96 _subcourtID,\\n uint256[] memory _disputeKitIDs,\\n bool _enable\\n ) external onlyByGovernor {\\n Court storage subcourt = courts[_subcourtID];\\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(_subcourtID, _disputeKitIDs[i], true);\\n } else {\\n require(\\n !(_subcourtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't disable Root DK in General\\\"\\n );\\n enableDisputeKit(_subcourtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\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, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _subcourtID, _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.subcourtID, 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 subcourt (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(uint256 _numberOfChoices, bytes memory _extraData)\\n external\\n payable\\n override\\n returns (uint256 disputeID)\\n {\\n require(msg.value >= arbitrationCost(_extraData), \\\"ETH too low for arbitration cost\\\");\\n\\n (uint96 subcourtID, , uint256 disputeKitID) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n require(courts[subcourtID].supportedDisputeKits[disputeKitID], \\\"DK unsupported by subcourt\\\");\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.subcourtID = subcourtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.subcourtID];\\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.subcourtID];\\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.subcourtID] += round.tokensAtStakePerJuror;\\n round.drawnJurors.push(drawnAddress);\\n emit Draw(drawnAddress, _disputeID, currentRound, i);\\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(\\n uint256 _disputeID,\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) 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 newSubcourtID = dispute.subcourtID;\\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[newDisputeKitID].jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n newSubcourtID = courts[newSubcourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newSubcourtID].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 newSubcourtID = courts[newSubcourtID].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[newSubcourtID].supportedDisputeKits[newDisputeKitID]) {\\n newSubcourtID = GENERAL_COURT;\\n }\\n\\n if (newSubcourtID != dispute.subcourtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.subcourtID, newSubcourtID);\\n }\\n }\\n\\n dispute.subcourtID = newSubcourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newSubcourtID];\\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(\\n uint256 _disputeID,\\n uint256 _round,\\n uint256 _iterations\\n ) 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.subcourtID] -= 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.subcourtID] >= courts[dispute.subcourtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.subcourtID] - penalty;\\n setStakeForAccount(account, dispute.subcourtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.subcourtID] != 0) {\\n setStakeForAccount(account, dispute.subcourtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n for (uint256 j = 0; j < jurors[account].subcourtIDs.length; j++) {\\n setStakeForAccount(account, jurors[account].subcourtIDs[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.subcourtID] -=\\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.subcourtID] == 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 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)\\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 subcourtID, uint256 minJurors, ) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[subcourtID].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.subcourtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n if (dispute.subcourtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent subcourt.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current subcourt.\\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.subcourtID].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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n return disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round)\\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 _subcourtID)\\n external\\n view\\n returns (uint256 staked, uint256 locked)\\n {\\n staked = jurors[_juror].stakedTokens[_subcourtID];\\n locked = jurors[_juror].lockedTokens[_subcourtID];\\n }\\n\\n function isSupported(uint96 _subcourtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_subcourtID].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 _subcourtID 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 _subcourtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_subcourtID];\\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(bytes32 _key, uint256 _nodeIndex)\\n public\\n view\\n returns (\\n uint256 K,\\n uint256 length,\\n bytes32 ID\\n )\\n {\\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.subcourtID];\\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 getLastRoundResult(uint256 _disputeID) external view returns (uint256 winningChoice, bool tied) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (winningChoice, tied) = disputeKitNodes[round.disputeKitID].disputeKit.getLastRoundResult(_disputeID);\\n }\\n\\n function getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function enableDisputeKit(\\n uint96 _subcourtID,\\n uint256 _disputeKitID,\\n bool _enable\\n ) internal {\\n courts[_subcourtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_subcourtID, _disputeKitID, _enable);\\n }\\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 * @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 _subcourtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_subcourtID == FORKING_COURT || _subcourtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_subcourtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_subcourtID].minStake || _stake < juror.lockedTokens[_subcourtID]) return false;\\n if (currentStake == 0 && juror.subcourtIDs.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 subcourtID: _subcourtID,\\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.subcourtIDs.push(_subcourtID);\\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[_subcourtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\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 }\\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[_subcourtID] - currentStake + _stake;\\n juror.stakedTokens[_subcourtID] = newTotalStake;\\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 == GENERAL_COURT) finished = true;\\n else currentSubcourtID = courts[currentSubcourtID].parent;\\n }\\n\\n emit StakeSet(_account, _subcourtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a subcourt 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 subcourt ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return subcourtID The subcourt ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\n function extraDataToSubcourtIDMinJurorsDisputeKit(bytes memory _extraData)\\n internal\\n view\\n returns (\\n uint96 subcourtID,\\n uint256 minJurors,\\n uint256 disputeKitID\\n )\\n {\\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 subcourtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (subcourtID == FORKING_COURT || subcourtID >= courts.length) {\\n subcourtID = 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 subcourtID = GENERAL_COURT;\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n /** @dev Packs an account and a subcourt ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _subcourtID The subcourt ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndSubcourtIDToStakePathID(address _account, uint96 _subcourtID)\\n internal\\n pure\\n returns (bytes32 stakePathID)\\n {\\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 /** @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(\\n address _from,\\n address _to,\\n uint256 _value\\n ) 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\":\"0xd8593fcedfc04eba288fded13f7ccdfe51224d65b75117bad4baee156037949f\",\"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 RNBlock; // The block number when the random number was requested.\\n uint256 public RN; // 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 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 */\\n constructor(\\n address _governor,\\n KlerosCore _core,\\n RNG _rng\\n ) BaseDisputeKit(_governor, _core) {\\n rng = _rng;\\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 */\\n function changeRandomNumberGenerator(RNG _rng) external onlyByGovernor {\\n rng = _rng;\\n // TODO: if current phase is generating, call rng.requestRN() for the next block\\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 }\\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 require(block.number >= core.freezeBlock() + 20, \\\"Too soon: L1 finality required\\\");\\n // TODO: RNG process is currently unfinished.\\n RNBlock = block.number;\\n rng.requestRN(block.number);\\n phase = Phase.generating;\\n } else if (phase == Phase.generating) {\\n RN = rng.getRN(RNBlock);\\n require(RN != 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(uint256 _coreDisputeID)\\n external\\n override\\n onlyByCore\\n notJumped(_coreDisputeID)\\n returns (address drawnAddress)\\n {\\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 subcourtID, , , , ) = core.disputes(_coreDisputeID);\\n bytes32 key = bytes32(uint256(subcourtID)); // Get the ID of the tree.\\n uint256 drawnNumber = getRandomNumber();\\n\\n (uint256 K, uint256 nodesLength, ) = core.getSortitionSumTree(key, 0);\\n uint256 treeIndex = 0;\\n uint256 currentDrawnNumber = drawnNumber % 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 }\\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 subcourtID, , , , ) = core.disputes(_coreDisputeID);\\n (, bool hiddenVotes, , , , ) = core.courts(subcourtID);\\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 subcourts 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 if (this.currentRuling(_coreDisputeID) == _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 /** @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 */\\n function currentRuling(uint256 _coreDisputeID) external view override returns (uint256 ruling) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n ruling = round.tied ? 0 : round.winningChoice;\\n }\\n\\n function getLastRoundResult(uint256 _coreDisputeID)\\n external\\n view\\n override\\n returns (uint256 winningChoice, bool tied)\\n {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage lastRound = dispute.rounds[dispute.rounds.length - 1];\\n return (lastRound.winningChoice, lastRound.tied);\\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.getLastRoundResult(_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.getLastRoundResult(_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 )\\n external\\n view\\n override\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n )\\n {\\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 subcourtID, , , , ) = core.disputes(_coreDisputeID);\\n (uint256 lockedAmountPerJuror, , , , , ) = core.getRoundInfo(\\n _coreDisputeID,\\n core.getNumberOfRounds(_coreDisputeID) - 1\\n );\\n (uint256 stakedTokens, uint256 lockedTokens) = core.getJurorBalance(_juror, subcourtID);\\n return stakedTokens >= lockedTokens + lockedAmountPerJuror;\\n }\\n\\n /** @dev RNG function\\n * @return rn A random number.\\n */\\n function getRandomNumber() internal returns (uint256) {\\n return rng.getUncorrelatedRN(block.number);\\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\":\"0x9142ba7ec4cde26b876011bd9c782c75b906d1d9ab8465938ceeb3b3c2bd705f\",\"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\\n/**\\n * @authors: [@clesaege]\\n * @reviewers: [@remedcu]\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title Random Number Generator Standard\\n * @author Cl\\u00e9ment Lesaege - \\n * @dev This is an abstract contract\\n */\\nabstract contract RNG {\\n /**\\n * @dev Contribute to the reward of a random number.\\n * @param _block Block the random number is linked to.\\n */\\n function contribute(uint256 _block) public payable virtual;\\n\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRN(uint256 _block) public payable {\\n contribute(_block);\\n }\\n\\n /**\\n * @dev Get the random number.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getRN(uint256 _block) public virtual returns (uint256 RN);\\n\\n /**\\n * @dev Get a uncorrelated random number. Act like getRN but give a different number for each sender.\\n * This is to prevent users from getting correlated numbers.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getUncorrelatedRN(uint256 _block) public returns (uint256 RN) {\\n uint256 baseRN = getRN(_block);\\n if (baseRN == 0) return 0;\\n else return uint256(keccak256(abi.encode(msg.sender, baseRN)));\\n }\\n}\\n\",\"keccak256\":\"0x854bcb147fe44383cba7a5fdbcb69b3c0a9a71435c80eb73c172222da472a855\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620043c0380380620043c0833981016040819052620000349162000090565b600080546001600160a01b039485166001600160a01b031991821617909155600180549385169382169390931790925560028054919093169116179055620000e4565b6001600160a01b03811681146200008d57600080fd5b50565b600080600060608486031215620000a657600080fd5b8351620000b38162000077565b6020850151909350620000c68162000077565b6040850151909250620000d98162000077565b809150509250925092565b6142cc80620000f46000396000f3fe6080604052600436106102045760003560e01c8063796490f911610118578063ba66fde7116100a0578063d605787b1161006f578063d605787b14610638578063da3beb8c14610658578063e349ad3014610479578063e4c0aaf414610678578063f2f4eb261461069857600080fd5b8063ba66fde7146105cd578063be467604146105ed578063c41bda6114610603578063c86ed8921461062357600080fd5b8063a6a7f0eb116100e7578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b8063796490f9146104795780637c04034e1461048f5780638e426460146104af5780639b05c261146104cf57600080fd5b80633b3041471161019b5780635c92e2f61161016a5780635c92e2f6146103b65780635e4a627d146103d657806369f3f041146103ec5780636d4cd8ea14610439578063751accd01461045957600080fd5b80633b304147146103345780634b2f0ea0146103545780634fe264fb14610367578063564a565d1461038757600080fd5b80630c340a24116101d75780630c340a241461028f5780631200aabc146102c75780631c3db16d146102f4578063362c34791461031457600080fd5b8063023d44df1461020957806303432744146102325780630b274f2e146102485780630baa64d11461025f575b600080fd5b34801561021557600080fd5b5061021f60035481565b6040519081526020015b60405180910390f35b34801561023e57600080fd5b5061021f60065481565b34801561025457600080fd5b5061025d6106b8565b005b34801561026b57600080fd5b5061027f61027a36600461380a565b610c8a565b6040519015158152602001610229565b34801561029b57600080fd5b506000546102af906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102d357600080fd5b5061021f6102e236600461380a565b60086020526000908152604090205481565b34801561030057600080fd5b5061021f61030f36600461380a565b610d01565b34801561032057600080fd5b5061021f61032f36600461383b565b610d8b565b34801561034057600080fd5b506102af61034f36600461380a565b611179565b61025d610362366004613878565b611731565b34801561037357600080fd5b5061021f61038236600461389a565b611fcb565b34801561039357600080fd5b506103a76103a236600461380a565b61211b565b6040516102299392919061391e565b3480156103c257600080fd5b5061025d6103d1366004613994565b6121e1565b3480156103e257600080fd5b5061021f60045481565b3480156103f857600080fd5b5061040c61040736600461389a565b6124ed565b604080519687529415156020870152938501929092526060840152608083015260a082015260c001610229565b34801561044557600080fd5b5061027f61045436600461380a565b6125a5565b34801561046557600080fd5b5061025d610474366004613a86565b61261c565b34801561048557600080fd5b5061021f61271081565b34801561049b57600080fd5b5061025d6104aa366004613af3565b6126ee565b3480156104bb57600080fd5b5061025d6104ca366004613b8c565b612e26565b3480156104db57600080fd5b506104ef6104ea36600461380a565b612e72565b60408051928352901515602083015201610229565b34801561051057600080fd5b5061025d61051f366004613beb565b612ef5565b34801561053057600080fd5b5061054461053f36600461389a565b612f47565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610229565b34801561057c57600080fd5b5060055461058a9060ff1681565b6040516102299190613c4d565b3480156105a357600080fd5b5061021f614e2081565b3480156105b957600080fd5b5061025d6105c8366004613c75565b61300d565b3480156105d957600080fd5b5061027f6105e836600461389a565b6131c6565b3480156105f957600080fd5b5061021f61138881565b34801561060f57600080fd5b5061025d61061e366004613b8c565b613261565b34801561062f57600080fd5b5061027f6132ad565b34801561064457600080fd5b506002546102af906001600160a01b031681565b34801561066457600080fd5b5061021f610673366004613878565b6132cd565b34801561068457600080fd5b5061025d610693366004613b8c565b61342d565b3480156106a457600080fd5b506001546102af906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106fd57600080fd5b505afa158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190613cd0565b600181111561074657610746613c37565b14806107d35750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190613d06565b1561085e57600060055460ff1660028111156107f1576107f1613c37565b14156108445760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600580546000919060ff19166001835b0217905550610c49565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ad57600080fd5b505afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e59190613cd0565b60018111156108f6576108f6613c37565b1415610c4957600060055460ff16600281111561091557610915613c37565b1415610ac45760006006541161096d5760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f727300000000604482015260640161083b565b600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f39190613d21565b6109fe906014613d50565b431015610a4d5760405162461bcd60e51b815260206004820152601e60248201527f546f6f20736f6f6e3a204c312066696e616c6974792072657175697265640000604482015260640161083b565b4360038190556002546040516303dce1a760e51b815260048101929092526001600160a01b031690637b9c34e090602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050600580546001935090915060ff19168280610854565b600160055460ff166002811115610add57610add613c37565b1415610bcf5760025460035460405163ca4742f160e01b81526001600160a01b039092169163ca4742f191610b189160040190815260200190565b602060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613d21565b6004819055610bbb5760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161083b565b600580546002919060ff1916600183610854565b600260055460ff166002811115610be857610be8613c37565b1415610c495760065415610c3e5760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e67207068617365000000604482015260640161083b565b6005805460ff191690555b6005546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c809160ff90911690613c4d565b60405180910390a1565b600081815260086020526040812054600780548392908110610cae57610cae613d68565b60009182526020822060059091020180549092508290610cd090600190613d7e565b81548110610ce057610ce0613d68565b60009182526020909120600c90910201805460059091015414949350505050565b600081815260086020526040812054600780548392908110610d2557610d25613d68565b60009182526020822060059091020180549092508290610d4790600190613d7e565b81548110610d5757610d57613d68565b60009182526020909120600c90910201600381015490915060ff16610d80578060010154610d83565b60005b949350505050565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610dd457600080fd5b505afa158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c9190613dac565b50935050505080610e5f5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e0000000000604482015260640161083b565b600086815260086020526040812054600780549091908110610e8357610e83613d68565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610eb757610eb7613d68565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160206040518083038186803b158015610f0d57600080fd5b505afa158015610f21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f459190613d21565b600087815260078401602052604090205490915060ff16610f8d576001600160a01b0388166000908152600883016020908152604080832089845290915290205494506110d3565b80861415611003576000868152600683016020526040902054610fb1576000610ffc565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b8652909352922054610ff29190613e13565b610ffc9190613e48565b94506110d3565b600081815260078301602052604090205460ff166110d35781600601600083600a0160018154811061103757611037613d68565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061106d5761106d613d68565b90600052602060002001548152602001908152602001600020546110919190613d50565b60098301546001600160a01b038a16600090815260088501602090815260408083208b84529091529020546110c69190613e13565b6110d09190613e48565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561116d576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146111a65760405162461bcd60e51b815260040161083b90613e5c565b6000828152600860205260409020546007805484929081106111ca576111ca613d68565b600091825260209091206002600590920201015460ff16156111fe5760405162461bcd60e51b815260040161083b90613ea0565b600260055460ff16600281111561121757611217613c37565b146112645760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e67207068617365000000000000604482015260640161083b565b60008381526008602052604081205460078054909190811061128857611288613d68565b600091825260208220600590910201805490925082906112aa90600190613d7e565b815481106112ba576112ba613d68565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561131057600080fd5b505afa158015611324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113489190613dac565b50929350506001600160601b038316915060009050611365613479565b60015460405163bfabfe8f60e01b81526004810185905260006024820181905292935082916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156113b557600080fd5b505afa1580156113c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ed9190613ed7565b50600154604051630a48b58160e21b81526004810188905260006024820181905293955091935082916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561144357600080fd5b505afa158015611457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147b9190613d21565b6114859086613f05565b90505b826114938386613e13565b61149e906001613d50565b101561158b5760015b848111611585576000816114bb8588613e13565b6114c59190613d50565b600154604051630a48b58160e21b8152600481018b9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561151657600080fd5b505afa15801561152a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154e9190613d21565b9050808410611568576115618185613d7e565b9350611570565b509250611585565b5050808061157d90613f19565b9150506114a7565b50611488565b60015460405163bfabfe8f60e01b815260048101889052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156115d757600080fd5b505afa1580156115eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160f9190613ed7565b9250505061161c816134fc565b9b506116288d8d613527565b1561171c578860000160405180608001604052808e6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505088600b015489600001805490501415611717576006805490600061171183613f34565b91905055505b611721565b60009b505b5050505050505050505050919050565b60008281526008602052604090205460078054849290811061175557611755613d68565b600091825260209091206002600590920201015460ff16156117895760405162461bcd60e51b815260040161083b90613ea0565b6000838152600860205260408120546007805490919081106117ad576117ad613d68565b9060005260206000209060050201905080600101548311156118115760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e604482015260640161083b565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118919190613f4b565b915091508142101580156118a457508042105b6118e95760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b604482015260640161083b565b604051631c3db16d60e01b81526004810187905260009086903090631c3db16d9060240160206040518083038186803b15801561192557600080fd5b505afa158015611939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195d9190613d21565b141561196c57506127106119ec565b61271061138861197c8585613d7e565b6119869190613e13565b6119909190613e48565b61199a8442613d7e565b106119e75760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f73657200604482015260640161083b565b50614e205b835460009085906119ff90600190613d7e565b81548110611a0f57611a0f613d68565b60009182526020822060018054604051637e37c78b60e11b8152600481018e9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611a6957600080fd5b505afa158015611a7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa19190613d21565b611aab9190613d7e565b600089815260078401602052604090205490915060ff1615611b0f5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e0000000000604482015260640161083b565b600154604051632cf6413f60e11b8152600481018b90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611b5457600080fd5b505afa158015611b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8c9190613d21565b90506000612710611b9d8684613e13565b611ba79190613e48565b611bb19083613d50565b60008b815260068601602052604081205491925090821115611c545760008b81526006860160205260409020543490611bea9084613d7e565b11611c0f5760008b8152600686016020526040902054611c0a9083613d7e565b611c11565b345b604080518d815260208101839052919250339186918f917fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c0910160405180910390a45b33600090815260088601602090815260408083208e845290915281208054839290611c80908490613d50565b909155505060008b815260068601602052604081208054839290611ca5908490613d50565b909155505060008b81526006860160205260409020548211611d4f5760008b815260068601602052604081205460098701805491929091611ce7908490613d50565b9091555050600a8501805460018181018355600092835260208084209092018e90558d8352600788019091526040808320805460ff1916909217909155518c9186918f917fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00991a45b600a85015460011015611f8f57828560090154611d6c9190613d7e565b60098601556001546040516319b8152960e01b8152600481018e90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611db557600080fd5b505afa158015611dc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ded9190613d06565b15611e065760028901805460ff19166001179055611f0f565b885460038a016000611e19876001613d50565b8152602001908152602001600020819055506000896000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538e6040518263ffffffff1660e01b8152600401611e9491815260200190565b60206040518083038186803b158015611eac57600080fd5b505afa158015611ec0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee49190613d21565b600b82015560038101805460ff1916600117905560068054906000611f0883613f19565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848e8c600101548d6004016040518563ffffffff1660e01b8152600401611f5c93929190613faa565b6000604051808303818588803b158015611f7557600080fd5b505af1158015611f89573d6000803e3d6000fd5b50505050505b80341115611fbd57336108fc611fa58334613d7e565b6040518115909202916000818181858888f150505050505b505050505050505050505050565b600083815260086020526040812054600780548392908110611fef57611fef613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061202357612023613d68565b90600052602060002090600c0201600001848154811061204557612045613d68565b600091825260208220600154604051639b05c26160e01b815260048082018c905293909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561209d57600080fd5b505afa1580156120b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d59190614062565b6003850154919350915060ff1680156120f8575081836002015414806120f85750805b1561210b57612710945050505050612114565b60009450505050505b9392505050565b6007818154811061212b57600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161215e90613f6f565b80601f016020809104026020016040519081016040528092919081815260200182805461218a90613f6f565b80156121d75780601f106121ac576101008083540402835291602001916121d7565b820191906000526020600020905b8154815290600101906020018083116121ba57829003601f168201915b5050505050905083565b60008481526008602052604090205460078054869290811061220557612205613d68565b600091825260209091206002600590920201015460ff16156122395760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561227e57600080fd5b505afa158015612292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b69190613dac565b50909350600192506122c6915050565b8160048111156122d8576122d8613c37565b146123355760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b606482015260840161083b565b826123725760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b604482015260640161083b565b60008681526008602052604081205460078054909190811061239657612396613d68565b600091825260208220600590910201805490925082906123b890600190613d7e565b815481106123c8576123c8613d68565b90600052602060002090600c0201905060005b868110156124c65733828989848181106123f7576123f7613d68565b905060200201358154811061240e5761240e613d68565b60009182526020909120600490910201546001600160a01b0316146124755760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b858289898481811061248957612489613d68565b90506020020135815481106124a0576124a0613d68565b6000918252602090912060016004909202010155806124be81613f19565b9150506123db565b50868690508160050160008282546124de9190613d50565b90915550505050505050505050565b60008060008060008060006007600860008c8152602001908152602001600020548154811061251e5761251e613d68565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061255257612552613d68565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b6000818152600860205260408120546007805483929081106125c9576125c9613d68565b600091825260208220600590910201805490925082906125eb90600190613d7e565b815481106125fb576125fb613d68565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146126465760405162461bcd60e51b815260040161083b9061408e565b6000836001600160a01b0316838360405161266191906140d0565b60006040518083038185875af1925050503d806000811461269e576040519150601f19603f3d011682016040523d82523d6000602084013e6126a3565b606091505b50509050806126e85760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b604482015260640161083b565b50505050565b60008681526008602052604090205460078054889290811061271257612712613d68565b600091825260209091206002600590920201015460ff16156127465760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561278b57600080fd5b505afa15801561279f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c39190613dac565b50909350600292506127d3915050565b8160048111156127e5576127e5613c37565b146128405760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b606482015260840161083b565b856128825760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b604482015260640161083b565b6000888152600860205260408120546007805490919081106128a6576128a6613d68565b9060005260206000209060050201905080600101548611156129015760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b604482015260640161083b565b8054600090829061291490600190613d7e565b8154811061292457612924613d68565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561297a57600080fd5b505afa15801561298e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b29190613dac565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612a0857600080fd5b505afa158015612a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4091906140ec565b5050505091505060005b8a811015612cee5733848d8d84818110612a6657612a66613d68565b9050602002013581548110612a7d57612a7d613d68565b60009182526020909120600490910201546001600160a01b031614612ae45760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b811580612b58575089888a604051602001612b0193929190614144565b60405160208183030381529060405280519060200120846000018d8d84818110612b2d57612b2d613d68565b9050602002013581548110612b4457612b44613d68565b906000526020600020906004020160010154145b612bcc576040805162461bcd60e51b81526020600482015260248101919091527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20737562636f7572747320776974682068696464656e20766f7465732e606482015260840161083b565b838c8c83818110612bdf57612bdf613d68565b9050602002013581548110612bf657612bf6613d68565b600091825260209091206003600490920201015460ff1615612c4f5760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b604482015260640161083b565b89848d8d84818110612c6357612c63613d68565b9050602002013581548110612c7a57612c7a613d68565b60009182526020909120600260049092020101556001848d8d84818110612ca357612ca3613d68565b9050602002013581548110612cba57612cba613d68565b60009182526020909120600490910201600301805460ff191691151591909117905580612ce681613f19565b915050612a4a565b508a8a9050836004016000828254612d069190613d50565b90915550506000898152600284016020526040812080548c9290612d2b908490613d50565b90915550506001830154891415612d5b57600383015460ff1615612d565760038301805460ff191690555b612dd5565b60018301546000908152600284016020526040808220548b83529120541415612d9e57600383015460ff16612d565760038301805460ff19166001179055612dd5565b60018301546000908152600284016020526040808220548b83529120541115612dd5576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a604051612e109190614171565b60405180910390a4505050505050505050505050565b6000546001600160a01b03163314612e505760405162461bcd60e51b815260040161083b9061408e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120546007805483928392918110612e9857612e98613d68565b60009182526020822060059091020180549092508290612eba90600190613d7e565b81548110612eca57612eca613d68565b60009182526020909120600c909102016001810154600390910154909660ff90911695509350505050565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c90612f3a9087908790614184565b60405180910390a4505050565b60008060008060006007600860008a81526020019081526020016000205481548110612f7557612f75613d68565b600091825260208083208a8452600360059093020191820190526040822054815491935083918110612fa957612fa9613d68565b90600052602060002090600c02016000018781548110612fcb57612fcb613d68565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146130375760405162461bcd60e51b815260040161083b90613e5c565b60078054600181018255600091909152600581027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68981018690557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101906130c2907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c018686613771565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561311457600080fd5b505afa158015613128573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061314c9190613d21565b6131569190613d7e565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600890925282208490556006805491926131b783613f19565b91905055505050505050505050565b6000838152600860205260408120546007805483929081106131ea576131ea613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061321e5761321e613d68565b90600052602060002090600c0201600001848154811061324057613240613d68565b600091825260209091206004909102016003015460ff169695505050505050565b6000546001600160a01b0316331461328b5760405162461bcd60e51b815260040161083b9061408e565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008060055460ff1660028111156132c7576132c7613c37565b14905090565b6000828152600860205260408120546007805483929081106132f1576132f1613d68565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061332557613325613d68565b600091825260208220600154604051639b05c26160e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561337e57600080fd5b505afa158015613392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b69190614062565b915091508260040154600014806133e45750801580156133e457506000828152600284016020526040902054155b156133f6576000945050505050613427565b801561340b5750506004015491506134279050565b5060009081526002909101602052604090205491506134279050565b92915050565b6000546001600160a01b031633146134575760405162461bcd60e51b815260040161083b9061408e565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254604051630e39b00f60e11b81524360048201526000916001600160a01b031690631c73601e90602401602060405180830381600087803b1580156134bf57600080fd5b505af11580156134d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f79190613d21565b905090565b600060405160005b601481101561351f5783811a81600c84010153600101613504565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b15801561357057600080fd5b505afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190613dac565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561360257600080fd5b505afa158015613616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363a9190613d21565b6136449190613d7e565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b15801561368057600080fd5b505afa158015613694573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136bc91908101906141b3565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561371c57600080fd5b505afa158015613730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137549190613f4b565b90925090506137638382613d50565b909110159695505050505050565b82805461377d90613f6f565b90600052602060002090601f01602090048101928261379f57600085556137e5565b82601f106137b85782800160ff198235161785556137e5565b828001600101855582156137e5579182015b828111156137e55782358255916020019190600101906137ca565b506137f19291506137f5565b5090565b5b808211156137f157600081556001016137f6565b60006020828403121561381c57600080fd5b5035919050565b6001600160a01b038116811461383857600080fd5b50565b6000806000806080858703121561385157600080fd5b84359350602085013561386381613823565b93969395505050506040820135916060013590565b6000806040838503121561388b57600080fd5b50508035926020909101359150565b6000806000606084860312156138af57600080fd5b505081359360208301359350604090920135919050565b60005b838110156138e15781810151838201526020016138c9565b838111156126e85750506000910152565b6000815180845261390a8160208601602086016138c6565b601f01601f19169290920160200192915050565b838152821515602082015260606040820152600061393f60608301846138f2565b95945050505050565b60008083601f84011261395a57600080fd5b50813567ffffffffffffffff81111561397257600080fd5b6020830191508360208260051b850101111561398d57600080fd5b9250929050565b600080600080606085870312156139aa57600080fd5b84359350602085013567ffffffffffffffff8111156139c857600080fd5b6139d487828801613948565b9598909750949560400135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613a2657613a266139e7565b604052919050565b600067ffffffffffffffff831115613a4857613a486139e7565b613a5b601f8401601f19166020016139fd565b9050828152838383011115613a6f57600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613a9b57600080fd5b8335613aa681613823565b925060208401359150604084013567ffffffffffffffff811115613ac957600080fd5b8401601f81018613613ada57600080fd5b613ae986823560208401613a2e565b9150509250925092565b60008060008060008060a08789031215613b0c57600080fd5b86359550602087013567ffffffffffffffff80821115613b2b57600080fd5b613b378a838b01613948565b909750955060408901359450606089013593506080890135915080821115613b5e57600080fd5b508701601f81018913613b7057600080fd5b613b7f89823560208401613a2e565b9150509295509295509295565b600060208284031215613b9e57600080fd5b813561211481613823565b60008083601f840112613bbb57600080fd5b50813567ffffffffffffffff811115613bd357600080fd5b60208301915083602082850101111561398d57600080fd5b600080600060408486031215613c0057600080fd5b83359250602084013567ffffffffffffffff811115613c1e57600080fd5b613c2a86828701613ba9565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613c6f57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613c8d57600080fd5b8535945060208601359350604086013567ffffffffffffffff811115613cb257600080fd5b613cbe88828901613ba9565b96999598509660600135949350505050565b600060208284031215613ce257600080fd5b81516002811061211457600080fd5b80518015158114613d0157600080fd5b919050565b600060208284031215613d1857600080fd5b61211482613cf1565b600060208284031215613d3357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613d6357613d63613d3a565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613d9057613d90613d3a565b500390565b80516001600160601b0381168114613d0157600080fd5b600080600080600060a08688031215613dc457600080fd5b613dcd86613d95565b94506020860151613ddd81613823565b604087015190945060058110613df257600080fd5b9250613e0060608701613cf1565b9150608086015190509295509295909350565b6000816000190483118215151615613e2d57613e2d613d3a565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613e5757613e57613e32565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600080600060608486031215613eec57600080fd5b8351925060208401519150604084015190509250925092565b600082613f1457613f14613e32565b500690565b6000600019821415613f2d57613f2d613d3a565b5060010190565b600081613f4357613f43613d3a565b506000190190565b60008060408385031215613f5e57600080fd5b505080516020909101519092909150565b600181811c90821680613f8357607f821691505b60208210811415613fa457634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c915080831680613fd857607f831692505b858310811415613ff657634e487b7160e01b85526022600452602485fd5b6060880183905260808801818015614015576001811461402657614051565b60ff19861682528782019650614051565b60008b81526020902060005b8681101561404b57815484820152908501908901614032565b83019750505b50949b9a5050505050505050505050565b6000806040838503121561407557600080fd5b8251915061408560208401613cf1565b90509250929050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600082516140e28184602087016138c6565b9190910192915050565b60008060008060008060c0878903121561410557600080fd5b61410e87613d95565b955061411c60208801613cf1565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b8381526000835161415c8160208501602088016138c6565b60209201918201929092526040019392505050565b60208152600061211460208301846138f2565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008060008060008060c087890312156141cc57600080fd5b8651955060208088015195506040880151945060608801519350608088015167ffffffffffffffff8082111561420157600080fd5b818a0191508a601f83011261421557600080fd5b815181811115614227576142276139e7565b8060051b91506142388483016139fd565b818152918301840191848101908d84111561425257600080fd5b938501935b8385101561427c578451925061426c83613823565b8282529385019390850190614257565b80975050505050505060a08701519050929550929550929556fea264697066735822122093e1025e8596baad92b8acbc1dfd801832f0c4845d9b926d2b306bac5cf1c9ee64736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106102045760003560e01c8063796490f911610118578063ba66fde7116100a0578063d605787b1161006f578063d605787b14610638578063da3beb8c14610658578063e349ad3014610479578063e4c0aaf414610678578063f2f4eb261461069857600080fd5b8063ba66fde7146105cd578063be467604146105ed578063c41bda6114610603578063c86ed8921461062357600080fd5b8063a6a7f0eb116100e7578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b8063796490f9146104795780637c04034e1461048f5780638e426460146104af5780639b05c261146104cf57600080fd5b80633b3041471161019b5780635c92e2f61161016a5780635c92e2f6146103b65780635e4a627d146103d657806369f3f041146103ec5780636d4cd8ea14610439578063751accd01461045957600080fd5b80633b304147146103345780634b2f0ea0146103545780634fe264fb14610367578063564a565d1461038757600080fd5b80630c340a24116101d75780630c340a241461028f5780631200aabc146102c75780631c3db16d146102f4578063362c34791461031457600080fd5b8063023d44df1461020957806303432744146102325780630b274f2e146102485780630baa64d11461025f575b600080fd5b34801561021557600080fd5b5061021f60035481565b6040519081526020015b60405180910390f35b34801561023e57600080fd5b5061021f60065481565b34801561025457600080fd5b5061025d6106b8565b005b34801561026b57600080fd5b5061027f61027a36600461380a565b610c8a565b6040519015158152602001610229565b34801561029b57600080fd5b506000546102af906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102d357600080fd5b5061021f6102e236600461380a565b60086020526000908152604090205481565b34801561030057600080fd5b5061021f61030f36600461380a565b610d01565b34801561032057600080fd5b5061021f61032f36600461383b565b610d8b565b34801561034057600080fd5b506102af61034f36600461380a565b611179565b61025d610362366004613878565b611731565b34801561037357600080fd5b5061021f61038236600461389a565b611fcb565b34801561039357600080fd5b506103a76103a236600461380a565b61211b565b6040516102299392919061391e565b3480156103c257600080fd5b5061025d6103d1366004613994565b6121e1565b3480156103e257600080fd5b5061021f60045481565b3480156103f857600080fd5b5061040c61040736600461389a565b6124ed565b604080519687529415156020870152938501929092526060840152608083015260a082015260c001610229565b34801561044557600080fd5b5061027f61045436600461380a565b6125a5565b34801561046557600080fd5b5061025d610474366004613a86565b61261c565b34801561048557600080fd5b5061021f61271081565b34801561049b57600080fd5b5061025d6104aa366004613af3565b6126ee565b3480156104bb57600080fd5b5061025d6104ca366004613b8c565b612e26565b3480156104db57600080fd5b506104ef6104ea36600461380a565b612e72565b60408051928352901515602083015201610229565b34801561051057600080fd5b5061025d61051f366004613beb565b612ef5565b34801561053057600080fd5b5061054461053f36600461389a565b612f47565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610229565b34801561057c57600080fd5b5060055461058a9060ff1681565b6040516102299190613c4d565b3480156105a357600080fd5b5061021f614e2081565b3480156105b957600080fd5b5061025d6105c8366004613c75565b61300d565b3480156105d957600080fd5b5061027f6105e836600461389a565b6131c6565b3480156105f957600080fd5b5061021f61138881565b34801561060f57600080fd5b5061025d61061e366004613b8c565b613261565b34801561062f57600080fd5b5061027f6132ad565b34801561064457600080fd5b506002546102af906001600160a01b031681565b34801561066457600080fd5b5061021f610673366004613878565b6132cd565b34801561068457600080fd5b5061025d610693366004613b8c565b61342d565b3480156106a457600080fd5b506001546102af906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106fd57600080fd5b505afa158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190613cd0565b600181111561074657610746613c37565b14806107d35750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190613d06565b1561085e57600060055460ff1660028111156107f1576107f1613c37565b14156108445760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600580546000919060ff19166001835b0217905550610c49565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ad57600080fd5b505afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e59190613cd0565b60018111156108f6576108f6613c37565b1415610c4957600060055460ff16600281111561091557610915613c37565b1415610ac45760006006541161096d5760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f727300000000604482015260640161083b565b600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f39190613d21565b6109fe906014613d50565b431015610a4d5760405162461bcd60e51b815260206004820152601e60248201527f546f6f20736f6f6e3a204c312066696e616c6974792072657175697265640000604482015260640161083b565b4360038190556002546040516303dce1a760e51b815260048101929092526001600160a01b031690637b9c34e090602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050600580546001935090915060ff19168280610854565b600160055460ff166002811115610add57610add613c37565b1415610bcf5760025460035460405163ca4742f160e01b81526001600160a01b039092169163ca4742f191610b189160040190815260200190565b602060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613d21565b6004819055610bbb5760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161083b565b600580546002919060ff1916600183610854565b600260055460ff166002811115610be857610be8613c37565b1415610c495760065415610c3e5760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e67207068617365000000604482015260640161083b565b6005805460ff191690555b6005546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c809160ff90911690613c4d565b60405180910390a1565b600081815260086020526040812054600780548392908110610cae57610cae613d68565b60009182526020822060059091020180549092508290610cd090600190613d7e565b81548110610ce057610ce0613d68565b60009182526020909120600c90910201805460059091015414949350505050565b600081815260086020526040812054600780548392908110610d2557610d25613d68565b60009182526020822060059091020180549092508290610d4790600190613d7e565b81548110610d5757610d57613d68565b60009182526020909120600c90910201600381015490915060ff16610d80578060010154610d83565b60005b949350505050565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610dd457600080fd5b505afa158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c9190613dac565b50935050505080610e5f5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e0000000000604482015260640161083b565b600086815260086020526040812054600780549091908110610e8357610e83613d68565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610eb757610eb7613d68565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160206040518083038186803b158015610f0d57600080fd5b505afa158015610f21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f459190613d21565b600087815260078401602052604090205490915060ff16610f8d576001600160a01b0388166000908152600883016020908152604080832089845290915290205494506110d3565b80861415611003576000868152600683016020526040902054610fb1576000610ffc565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b8652909352922054610ff29190613e13565b610ffc9190613e48565b94506110d3565b600081815260078301602052604090205460ff166110d35781600601600083600a0160018154811061103757611037613d68565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061106d5761106d613d68565b90600052602060002001548152602001908152602001600020546110919190613d50565b60098301546001600160a01b038a16600090815260088501602090815260408083208b84529091529020546110c69190613e13565b6110d09190613e48565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561116d576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146111a65760405162461bcd60e51b815260040161083b90613e5c565b6000828152600860205260409020546007805484929081106111ca576111ca613d68565b600091825260209091206002600590920201015460ff16156111fe5760405162461bcd60e51b815260040161083b90613ea0565b600260055460ff16600281111561121757611217613c37565b146112645760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e67207068617365000000000000604482015260640161083b565b60008381526008602052604081205460078054909190811061128857611288613d68565b600091825260208220600590910201805490925082906112aa90600190613d7e565b815481106112ba576112ba613d68565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561131057600080fd5b505afa158015611324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113489190613dac565b50929350506001600160601b038316915060009050611365613479565b60015460405163bfabfe8f60e01b81526004810185905260006024820181905292935082916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156113b557600080fd5b505afa1580156113c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ed9190613ed7565b50600154604051630a48b58160e21b81526004810188905260006024820181905293955091935082916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561144357600080fd5b505afa158015611457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147b9190613d21565b6114859086613f05565b90505b826114938386613e13565b61149e906001613d50565b101561158b5760015b848111611585576000816114bb8588613e13565b6114c59190613d50565b600154604051630a48b58160e21b8152600481018b9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561151657600080fd5b505afa15801561152a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154e9190613d21565b9050808410611568576115618185613d7e565b9350611570565b509250611585565b5050808061157d90613f19565b9150506114a7565b50611488565b60015460405163bfabfe8f60e01b815260048101889052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156115d757600080fd5b505afa1580156115eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160f9190613ed7565b9250505061161c816134fc565b9b506116288d8d613527565b1561171c578860000160405180608001604052808e6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505088600b015489600001805490501415611717576006805490600061171183613f34565b91905055505b611721565b60009b505b5050505050505050505050919050565b60008281526008602052604090205460078054849290811061175557611755613d68565b600091825260209091206002600590920201015460ff16156117895760405162461bcd60e51b815260040161083b90613ea0565b6000838152600860205260408120546007805490919081106117ad576117ad613d68565b9060005260206000209060050201905080600101548311156118115760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e604482015260640161083b565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118919190613f4b565b915091508142101580156118a457508042105b6118e95760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b604482015260640161083b565b604051631c3db16d60e01b81526004810187905260009086903090631c3db16d9060240160206040518083038186803b15801561192557600080fd5b505afa158015611939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195d9190613d21565b141561196c57506127106119ec565b61271061138861197c8585613d7e565b6119869190613e13565b6119909190613e48565b61199a8442613d7e565b106119e75760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f73657200604482015260640161083b565b50614e205b835460009085906119ff90600190613d7e565b81548110611a0f57611a0f613d68565b60009182526020822060018054604051637e37c78b60e11b8152600481018e9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611a6957600080fd5b505afa158015611a7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa19190613d21565b611aab9190613d7e565b600089815260078401602052604090205490915060ff1615611b0f5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e0000000000604482015260640161083b565b600154604051632cf6413f60e11b8152600481018b90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611b5457600080fd5b505afa158015611b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8c9190613d21565b90506000612710611b9d8684613e13565b611ba79190613e48565b611bb19083613d50565b60008b815260068601602052604081205491925090821115611c545760008b81526006860160205260409020543490611bea9084613d7e565b11611c0f5760008b8152600686016020526040902054611c0a9083613d7e565b611c11565b345b604080518d815260208101839052919250339186918f917fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c0910160405180910390a45b33600090815260088601602090815260408083208e845290915281208054839290611c80908490613d50565b909155505060008b815260068601602052604081208054839290611ca5908490613d50565b909155505060008b81526006860160205260409020548211611d4f5760008b815260068601602052604081205460098701805491929091611ce7908490613d50565b9091555050600a8501805460018181018355600092835260208084209092018e90558d8352600788019091526040808320805460ff1916909217909155518c9186918f917fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00991a45b600a85015460011015611f8f57828560090154611d6c9190613d7e565b60098601556001546040516319b8152960e01b8152600481018e90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611db557600080fd5b505afa158015611dc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ded9190613d06565b15611e065760028901805460ff19166001179055611f0f565b885460038a016000611e19876001613d50565b8152602001908152602001600020819055506000896000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538e6040518263ffffffff1660e01b8152600401611e9491815260200190565b60206040518083038186803b158015611eac57600080fd5b505afa158015611ec0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee49190613d21565b600b82015560038101805460ff1916600117905560068054906000611f0883613f19565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848e8c600101548d6004016040518563ffffffff1660e01b8152600401611f5c93929190613faa565b6000604051808303818588803b158015611f7557600080fd5b505af1158015611f89573d6000803e3d6000fd5b50505050505b80341115611fbd57336108fc611fa58334613d7e565b6040518115909202916000818181858888f150505050505b505050505050505050505050565b600083815260086020526040812054600780548392908110611fef57611fef613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061202357612023613d68565b90600052602060002090600c0201600001848154811061204557612045613d68565b600091825260208220600154604051639b05c26160e01b815260048082018c905293909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561209d57600080fd5b505afa1580156120b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d59190614062565b6003850154919350915060ff1680156120f8575081836002015414806120f85750805b1561210b57612710945050505050612114565b60009450505050505b9392505050565b6007818154811061212b57600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161215e90613f6f565b80601f016020809104026020016040519081016040528092919081815260200182805461218a90613f6f565b80156121d75780601f106121ac576101008083540402835291602001916121d7565b820191906000526020600020905b8154815290600101906020018083116121ba57829003601f168201915b5050505050905083565b60008481526008602052604090205460078054869290811061220557612205613d68565b600091825260209091206002600590920201015460ff16156122395760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561227e57600080fd5b505afa158015612292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b69190613dac565b50909350600192506122c6915050565b8160048111156122d8576122d8613c37565b146123355760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b606482015260840161083b565b826123725760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b604482015260640161083b565b60008681526008602052604081205460078054909190811061239657612396613d68565b600091825260208220600590910201805490925082906123b890600190613d7e565b815481106123c8576123c8613d68565b90600052602060002090600c0201905060005b868110156124c65733828989848181106123f7576123f7613d68565b905060200201358154811061240e5761240e613d68565b60009182526020909120600490910201546001600160a01b0316146124755760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b858289898481811061248957612489613d68565b90506020020135815481106124a0576124a0613d68565b6000918252602090912060016004909202010155806124be81613f19565b9150506123db565b50868690508160050160008282546124de9190613d50565b90915550505050505050505050565b60008060008060008060006007600860008c8152602001908152602001600020548154811061251e5761251e613d68565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061255257612552613d68565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b6000818152600860205260408120546007805483929081106125c9576125c9613d68565b600091825260208220600590910201805490925082906125eb90600190613d7e565b815481106125fb576125fb613d68565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146126465760405162461bcd60e51b815260040161083b9061408e565b6000836001600160a01b0316838360405161266191906140d0565b60006040518083038185875af1925050503d806000811461269e576040519150601f19603f3d011682016040523d82523d6000602084013e6126a3565b606091505b50509050806126e85760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b604482015260640161083b565b50505050565b60008681526008602052604090205460078054889290811061271257612712613d68565b600091825260209091206002600590920201015460ff16156127465760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561278b57600080fd5b505afa15801561279f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c39190613dac565b50909350600292506127d3915050565b8160048111156127e5576127e5613c37565b146128405760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b606482015260840161083b565b856128825760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b604482015260640161083b565b6000888152600860205260408120546007805490919081106128a6576128a6613d68565b9060005260206000209060050201905080600101548611156129015760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b604482015260640161083b565b8054600090829061291490600190613d7e565b8154811061292457612924613d68565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561297a57600080fd5b505afa15801561298e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b29190613dac565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612a0857600080fd5b505afa158015612a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4091906140ec565b5050505091505060005b8a811015612cee5733848d8d84818110612a6657612a66613d68565b9050602002013581548110612a7d57612a7d613d68565b60009182526020909120600490910201546001600160a01b031614612ae45760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b811580612b58575089888a604051602001612b0193929190614144565b60405160208183030381529060405280519060200120846000018d8d84818110612b2d57612b2d613d68565b9050602002013581548110612b4457612b44613d68565b906000526020600020906004020160010154145b612bcc576040805162461bcd60e51b81526020600482015260248101919091527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20737562636f7572747320776974682068696464656e20766f7465732e606482015260840161083b565b838c8c83818110612bdf57612bdf613d68565b9050602002013581548110612bf657612bf6613d68565b600091825260209091206003600490920201015460ff1615612c4f5760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b604482015260640161083b565b89848d8d84818110612c6357612c63613d68565b9050602002013581548110612c7a57612c7a613d68565b60009182526020909120600260049092020101556001848d8d84818110612ca357612ca3613d68565b9050602002013581548110612cba57612cba613d68565b60009182526020909120600490910201600301805460ff191691151591909117905580612ce681613f19565b915050612a4a565b508a8a9050836004016000828254612d069190613d50565b90915550506000898152600284016020526040812080548c9290612d2b908490613d50565b90915550506001830154891415612d5b57600383015460ff1615612d565760038301805460ff191690555b612dd5565b60018301546000908152600284016020526040808220548b83529120541415612d9e57600383015460ff16612d565760038301805460ff19166001179055612dd5565b60018301546000908152600284016020526040808220548b83529120541115612dd5576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a604051612e109190614171565b60405180910390a4505050505050505050505050565b6000546001600160a01b03163314612e505760405162461bcd60e51b815260040161083b9061408e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120546007805483928392918110612e9857612e98613d68565b60009182526020822060059091020180549092508290612eba90600190613d7e565b81548110612eca57612eca613d68565b60009182526020909120600c909102016001810154600390910154909660ff90911695509350505050565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c90612f3a9087908790614184565b60405180910390a4505050565b60008060008060006007600860008a81526020019081526020016000205481548110612f7557612f75613d68565b600091825260208083208a8452600360059093020191820190526040822054815491935083918110612fa957612fa9613d68565b90600052602060002090600c02016000018781548110612fcb57612fcb613d68565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146130375760405162461bcd60e51b815260040161083b90613e5c565b60078054600181018255600091909152600581027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68981018690557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101906130c2907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c018686613771565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561311457600080fd5b505afa158015613128573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061314c9190613d21565b6131569190613d7e565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600890925282208490556006805491926131b783613f19565b91905055505050505050505050565b6000838152600860205260408120546007805483929081106131ea576131ea613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061321e5761321e613d68565b90600052602060002090600c0201600001848154811061324057613240613d68565b600091825260209091206004909102016003015460ff169695505050505050565b6000546001600160a01b0316331461328b5760405162461bcd60e51b815260040161083b9061408e565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008060055460ff1660028111156132c7576132c7613c37565b14905090565b6000828152600860205260408120546007805483929081106132f1576132f1613d68565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061332557613325613d68565b600091825260208220600154604051639b05c26160e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561337e57600080fd5b505afa158015613392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b69190614062565b915091508260040154600014806133e45750801580156133e457506000828152600284016020526040902054155b156133f6576000945050505050613427565b801561340b5750506004015491506134279050565b5060009081526002909101602052604090205491506134279050565b92915050565b6000546001600160a01b031633146134575760405162461bcd60e51b815260040161083b9061408e565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254604051630e39b00f60e11b81524360048201526000916001600160a01b031690631c73601e90602401602060405180830381600087803b1580156134bf57600080fd5b505af11580156134d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f79190613d21565b905090565b600060405160005b601481101561351f5783811a81600c84010153600101613504565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b15801561357057600080fd5b505afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190613dac565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561360257600080fd5b505afa158015613616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363a9190613d21565b6136449190613d7e565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b15801561368057600080fd5b505afa158015613694573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136bc91908101906141b3565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561371c57600080fd5b505afa158015613730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137549190613f4b565b90925090506137638382613d50565b909110159695505050505050565b82805461377d90613f6f565b90600052602060002090601f01602090048101928261379f57600085556137e5565b82601f106137b85782800160ff198235161785556137e5565b828001600101855582156137e5579182015b828111156137e55782358255916020019190600101906137ca565b506137f19291506137f5565b5090565b5b808211156137f157600081556001016137f6565b60006020828403121561381c57600080fd5b5035919050565b6001600160a01b038116811461383857600080fd5b50565b6000806000806080858703121561385157600080fd5b84359350602085013561386381613823565b93969395505050506040820135916060013590565b6000806040838503121561388b57600080fd5b50508035926020909101359150565b6000806000606084860312156138af57600080fd5b505081359360208301359350604090920135919050565b60005b838110156138e15781810151838201526020016138c9565b838111156126e85750506000910152565b6000815180845261390a8160208601602086016138c6565b601f01601f19169290920160200192915050565b838152821515602082015260606040820152600061393f60608301846138f2565b95945050505050565b60008083601f84011261395a57600080fd5b50813567ffffffffffffffff81111561397257600080fd5b6020830191508360208260051b850101111561398d57600080fd5b9250929050565b600080600080606085870312156139aa57600080fd5b84359350602085013567ffffffffffffffff8111156139c857600080fd5b6139d487828801613948565b9598909750949560400135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613a2657613a266139e7565b604052919050565b600067ffffffffffffffff831115613a4857613a486139e7565b613a5b601f8401601f19166020016139fd565b9050828152838383011115613a6f57600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613a9b57600080fd5b8335613aa681613823565b925060208401359150604084013567ffffffffffffffff811115613ac957600080fd5b8401601f81018613613ada57600080fd5b613ae986823560208401613a2e565b9150509250925092565b60008060008060008060a08789031215613b0c57600080fd5b86359550602087013567ffffffffffffffff80821115613b2b57600080fd5b613b378a838b01613948565b909750955060408901359450606089013593506080890135915080821115613b5e57600080fd5b508701601f81018913613b7057600080fd5b613b7f89823560208401613a2e565b9150509295509295509295565b600060208284031215613b9e57600080fd5b813561211481613823565b60008083601f840112613bbb57600080fd5b50813567ffffffffffffffff811115613bd357600080fd5b60208301915083602082850101111561398d57600080fd5b600080600060408486031215613c0057600080fd5b83359250602084013567ffffffffffffffff811115613c1e57600080fd5b613c2a86828701613ba9565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613c6f57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613c8d57600080fd5b8535945060208601359350604086013567ffffffffffffffff811115613cb257600080fd5b613cbe88828901613ba9565b96999598509660600135949350505050565b600060208284031215613ce257600080fd5b81516002811061211457600080fd5b80518015158114613d0157600080fd5b919050565b600060208284031215613d1857600080fd5b61211482613cf1565b600060208284031215613d3357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613d6357613d63613d3a565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613d9057613d90613d3a565b500390565b80516001600160601b0381168114613d0157600080fd5b600080600080600060a08688031215613dc457600080fd5b613dcd86613d95565b94506020860151613ddd81613823565b604087015190945060058110613df257600080fd5b9250613e0060608701613cf1565b9150608086015190509295509295909350565b6000816000190483118215151615613e2d57613e2d613d3a565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613e5757613e57613e32565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600080600060608486031215613eec57600080fd5b8351925060208401519150604084015190509250925092565b600082613f1457613f14613e32565b500690565b6000600019821415613f2d57613f2d613d3a565b5060010190565b600081613f4357613f43613d3a565b506000190190565b60008060408385031215613f5e57600080fd5b505080516020909101519092909150565b600181811c90821680613f8357607f821691505b60208210811415613fa457634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c915080831680613fd857607f831692505b858310811415613ff657634e487b7160e01b85526022600452602485fd5b6060880183905260808801818015614015576001811461402657614051565b60ff19861682528782019650614051565b60008b81526020902060005b8681101561404b57815484820152908501908901614032565b83019750505b50949b9a5050505050505050505050565b6000806040838503121561407557600080fd5b8251915061408560208401613cf1565b90509250929050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600082516140e28184602087016138c6565b9190910192915050565b60008060008060008060c0878903121561410557600080fd5b61410e87613d95565b955061411c60208801613cf1565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b8381526000835161415c8160208501602088016138c6565b60209201918201929092526040019392505050565b60208152600061211460208301846138f2565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008060008060008060c087890312156141cc57600080fd5b8651955060208088015195506040880151945060608801519350608088015167ffffffffffffffff8082111561420157600080fd5b818a0191508a601f83011261421557600080fd5b815181811115614227576142276139e7565b8060051b91506142388483016139fd565b818152918301840191848101908d84111561425257600080fd5b938501935b8385101561427c578451925061426c83613823565b8282529385019390850190614257565b80975050505050505060a08701519050929550929550929556fea264697066735822122093e1025e8596baad92b8acbc1dfd801832f0c4845d9b926d2b306bac5cf1c9ee64736f6c63430008090033", + "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)": { + "details": "Changes the `_rng` storage variable.", + "params": { + "_rng": "The new value for the `RNGenerator` storage variable." + } + }, + "constructor": { + "details": "Constructor.", + "params": { + "_core": "The KlerosCore arbitrator.", + "_governor": "The governor's address.", + "_rng": "The random number generator." + } + }, + "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": { + "ruling": "The current ruling." + } + }, + "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." + } + }, + "getLastRoundResult(uint256)": { + "details": "Returns the voting data from the most relevant round.", + "params": { + "_coreDisputeID": "The ID of the dispute in Kleros Core, not in the Dispute Kit." + }, + "returns": { + "tied": "Whether it's a tie or not.", + "winningChoice": "The winning choice of this round." + } + }, + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 6201, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 6204, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "core", + "offset": 0, + "slot": "1", + "type": "t_contract(KlerosCore)5813" + }, + { + "astId": 6378, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "rng", + "offset": 0, + "slot": "2", + "type": "t_contract(RNG)24354" + }, + { + "astId": 6380, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "RNBlock", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 6382, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "RN", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 6385, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "phase", + "offset": 0, + "slot": "5", + "type": "t_enum(Phase)6301" + }, + { + "astId": 6387, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "disputesWithoutJurors", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 6391, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "disputes", + "offset": 0, + "slot": "7", + "type": "t_array(t_struct(Dispute)6316_storage)dyn_storage" + }, + { + "astId": 6395, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "coreDisputeIDToLocal", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_uint256,t_uint256)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_struct(Dispute)6316_storage)dyn_storage": { + "base": "t_struct(Dispute)6316_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassic.Dispute[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Round)6354_storage)dyn_storage": { + "base": "t_struct(Round)6354_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassic.Round[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Vote)6363_storage)dyn_storage": { + "base": "t_struct(Vote)6363_storage", + "encoding": "dynamic_array", + "label": "struct DisputeKitClassic.Vote[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_contract(KlerosCore)5813": { + "encoding": "inplace", + "label": "contract KlerosCore", + "numberOfBytes": "20" + }, + "t_contract(RNG)24354": { + "encoding": "inplace", + "label": "contract RNG", + "numberOfBytes": "20" + }, + "t_enum(Phase)6301": { + "encoding": "inplace", + "label": "enum DisputeKitClassic.Phase", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_mapping(t_uint256,t_uint256))": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => mapping(uint256 => uint256))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_uint256)" + }, + "t_mapping(t_uint256,t_bool)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Dispute)6316_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassic.Dispute", + "members": [ + { + "astId": 6305, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "rounds", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(Round)6354_storage)dyn_storage" + }, + { + "astId": 6307, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "numberOfChoices", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 6309, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "jumped", + "offset": 0, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 6313, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "coreRoundIDToLocal", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 6315, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "extraData", + "offset": 0, + "slot": "4", + "type": "t_bytes_storage" + } + ], + "numberOfBytes": "160" + }, + "t_struct(Round)6354_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassic.Round", + "members": [ + { + "astId": 6320, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "votes", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(Vote)6363_storage)dyn_storage" + }, + { + "astId": 6322, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "winningChoice", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 6326, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "counts", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 6328, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "tied", + "offset": 0, + "slot": "3", + "type": "t_bool" + }, + { + "astId": 6330, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "totalVoted", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 6332, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "totalCommitted", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 6336, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "paidFees", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 6340, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "hasPaid", + "offset": 0, + "slot": "7", + "type": "t_mapping(t_uint256,t_bool)" + }, + { + "astId": 6346, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "contributions", + "offset": 0, + "slot": "8", + "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" + }, + { + "astId": 6348, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "feeRewards", + "offset": 0, + "slot": "9", + "type": "t_uint256" + }, + { + "astId": 6351, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "fundedChoices", + "offset": 0, + "slot": "10", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 6353, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "nbVotes", + "offset": 0, + "slot": "11", + "type": "t_uint256" + } + ], + "numberOfBytes": "384" + }, + "t_struct(Vote)6363_storage": { + "encoding": "inplace", + "label": "struct DisputeKitClassic.Vote", + "members": [ + { + "astId": 6356, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "account", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 6358, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "commit", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 6360, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "choice", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 6362, + "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", + "label": "voted", + "offset": 0, + "slot": "3", + "type": "t_bool" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerli/DisputeResolver.json b/contracts/deployments/arbitrumGoerli/DisputeResolver.json new file mode 100644 index 000000000..1b0bd7186 --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/DisputeResolver.json @@ -0,0 +1,384 @@ +{ + "address": "0x04Fb43F2Ce076867b5ba38750Ecb2cc6BDe78D61", + "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" + } + ], + "transactionHash": "0xc4f569e4abce0c385277003511bec5f9eb081959c1ca6c0490a29ee11b91171f", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x04Fb43F2Ce076867b5ba38750Ecb2cc6BDe78D61", + "transactionIndex": 1, + "gasUsed": "569678", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xc89ab6ca9adf8094f0fdc091b8a00ffbb155ad94b651a8b1ca2fd8a833256ef9", + "transactionHash": "0xc4f569e4abce0c385277003511bec5f9eb081959c1ca6c0490a29ee11b91171f", + "logs": [], + "blockNumber": 133632, + "cumulativeGasUsed": "569678", + "status": 1, + "byzantium": true + }, + "args": [ + "0x87142b7E9C7D026776499120D902AF8896C07894" + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\":200},\"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": "0x60a060405234801561001057600080fd5b506040516109f23803806109f283398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161095361009f6000396000818160bc0152818161017c0152818161044c01526105f501526109536000f3fe60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636cc6cde1146100aa578063c21ae061146100f6578063e2c7981b14610131575b600080fd5b34801561005b57600080fd5b5061006f61006a3660046106e4565b610144565b005b34801561007d57600080fd5b5061009161008c366004610706565b610309565b6040516100a1949392919061071f565b60405180910390f35b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a1565b34801561010257600080fd5b50610123610111366004610706565b60016020526000908152604090205481565b6040519081526020016100a1565b61012361013f3660046107d7565b6103d7565b600082815260016020526040812054815490919081908390811061016a5761016a61084b565b906000526020600020906004020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b03161461020e5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600301548311156102545760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610205565b600181015460ff16156102b55760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610205565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000818154811061031957600080fd5b906000526020600020906004020160009150905080600001805461033c90610861565b80601f016020809104026020016040519081016040528092919081815260200182805461036890610861565b80156103b55780601f1061038a576101008083540402835291602001916103b5565b820191906000526020600020905b81548152906001019060200180831161039857829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b6000600182116104355760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b6064820152608401610205565b60405163c13517e160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c13517e19034906104879086908b908b906004016108c5565b6020604051808303818588803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104d991906108e8565b600080546040805160a06020601f8c018190040282018101909252608081018a8152949550919382918b908b90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381528190208251805193946004029091019261055d928492019061064b565b506020828101516001838101805460ff191692151592909217909155604080850151600285015560609094015160039093019290925560008581529190528190208290555181907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906105d39088908890610901565b60405180910390a2604080518281526020810183905283916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a35095945050505050565b82805461065790610861565b90600052602060002090601f01602090048101928261067957600085556106bf565b82601f1061069257805160ff19168380011785556106bf565b828001600101855582156106bf579182015b828111156106bf5782518255916020019190600101906106a4565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b600080604083850312156106f757600080fd5b50508035926020909101359150565b60006020828403121561071857600080fd5b5035919050565b608081526000855180608084015260005b8181101561074d57602081890181015160a0868401015201610730565b8181111561075f57600060a083860101525b50601f01601f1916820160a001905061077c602083018615159052565b60408201939093526060015292915050565b60008083601f8401126107a057600080fd5b50813567ffffffffffffffff8111156107b857600080fd5b6020830191508360208285010111156107d057600080fd5b9250929050565b6000806000806000606086880312156107ef57600080fd5b853567ffffffffffffffff8082111561080757600080fd5b61081389838a0161078e565b9097509550602088013591508082111561082c57600080fd5b506108398882890161078e565b96999598509660400135949350505050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061087557607f821691505b6020821081141561089657634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108df60408301848661089c565b95945050505050565b6000602082840312156108fa57600080fd5b5051919050565b60208152600061091560208301848661089c565b94935050505056fea264697066735822122083e2e679a36b979e1db21c9f528914d8fe5b8d06e366e622a0688990fa7ee10d64736f6c63430008090033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636cc6cde1146100aa578063c21ae061146100f6578063e2c7981b14610131575b600080fd5b34801561005b57600080fd5b5061006f61006a3660046106e4565b610144565b005b34801561007d57600080fd5b5061009161008c366004610706565b610309565b6040516100a1949392919061071f565b60405180910390f35b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a1565b34801561010257600080fd5b50610123610111366004610706565b60016020526000908152604090205481565b6040519081526020016100a1565b61012361013f3660046107d7565b6103d7565b600082815260016020526040812054815490919081908390811061016a5761016a61084b565b906000526020600020906004020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b03161461020e5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600301548311156102545760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610205565b600181015460ff16156102b55760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610205565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000818154811061031957600080fd5b906000526020600020906004020160009150905080600001805461033c90610861565b80601f016020809104026020016040519081016040528092919081815260200182805461036890610861565b80156103b55780601f1061038a576101008083540402835291602001916103b5565b820191906000526020600020905b81548152906001019060200180831161039857829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b6000600182116104355760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b6064820152608401610205565b60405163c13517e160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c13517e19034906104879086908b908b906004016108c5565b6020604051808303818588803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104d991906108e8565b600080546040805160a06020601f8c018190040282018101909252608081018a8152949550919382918b908b90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381528190208251805193946004029091019261055d928492019061064b565b506020828101516001838101805460ff191692151592909217909155604080850151600285015560609094015160039093019290925560008581529190528190208290555181907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906105d39088908890610901565b60405180910390a2604080518281526020810183905283916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a35095945050505050565b82805461065790610861565b90600052602060002090601f01602090048101928261067957600085556106bf565b82601f1061069257805160ff19168380011785556106bf565b828001600101855582156106bf579182015b828111156106bf5782518255916020019190600101906106a4565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b600080604083850312156106f757600080fd5b50508035926020909101359150565b60006020828403121561071857600080fd5b5035919050565b608081526000855180608084015260005b8181101561074d57602081890181015160a0868401015201610730565b8181111561075f57600060a083860101525b50601f01601f1916820160a001905061077c602083018615159052565b60408201939093526060015292915050565b60008083601f8401126107a057600080fd5b50813567ffffffffffffffff8111156107b857600080fd5b6020830191508360208285010111156107d057600080fd5b9250929050565b6000806000806000606086880312156107ef57600080fd5b853567ffffffffffffffff8082111561080757600080fd5b61081389838a0161078e565b9097509550602088013591508082111561082c57600080fd5b506108398882890161078e565b96999598509660400135949350505050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061087557607f821691505b6020821081141561089657634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108df60408301848661089c565b95945050505050565b6000602082840312156108fa57600080fd5b5051919050565b60208152600061091560208301848661089c565b94935050505056fea264697066735822122083e2e679a36b979e1db21c9f528914d8fe5b8d06e366e622a0688990fa7ee10d64736f6c63430008090033", + "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’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 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 + }, + "storageLayout": { + "storage": [ + { + "astId": 6039, + "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", + "label": "disputes", + "offset": 0, + "slot": "0", + "type": "t_array(t_struct(DisputeStruct)6032_storage)dyn_storage" + }, + { + "astId": 6043, + "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", + "label": "externalIDtoLocalID", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_uint256)" + } + ], + "types": { + "t_array(t_struct(DisputeStruct)6032_storage)dyn_storage": { + "base": "t_struct(DisputeStruct)6032_storage", + "encoding": "dynamic_array", + "label": "struct DisputeResolver.DisputeStruct[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes_storage": { + "encoding": "bytes", + "label": "bytes", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(DisputeStruct)6032_storage": { + "encoding": "inplace", + "label": "struct DisputeResolver.DisputeStruct", + "members": [ + { + "astId": 6025, + "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", + "label": "arbitratorExtraData", + "offset": 0, + "slot": "0", + "type": "t_bytes_storage" + }, + { + "astId": 6027, + "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", + "label": "isRuled", + "offset": 0, + "slot": "1", + "type": "t_bool" + }, + { + "astId": 6029, + "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", + "label": "ruling", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 6031, + "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", + "label": "numberOfRulingOptions", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerli/FastBridgeSender.json b/contracts/deployments/arbitrumGoerli/FastBridgeSender.json new file mode 100644 index 000000000..7c2feade9 --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/FastBridgeSender.json @@ -0,0 +1,358 @@ +{ + "address": "0xcFc0b84419583ff7b32fD5139B789cE858517d4C", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epochPeriod", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_safeBridgeReceiver", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "batchID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "batchMerkleRoot", + "type": "bytes32" + } + ], + "name": "BatchOutgoing", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "fastMessage", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "fastMessageHash", + "type": "bytes32" + } + ], + "name": "MessageReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "canonicalBridgeMessageID", + "type": "bytes32" + } + ], + "name": "SentSafe", + "type": "event" + }, + { + "inputs": [], + "name": "ARB_SYS", + "outputs": [ + { + "internalType": "contract IArbSys", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "batch", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "batchSize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentBatchID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "fastOutbox", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "safeBridgeReceiver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sendBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "sendFast", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "sendSafeFallback", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x0d2862e636f8de4fd2654bb81712925c60b80b1ea281fed1c1faa058212d22e3", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xcFc0b84419583ff7b32fD5139B789cE858517d4C", + "transactionIndex": 1, + "gasUsed": "613659", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xe5b7bb21f4e60c7bfc31de9c89fdccd4e9078d42b4cff41573ee7449c934a62e", + "transactionHash": "0x0d2862e636f8de4fd2654bb81712925c60b80b1ea281fed1c1faa058212d22e3", + "logs": [], + "blockNumber": 133634, + "cumulativeGasUsed": "613659", + "status": 1, + "byzantium": true + }, + "args": [ + 86400, + "0x87142b7E9C7D026776499120D902AF8896C07894" + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epochPeriod\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_safeBridgeReceiver\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"batchMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"BatchOutgoing\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"fastMessage\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"fastMessageHash\",\"type\":\"bytes32\"}],\"name\":\"MessageReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"canonicalBridgeMessageID\",\"type\":\"bytes32\"}],\"name\":\"SentSafe\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ARB_SYS\",\"outputs\":[{\"internalType\":\"contract IArbSys\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"batch\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBatchID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"epochPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"fastOutbox\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"safeBridgeReceiver\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sendBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"sendFast\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"sendSafeFallback\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_epochPeriod\":\"The duration between epochs.\",\"_safeBridgeReceiver\":\"The the Safe Bridge Router on Ethereum to the receiving chain.\"}},\"sendFast(address,bytes)\":{\"details\":\"Sends an arbitrary message to Ethereum using the Fast Bridge.\",\"params\":{\"_calldata\":\"The receiving domain encoded message data / function arguments.\",\"_receiver\":\"The address of the contract on Ethereum which receives the calldata.\"}},\"sendSafeFallback(uint256)\":{\"details\":\"Sends the merkle root state for _epoch to Ethereum using the Safe Bridge, which relies on Arbitrum's canonical bridge. It is unnecessary during normal operations but essential only in case of challenge.\",\"params\":{\"_epoch\":\"The blocknumber of the batch\"}}},\"version\":1},\"userdoc\":{\"events\":{\"BatchOutgoing(uint256,uint256,uint256,bytes32)\":{\"notice\":\"The bridgers need to watch for these events and relay the batchMerkleRoot on the FastBridgeReceiver.\"}},\"kind\":\"user\",\"methods\":{\"sendBatch()\":{\"notice\":\"Sends a batch of arbitrary message from one domain to another via the fast bridge mechanism.\"}},\"notice\":\"Fast Bridge Sender Counterpart of `FastBridgeReceiver`\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/bridge/FastBridgeSender.sol\":\"FastBridgeSender\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/bridge/FastBridgeSender.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 \\\"./interfaces/IFastBridgeSender.sol\\\";\\nimport \\\"./interfaces/ISafeBridgeSender.sol\\\";\\nimport \\\"./interfaces/ISafeBridgeReceiver.sol\\\";\\nimport \\\"./canonical/arbitrum/IArbSys.sol\\\"; // Arbitrum sender specific\\n\\n/**\\n * Fast Bridge Sender\\n * Counterpart of `FastBridgeReceiver`\\n */\\ncontract FastBridgeSender is IFastBridgeSender, ISafeBridgeSender {\\n // **************************************** //\\n // * * //\\n // * Arbitrum Sender Specific * //\\n // * * //\\n // **************************************** //\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n IArbSys public constant ARB_SYS = IArbSys(address(100));\\n\\n /**\\n * @dev Sends the merkle root state for _epoch to Ethereum using the Safe Bridge, which relies on Arbitrum's canonical bridge. It is unnecessary during normal operations but essential only in case of challenge.\\n * @param _epoch The blocknumber of the batch\\n */\\n function sendSafeFallback(uint256 _epoch) external payable override {\\n require(_epoch <= currentBatchID, \\\"Invalid epoch.\\\");\\n bytes32 batchMerkleRoot = fastOutbox[_epoch];\\n\\n // Safe Bridge message envelope\\n bytes4 methodSelector = ISafeBridgeReceiver.verifySafeBatch.selector;\\n bytes memory safeMessageData = abi.encodeWithSelector(methodSelector, _epoch, batchMerkleRoot);\\n\\n bytes32 ticketID = _sendSafe(safeBridgeReceiver, safeMessageData);\\n emit SentSafe(_epoch, ticketID);\\n }\\n\\n function _sendSafe(address _receiver, bytes memory _calldata) internal override returns (bytes32) {\\n uint256 ticketID = ARB_SYS.sendTxToL1(_receiver, _calldata);\\n\\n return bytes32(ticketID);\\n }\\n\\n /**\\n * @dev Constructor.\\n * @param _epochPeriod The duration between epochs.\\n * @param _safeBridgeReceiver The the Safe Bridge Router on Ethereum to the receiving chain.\\n */\\n constructor(uint256 _epochPeriod, address _safeBridgeReceiver) {\\n epochPeriod = _epochPeriod;\\n safeBridgeReceiver = _safeBridgeReceiver;\\n unchecked {\\n currentBatchID = block.timestamp / _epochPeriod - 1;\\n }\\n }\\n\\n // ************************************** //\\n // * * //\\n // * General Sender * //\\n // * * //\\n // ************************************** //\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public immutable epochPeriod; // Epochs mark the period between potential batches of messages.\\n uint256 public currentBatchID;\\n mapping(uint256 => bytes32) public fastOutbox; // epoch count => merkle root of batched messages\\n address public immutable safeBridgeReceiver;\\n\\n // merkle tree representation of a batch of messages\\n // supports 2^64 messages.\\n bytes32[64] public batch;\\n uint256 public batchSize;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Sends an arbitrary message to Ethereum using the Fast Bridge.\\n * @param _receiver The address of the contract on Ethereum which receives the calldata.\\n * @param _calldata The receiving domain encoded message data / function arguments.\\n */\\n function sendFast(address _receiver, bytes memory _calldata) external override {\\n (bytes32 fastMessageHash, bytes memory fastMessage) = _encode(_receiver, _calldata);\\n emit MessageReceived(fastMessage, fastMessageHash);\\n appendMessage(fastMessageHash); // add message to merkle tree\\n }\\n\\n /**\\n * Sends a batch of arbitrary message from one domain to another via the fast bridge mechanism.\\n */\\n function sendBatch() external override {\\n uint256 epoch = block.timestamp / epochPeriod;\\n require(fastOutbox[epoch] == 0, \\\"Batch already sent for the current epoch.\\\");\\n require(batchSize > 0, \\\"No messages to send.\\\");\\n\\n // set merkle root in outbox\\n bytes32 batchMerkleRoot = getMerkleRoot();\\n fastOutbox[epoch] = batchMerkleRoot;\\n emit BatchOutgoing(currentBatchID, batchSize, epoch, batchMerkleRoot);\\n\\n // reset\\n batchSize = 0;\\n currentBatchID = epoch;\\n }\\n\\n // ************************ //\\n // * Internal * //\\n // ************************ //\\n\\n function _encode(address _receiver, bytes memory _calldata)\\n internal\\n view\\n returns (bytes32 fastMessageHash, bytes memory fastMessage)\\n {\\n // Encode the receiver address with the function signature + arguments i.e calldata\\n bytes32 sender = bytes32(bytes20(msg.sender));\\n bytes32 receiver = bytes32(bytes20(_receiver));\\n uint256 nonce = batchSize;\\n // add sender and receiver with proper function selector formatting\\n // [length][receiver: 1 slot padded][offset][function selector: 4 bytes no padding][msg.sender: 1 slot padded][function arguments: 1 slot padded]\\n assembly {\\n fastMessage := mload(0x40) // free memory pointer\\n let lengthCalldata := mload(_calldata) // calldata length\\n let lengthFastMesssageCalldata := add(lengthCalldata, 0x20) // add msg.sender\\n let lengthEncodedMessage := add(lengthFastMesssageCalldata, 0x80) // 1 offsets, receiver, and lengthFastMesssageCalldata\\n mstore(fastMessage, lengthEncodedMessage) // bytes length\\n mstore(add(fastMessage, 0x20), nonce) // nonce\\n mstore(add(fastMessage, 0x4c), receiver) // receiver\\n mstore(add(fastMessage, 0x60), 0x60) // offset\\n mstore(add(fastMessage, 0x80), lengthFastMesssageCalldata) // fast message length\\n mstore(\\n add(fastMessage, 0xa0),\\n and(mload(add(_calldata, 0x20)), 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\\n ) // function selector\\n mstore(add(fastMessage, 0xb0), sender) // sender\\n\\n let _cursor := add(fastMessage, 0xc4) // begin copying arguments of function call\\n let _cursorCalldata := add(_calldata, 0x24) // beginning of arguments\\n\\n // copy all arguments\\n for {\\n let j := 0x00\\n } lt(j, lengthCalldata) {\\n j := add(j, 0x20)\\n } {\\n mstore(_cursor, mload(add(_cursorCalldata, j)))\\n _cursor := add(_cursor, 0x20)\\n }\\n // update free pointer\\n mstore(0x40, _cursor)\\n }\\n // Compute the hash over the message header (batchSize as nonce) and body (fastMessage).\\n fastMessageHash = sha256(fastMessage);\\n }\\n\\n // ********************************* //\\n // * Merkle Tree * //\\n // ********************************* //\\n\\n /**\\n * @dev Append data into merkle tree.\\n * `O(log(n))` where `n` is the number of leaves.\\n * Note: Although each insertion is O(log(n)), complexity of n insertions is O(n).\\n * Note: Inlined from `merkle/MerkleTree.sol` for performance.\\n * @param leaf The leaf (already hashed) to insert in the merkle tree.\\n */\\n function appendMessage(bytes32 leaf) internal {\\n unchecked {\\n // Differentiate leaves from interior nodes with different\\n // hash functions to prevent 2nd order pre-image attack.\\n // https://flawed.net.nz/2018/02/21/attacking-merkle-trees-with-a-second-preimage-attack/\\n uint256 size = batchSize + 1;\\n batchSize = size;\\n uint256 hashBitField = (size ^ (size - 1)) & size;\\n uint256 height;\\n while ((hashBitField & 1) == 0) {\\n bytes32 node = batch[height];\\n if (node > leaf)\\n assembly {\\n // efficient hash\\n mstore(0x00, leaf)\\n mstore(0x20, node)\\n leaf := keccak256(0x00, 0x40)\\n }\\n else\\n assembly {\\n // efficient hash\\n mstore(0x00, node)\\n mstore(0x20, leaf)\\n leaf := keccak256(0x00, 0x40)\\n }\\n hashBitField /= 2;\\n height++;\\n }\\n batch[height] = leaf;\\n }\\n }\\n\\n /**\\n * @dev Gets the current merkle root.\\n * `O(log(n))` where `n` is the number of leaves.\\n * Note: Inlined from `merkle/MerkleTree.sol` for performance.\\n */\\n function getMerkleRoot() internal view returns (bytes32) {\\n unchecked {\\n bytes32 node;\\n uint256 size = batchSize;\\n uint256 height = 0;\\n bool isFirstHash = true;\\n while (size > 0) {\\n if ((size & 1) == 1) {\\n // avoid redundant calculation\\n if (isFirstHash) {\\n node = batch[height];\\n isFirstHash = false;\\n } else {\\n bytes32 hash = batch[height];\\n // efficient hash\\n if (hash > node)\\n assembly {\\n mstore(0x00, node)\\n mstore(0x20, hash)\\n node := keccak256(0x00, 0x40)\\n }\\n else\\n assembly {\\n mstore(0x00, hash)\\n mstore(0x20, node)\\n node := keccak256(0x00, 0x40)\\n }\\n }\\n }\\n size /= 2;\\n height++;\\n }\\n return node;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x60171ae581cde479f353cbd135fcfd9436f326e0a73fedfb98af8f6e693b665d\",\"license\":\"MIT\"},\"src/bridge/canonical/arbitrum/IArbSys.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\npragma solidity >=0.7.0;\\n\\n/**\\n * @title Precompiled contract that exists in every Arbitrum chain at address(100), 0x0000000000000000000000000000000000000064. Exposes a variety of system-level functionality.\\n */\\ninterface IArbSys {\\n /**\\n * @notice Get internal version number identifying an ArbOS build\\n * @return version number as int\\n */\\n function arbOSVersion() external pure returns (uint256);\\n\\n /**\\n * @notice Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0)\\n * @return block number as int\\n */\\n function arbBlockNumber() external view returns (uint256);\\n\\n /**\\n * @notice Send given amount of Eth to dest from sender.\\n * This is a convenience function, which is equivalent to calling sendTxToL1 with empty calldataForL1.\\n * @param destination recipient address on L1\\n * @return unique identifier for this L2-to-L1 transaction.\\n */\\n function withdrawEth(address destination) external payable returns (uint256);\\n\\n /**\\n * @notice Send a transaction to L1\\n * @param destination recipient address on L1\\n * @param calldataForL1 (optional) calldata for L1 contract call\\n * @return a unique identifier for this L2-to-L1 transaction.\\n */\\n function sendTxToL1(address destination, bytes calldata calldataForL1) external payable returns (uint256);\\n\\n /**\\n * @notice get the number of transactions issued by the given external account or the account sequence number of the given contract\\n * @param account target account\\n * @return the number of transactions issued by the given external account or the account sequence number of the given contract\\n */\\n function getTransactionCount(address account) external view returns (uint256);\\n\\n /**\\n * @notice get the value of target L2 storage slot\\n * This function is only callable from address 0 to prevent contracts from being able to call it\\n * @param account target account\\n * @param index target index of storage slot\\n * @return stotage value for the given account at the given index\\n */\\n function getStorageAt(address account, uint256 index) external view returns (uint256);\\n\\n /**\\n * @notice check if current call is coming from l1\\n * @return true if the caller of this was called directly from L1\\n */\\n function isTopLevelCall() external view returns (bool);\\n\\n event EthWithdrawal(address indexed destAddr, uint256 amount);\\n\\n event L2ToL1Transaction(\\n address caller,\\n address indexed destination,\\n uint256 indexed uniqueId,\\n uint256 indexed batchNumber,\\n uint256 indexInBatch,\\n uint256 arbBlockNum,\\n uint256 ethBlockNum,\\n uint256 timestamp,\\n uint256 callvalue,\\n bytes data\\n );\\n}\\n\",\"keccak256\":\"0x2abbc6cf12d56c18cf4339b34747f6adea78f17a82e1813923a05d9aa7597ef3\",\"license\":\"Apache-2.0\"},\"src/bridge/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\"},\"src/bridge/interfaces/ISafeBridgeReceiver.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\\nabstract contract ISafeBridgeReceiver {\\n /**\\n * Note: Access restricted to the Safe Bridge.\\n * @dev Resolves any challenge of the optimistic claim for '_epoch'.\\n * @param _epoch The epoch associated with the _batchmerkleRoot.\\n * @param _batchMerkleRoot The true batch merkle root for the epoch sent by the safe bridge.\\n */\\n function verifySafeBatch(uint256 _epoch, bytes32 _batchMerkleRoot) external virtual;\\n\\n function isSentBySafeBridge() internal view virtual returns (bool);\\n\\n modifier onlyFromSafeBridge() {\\n require(isSentBySafeBridge(), \\\"Safe Bridge only.\\\");\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xc4bee04423c73bf37e7d975fccab05767ba0e738cc753d293438c2d1ace9f804\",\"license\":\"MIT\"},\"src/bridge/interfaces/ISafeBridgeSender.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\\nabstract contract ISafeBridgeSender {\\n /**\\n * Sends an arbitrary message from one domain to another.\\n *\\n * @param _receiver The contract address which will receive the calldata on the receiving chain.\\n * @param _calldata The encoded message data to send.\\n * @return Unique id to track the message request/transaction.\\n */\\n function _sendSafe(address _receiver, bytes memory _calldata) internal virtual returns (bytes32);\\n}\\n\",\"keccak256\":\"0xe17476e515afdd9496b00ab122162c5700d3c6fdda947f70027d5bf6f4645c93\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b50604051610a97380380610a9783398101604081905261002f9161005f565b60808290526001600160a01b03811660a05260018242816100525761005261009c565b0403600055506100b29050565b6000806040838503121561007257600080fd5b825160208401519092506001600160a01b038116811461009157600080fd5b809150509250929050565b634e487b7160e01b600052601260045260246000fd5b60805160a0516109b36100e46000396000818160db015261046701526000818161018b015261027801526109b36000f3fe6080604052600436106100915760003560e01c8063b5b7a18411610059578063b5b7a18414610179578063bd0805eb146101ad578063bd8e62d6146101c3578063d8c05a3a146101d8578063f4daaba1146101eb57600080fd5b80630eaa75fe1461009657806364fccb52146100c95780637834f14e1461011557806398ec20ec14610142578063a093961b14610164575b600080fd5b3480156100a257600080fd5b506100b66100b1366004610773565b610201565b6040519081526020015b60405180910390f35b3480156100d557600080fd5b506100fd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c0565b34801561012157600080fd5b506100b6610130366004610773565b60016020526000908152604090205481565b34801561014e57600080fd5b5061016261015d3660046107a2565b610218565b005b34801561017057600080fd5b50610162610271565b34801561018557600080fd5b506100b67f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b957600080fd5b506100b660005481565b3480156101cf57600080fd5b506100fd606481565b6101626101e6366004610773565b6103cc565b3480156101f757600080fd5b506100b660425481565b6002816040811061021157600080fd5b0154905081565b60008061022584846104cf565b915091507f184cd819d58dedfbb6e4281fbfc51de811c74320929a718c5e27f367f55dd892818360405161025a9291906108ca565b60405180910390a161026b826105be565b50505050565b600061029d7f0000000000000000000000000000000000000000000000000000000000000000426108ec565b600081815260016020526040902054909150156103135760405162461bcd60e51b815260206004820152602960248201527f426174636820616c72656164792073656e7420666f7220746865206375727265604482015268373a1032b837b1b41760b91b60648201526084015b60405180910390fd5b60006042541161035c5760405162461bcd60e51b815260206004820152601460248201527327379036b2b9b9b0b3b2b9903a379039b2b7321760611b604482015260640161030a565b6000610366610649565b600083815260016020908152604080832084905591546042548351908152918201869052918101839052919250907ff67fa0a4947381c1657490b7a5e74d1da3cd790f5ee5a6fd0020306eff024fee9060600160405180910390a2506000604281905555565b60005481111561040f5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21032b837b1b41760911b604482015260640161030a565b600081815260016020908152604080832054815160248101869052604480820183905283518083039091018152606490910190925291810180516001600160e01b0316632dff2f8d60e11b908117909152919261048c7f0000000000000000000000000000000000000000000000000000000000000000836106ee565b9050847f98f86a6cdb328955823a542be2edbbc788c9cc7052e74f9f20d0ab3988a6ade7826040516104c091815260200190565b60405180910390a25050505050565b604254604051825160a0808201835260208084018590526bffffffffffffffffffffffff19606088811b8216604c87018190528187018290528386016080880152928801516001600160e01b031916938601939093523390921b90911660b08401819052600094909260c4850160248801875b8381101561055c5781810151835260209283019201610542565b505060408190526002915061057290869061090e565b602060405180830381855afa15801561058f573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906105b2919061092a565b94505050509250929050565b6042805460018101918290558118811660005b6001821661062d576000600282604081106105ee576105ee610943565b015490508481111561060e5784600052806020526040600020945061061e565b8060005284602052604060002094505b600283049250506001016105d1565b836002826040811061064157610641610943565b015550505050565b60425460009081908160015b82156106e55782600116600114156106d457801561068d576002826040811061068057610680610943565b01549350600090506106d4565b6000600283604081106106a2576106a2610943565b01549050848111156106c2578460005280602052604060002094506106d2565b8060005284602052604060002094505b505b600283049250600190910190610655565b50919392505050565b6040516349460b4d60e11b8152600090819060649063928c169a906107199087908790600401610959565b602060405180830381600087803b15801561073357600080fd5b505af1158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b919061092a565b949350505050565b60006020828403121561078557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156107b557600080fd5b82356001600160a01b03811681146107cc57600080fd5b9150602083013567ffffffffffffffff808211156107e957600080fd5b818501915085601f8301126107fd57600080fd5b81358181111561080f5761080f61078c565b604051601f8201601f19908116603f011681019083821181831017156108375761083761078c565b8160405282815288602084870101111561085057600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b8381101561088d578181015183820152602001610875565b8381111561026b5750506000910152565b600081518084526108b6816020860160208601610872565b601f01601f19169290920160200192915050565b6040815260006108dd604083018561089e565b90508260208301529392505050565b60008261090957634e487b7160e01b600052601260045260246000fd5b500490565b60008251610920818460208701610872565b9190910192915050565b60006020828403121561093c57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038316815260406020820181905260009061076b9083018461089e56fea2646970667358221220a064a367a3509d6f4e9973c64002d2bc4aea35cdd742e6560be6c6b5bdf75cc464736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100915760003560e01c8063b5b7a18411610059578063b5b7a18414610179578063bd0805eb146101ad578063bd8e62d6146101c3578063d8c05a3a146101d8578063f4daaba1146101eb57600080fd5b80630eaa75fe1461009657806364fccb52146100c95780637834f14e1461011557806398ec20ec14610142578063a093961b14610164575b600080fd5b3480156100a257600080fd5b506100b66100b1366004610773565b610201565b6040519081526020015b60405180910390f35b3480156100d557600080fd5b506100fd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c0565b34801561012157600080fd5b506100b6610130366004610773565b60016020526000908152604090205481565b34801561014e57600080fd5b5061016261015d3660046107a2565b610218565b005b34801561017057600080fd5b50610162610271565b34801561018557600080fd5b506100b67f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b957600080fd5b506100b660005481565b3480156101cf57600080fd5b506100fd606481565b6101626101e6366004610773565b6103cc565b3480156101f757600080fd5b506100b660425481565b6002816040811061021157600080fd5b0154905081565b60008061022584846104cf565b915091507f184cd819d58dedfbb6e4281fbfc51de811c74320929a718c5e27f367f55dd892818360405161025a9291906108ca565b60405180910390a161026b826105be565b50505050565b600061029d7f0000000000000000000000000000000000000000000000000000000000000000426108ec565b600081815260016020526040902054909150156103135760405162461bcd60e51b815260206004820152602960248201527f426174636820616c72656164792073656e7420666f7220746865206375727265604482015268373a1032b837b1b41760b91b60648201526084015b60405180910390fd5b60006042541161035c5760405162461bcd60e51b815260206004820152601460248201527327379036b2b9b9b0b3b2b9903a379039b2b7321760611b604482015260640161030a565b6000610366610649565b600083815260016020908152604080832084905591546042548351908152918201869052918101839052919250907ff67fa0a4947381c1657490b7a5e74d1da3cd790f5ee5a6fd0020306eff024fee9060600160405180910390a2506000604281905555565b60005481111561040f5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21032b837b1b41760911b604482015260640161030a565b600081815260016020908152604080832054815160248101869052604480820183905283518083039091018152606490910190925291810180516001600160e01b0316632dff2f8d60e11b908117909152919261048c7f0000000000000000000000000000000000000000000000000000000000000000836106ee565b9050847f98f86a6cdb328955823a542be2edbbc788c9cc7052e74f9f20d0ab3988a6ade7826040516104c091815260200190565b60405180910390a25050505050565b604254604051825160a0808201835260208084018590526bffffffffffffffffffffffff19606088811b8216604c87018190528187018290528386016080880152928801516001600160e01b031916938601939093523390921b90911660b08401819052600094909260c4850160248801875b8381101561055c5781810151835260209283019201610542565b505060408190526002915061057290869061090e565b602060405180830381855afa15801561058f573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906105b2919061092a565b94505050509250929050565b6042805460018101918290558118811660005b6001821661062d576000600282604081106105ee576105ee610943565b015490508481111561060e5784600052806020526040600020945061061e565b8060005284602052604060002094505b600283049250506001016105d1565b836002826040811061064157610641610943565b015550505050565b60425460009081908160015b82156106e55782600116600114156106d457801561068d576002826040811061068057610680610943565b01549350600090506106d4565b6000600283604081106106a2576106a2610943565b01549050848111156106c2578460005280602052604060002094506106d2565b8060005284602052604060002094505b505b600283049250600190910190610655565b50919392505050565b6040516349460b4d60e11b8152600090819060649063928c169a906107199087908790600401610959565b602060405180830381600087803b15801561073357600080fd5b505af1158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b919061092a565b949350505050565b60006020828403121561078557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156107b557600080fd5b82356001600160a01b03811681146107cc57600080fd5b9150602083013567ffffffffffffffff808211156107e957600080fd5b818501915085601f8301126107fd57600080fd5b81358181111561080f5761080f61078c565b604051601f8201601f19908116603f011681019083821181831017156108375761083761078c565b8160405282815288602084870101111561085057600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b8381101561088d578181015183820152602001610875565b8381111561026b5750506000910152565b600081518084526108b6816020860160208601610872565b601f01601f19169290920160200192915050565b6040815260006108dd604083018561089e565b90508260208301529392505050565b60008261090957634e487b7160e01b600052601260045260246000fd5b500490565b60008251610920818460208701610872565b9190910192915050565b60006020828403121561093c57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038316815260406020820181905260009061076b9083018461089e56fea2646970667358221220a064a367a3509d6f4e9973c64002d2bc4aea35cdd742e6560be6c6b5bdf75cc464736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "constructor": { + "details": "Constructor.", + "params": { + "_epochPeriod": "The duration between epochs.", + "_safeBridgeReceiver": "The the Safe Bridge Router on Ethereum to the receiving chain." + } + }, + "sendFast(address,bytes)": { + "details": "Sends an arbitrary message to Ethereum using the Fast Bridge.", + "params": { + "_calldata": "The receiving domain encoded message data / function arguments.", + "_receiver": "The address of the contract on Ethereum which receives the calldata." + } + }, + "sendSafeFallback(uint256)": { + "details": "Sends the merkle root state for _epoch to Ethereum using the Safe Bridge, which relies on Arbitrum's canonical bridge. It is unnecessary during normal operations but essential only in case of challenge.", + "params": { + "_epoch": "The blocknumber of the batch" + } + } + }, + "version": 1 + }, + "userdoc": { + "events": { + "BatchOutgoing(uint256,uint256,uint256,bytes32)": { + "notice": "The bridgers need to watch for these events and relay the batchMerkleRoot on the FastBridgeReceiver." + } + }, + "kind": "user", + "methods": { + "sendBatch()": { + "notice": "Sends a batch of arbitrary message from one domain to another via the fast bridge mechanism." + } + }, + "notice": "Fast Bridge Sender Counterpart of `FastBridgeReceiver`", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 13144, + "contract": "src/bridge/FastBridgeSender.sol:FastBridgeSender", + "label": "currentBatchID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 13148, + "contract": "src/bridge/FastBridgeSender.sol:FastBridgeSender", + "label": "fastOutbox", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_bytes32)" + }, + { + "astId": 13154, + "contract": "src/bridge/FastBridgeSender.sol:FastBridgeSender", + "label": "batch", + "offset": 0, + "slot": "2", + "type": "t_array(t_bytes32)64_storage" + }, + { + "astId": 13156, + "contract": "src/bridge/FastBridgeSender.sol:FastBridgeSender", + "label": "batchSize", + "offset": 0, + "slot": "66", + "type": "t_uint256" + } + ], + "types": { + "t_array(t_bytes32)64_storage": { + "base": "t_bytes32", + "encoding": "inplace", + "label": "bytes32[64]", + "numberOfBytes": "2048" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerli/HomeGatewayToEthereum.json b/contracts/deployments/arbitrumGoerli/HomeGatewayToEthereum.json new file mode 100644 index 000000000..86f54d49b --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/HomeGatewayToEthereum.json @@ -0,0 +1,553 @@ +{ + "address": "0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636", + "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": "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": "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": "_originalChainID", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_originalBlockHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_originalDisputeID", + "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": "0x1fa24d43e887c2abbfa14f74a3e8bb9a038def67fc0a3c9cf7e21fdf615c3339", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636", + "transactionIndex": 1, + "gasUsed": "694556", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000004000000000000000000000100000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000020000000000000000000000000000100000000000000000000000000000000000000", + "blockHash": "0xb3cfddf91d4f9da938e96cdb93bbc5edcf8770c2a3b81b1135a7a8d4d335b9c6", + "transactionHash": "0x1fa24d43e887c2abbfa14f74a3e8bb9a038def67fc0a3c9cf7e21fdf615c3339", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 133635, + "transactionHash": "0x1fa24d43e887c2abbfa14f74a3e8bb9a038def67fc0a3c9cf7e21fdf615c3339", + "address": "0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636", + "topics": [ + "0x61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000064252494447450000000000000000000000000000000000000000000000000000", + "logIndex": 0, + "blockHash": "0xb3cfddf91d4f9da938e96cdb93bbc5edcf8770c2a3b81b1135a7a8d4d335b9c6" + } + ], + "blockNumber": 133635, + "cumulativeGasUsed": "694556", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x87142b7E9C7D026776499120D902AF8896C07894", + "0xcFc0b84419583ff7b32fD5139B789cE858517d4C", + "0xf08273e2B35E78509B027f6FAa32485844EA7cCA", + 5 + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\":\"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\":\"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\":\"_originalChainID\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_originalBlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_originalDisputeID\",\"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.\"}},\"relayCreateDispute(uint256,bytes32,uint256,uint256,bytes,address)\":{\"details\":\"Provide the same parameters as on the originalChain while creating a dispute. Providing incorrect parameters will create a different hash than on the originalChain and will not affect the actual dispute/arbitrable's ruling.\",\"params\":{\"_arbitrable\":\"arbitrable\",\"_choices\":\"number of ruling choices\",\"_extraData\":\"extraData\",\"_originalBlockHash\":\"originalBlockHash\",\"_originalChainID\":\"originalChainId\",\"_originalDisputeID\":\"originalDisputeID\"}},\"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\":200},\"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/bridge/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\"},\"src/bridge/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\"},\"src/bridge/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 \\\"../../bridge/interfaces/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\":\"0x0c4a83b87e4810d2e9798a3df3876d0708171c25757c9a2e04c0b3360c9a0d3a\",\"license\":\"MIT\"},\"src/bridge/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 \\\"../../bridge/interfaces/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\":\"0x2c84190092d2b50a8267aef262531dfebebc4ed612377be04d8bee1146689ef2\",\"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\"},\"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 \\\"../bridge/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 originalChain while creating a dispute. Providing incorrect parameters will create a different hash than on the originalChain and will not affect the actual dispute/arbitrable's ruling.\\n * @param _originalChainID originalChainId\\n * @param _originalBlockHash originalBlockHash\\n * @param _originalDisputeID originalDisputeID\\n * @param _choices number of ruling choices\\n * @param _extraData extraData\\n * @param _arbitrable arbitrable\\n */\\n function relayCreateDispute(\\n uint256 _originalChainID,\\n bytes32 _originalBlockHash,\\n uint256 _originalDisputeID,\\n uint256 _choices,\\n bytes calldata _extraData,\\n address _arbitrable\\n ) external payable override {\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n _originalChainID,\\n _originalBlockHash,\\n \\\"createDispute\\\",\\n _originalDisputeID,\\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 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 function disputeHashToHomeID(bytes32 _disputeHash) external view override returns (uint256) {\\n return disputeHashtoID[_disputeHash];\\n }\\n}\\n\",\"keccak256\":\"0x866fdced5677b2a078ea3e486b9d6b8236020f787c8dd6bdcb0ed58c16618a1b\",\"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 \\\"../../bridge/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(\\n address _messageSender,\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _forwarder\\n ) 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\",\"keccak256\":\"0xef24b9fbfb1afcb5cd8ac01541dab1142c34e87e723f0d3355bf80d163136b38\",\"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 \\\"../../bridge/interfaces/ISenderGateway.sol\\\";\\n\\ninterface IHomeGateway is IArbitrable, IMetaEvidence, ISenderGateway {\\n function relayCreateDispute(\\n uint256 _originalChainID,\\n bytes32 _originalBlockHash,\\n uint256 _originalDisputeID,\\n uint256 _choices,\\n bytes calldata _extraData,\\n address _arbitrable\\n ) external payable;\\n\\n // For cross-chain Evidence standard\\n function disputeHashToHomeID(bytes32 _disputeHash) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x5242b2697e7ad168165d924e7a8a7ad295eb5d89f80de6d38debe543bce1640a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b50604051610bd5380380610bd583398101604081905261002f916100e6565b600080546001600160a01b038088166001600160a01b031992831617835586811660805260018054878316908416179055600280549186169190921617905560a08290526040517f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906100bc9060208082526006908201526542524944474560d01b604082015260600190565b60405180910390a25050505050610151565b6001600160a01b03811681146100e357600080fd5b50565b600080600080600060a086880312156100fe57600080fd5b8551610109816100ce565b602087015190955061011a816100ce565b604087015190945061012b816100ce565b606087015190935061013c816100ce565b80925050608086015190509295509295909350565b60805160a051610a436101926000396000610286015260008181610130015281816102e0015281816104e9015281816105c601526106af0152610a436000f3fe6080604052600436106100a75760003560e01c8063c5ffcf7011610064578063c5ffcf70146101ad578063c95c0951146101cd578063cddbfa14146101fa578063e7fe313914610254578063ea4f97d314610274578063fc4ba3a2146102a857600080fd5b80630c340a24146100ac578063311a6c56146100e95780633b103f531461010b5780636cc6cde11461011e5780638ed87e0014610152578063ba4bc76314610172575b600080fd5b3480156100b857600080fd5b506000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100f557600080fd5b50610109610104366004610796565b6102d5565b005b6101096101193660046107e0565b610430565b34801561012a57600080fd5b506100cc7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015e57600080fd5b5061010961016d36600461088a565b61070f565b34801561017e57600080fd5b5061019f61018d3660046108ae565b60036020526000908152604090205481565b6040519081526020016100e0565b3480156101b957600080fd5b506002546100cc906001600160a01b031681565b3480156101d957600080fd5b5061019f6101e83660046108ae565b60046020526000908152604090205481565b34801561020657600080fd5b506102376102153660046108ae565b600560205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016100e0565b34801561026057600080fd5b506001546100cc906001600160a01b031681565b34801561028057600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102b457600080fd5b5061019f6102c33660046108ae565b60009081526004602052604090205490565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103445760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b60448201526064015b60405180910390fd5b600082815260036020908152604080832054808452600583529281902081518083018352815481526001918201546001600160a01b039081168286018190528451602481018890526044810189905260648082019290925285518082039092018252608401855294850180516001600160e01b031663a60a4db560e01b9081179091529254600254945163263b083b60e21b815292959394908216926398ec20ec926103f692169085906004016108c7565b600060405180830381600087803b15801561041057600080fd5b505af1158015610424573d6000803e3d6000fd5b50505050505050505050565b60008787878787878760405160200161044f979695949392919061092c565b60408051601f1981840301815291815281516020928301206000818152600590935291206001810154919250906001600160a01b0316156104d25760405162461bcd60e51b815260206004820152601760248201527f4469737075746520616c72656164792072656c61796564000000000000000000604482015260640161033b565b60405163f7434ea960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f7434ea99061052090889088906004016109b5565b60206040518083038186803b15801561053857600080fd5b505afa15801561054c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057091906109d1565b8082553410156105c25760405162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f756768206172626974726174696f6e20636f73742070616964604482015260640161033b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c13517e1348989896040518563ffffffff1660e01b8152600401610615939291906109ea565b6020604051808303818588803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061066791906109d1565b6000818152600360209081526040808320879055868352600482528083208490556001860180546001600160a01b0319163317905580518381529182019290925291925082917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350505050505050505050565b6000546001600160a01b031633146107745760405162461bcd60e51b815260206004820152602260248201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6044820152613c9760f11b606482015260840161033b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080604083850312156107a957600080fd5b50508035926020909101359150565b6001600160a01b03811681146107cd57600080fd5b50565b80356107db816107b8565b919050565b600080600080600080600060c0888a0312156107fb57600080fd5b87359650602088013595506040880135945060608801359350608088013567ffffffffffffffff8082111561082f57600080fd5b818a0191508a601f83011261084357600080fd5b81358181111561085257600080fd5b8b602082850101111561086457600080fd5b60208301955080945050505061087c60a089016107d0565b905092959891949750929550565b60006020828403121561089c57600080fd5b81356108a7816107b8565b9392505050565b6000602082840312156108c057600080fd5b5035919050565b60018060a01b038316815260006020604081840152835180604085015260005b81811015610903578581018301518582016060015282016108e7565b81811115610915576000606083870101525b50601f01601f191692909201606001949350505050565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006109c960208301848661098c565b949350505050565b6000602082840312156109e357600080fd5b5051919050565b838152604060208201526000610a0460408301848661098c565b9594505050505056fea2646970667358221220e7dca6bd4df7f5f6dafa874c8f411cd92054731fefd5309ddf74a2854e21243064736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100a75760003560e01c8063c5ffcf7011610064578063c5ffcf70146101ad578063c95c0951146101cd578063cddbfa14146101fa578063e7fe313914610254578063ea4f97d314610274578063fc4ba3a2146102a857600080fd5b80630c340a24146100ac578063311a6c56146100e95780633b103f531461010b5780636cc6cde11461011e5780638ed87e0014610152578063ba4bc76314610172575b600080fd5b3480156100b857600080fd5b506000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100f557600080fd5b50610109610104366004610796565b6102d5565b005b6101096101193660046107e0565b610430565b34801561012a57600080fd5b506100cc7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015e57600080fd5b5061010961016d36600461088a565b61070f565b34801561017e57600080fd5b5061019f61018d3660046108ae565b60036020526000908152604090205481565b6040519081526020016100e0565b3480156101b957600080fd5b506002546100cc906001600160a01b031681565b3480156101d957600080fd5b5061019f6101e83660046108ae565b60046020526000908152604090205481565b34801561020657600080fd5b506102376102153660046108ae565b600560205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016100e0565b34801561026057600080fd5b506001546100cc906001600160a01b031681565b34801561028057600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102b457600080fd5b5061019f6102c33660046108ae565b60009081526004602052604090205490565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103445760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b60448201526064015b60405180910390fd5b600082815260036020908152604080832054808452600583529281902081518083018352815481526001918201546001600160a01b039081168286018190528451602481018890526044810189905260648082019290925285518082039092018252608401855294850180516001600160e01b031663a60a4db560e01b9081179091529254600254945163263b083b60e21b815292959394908216926398ec20ec926103f692169085906004016108c7565b600060405180830381600087803b15801561041057600080fd5b505af1158015610424573d6000803e3d6000fd5b50505050505050505050565b60008787878787878760405160200161044f979695949392919061092c565b60408051601f1981840301815291815281516020928301206000818152600590935291206001810154919250906001600160a01b0316156104d25760405162461bcd60e51b815260206004820152601760248201527f4469737075746520616c72656164792072656c61796564000000000000000000604482015260640161033b565b60405163f7434ea960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f7434ea99061052090889088906004016109b5565b60206040518083038186803b15801561053857600080fd5b505afa15801561054c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057091906109d1565b8082553410156105c25760405162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f756768206172626974726174696f6e20636f73742070616964604482015260640161033b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c13517e1348989896040518563ffffffff1660e01b8152600401610615939291906109ea565b6020604051808303818588803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061066791906109d1565b6000818152600360209081526040808320879055868352600482528083208490556001860180546001600160a01b0319163317905580518381529182019290925291925082917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350505050505050505050565b6000546001600160a01b031633146107745760405162461bcd60e51b815260206004820152602260248201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6044820152613c9760f11b606482015260840161033b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080604083850312156107a957600080fd5b50508035926020909101359150565b6001600160a01b03811681146107cd57600080fd5b50565b80356107db816107b8565b919050565b600080600080600080600060c0888a0312156107fb57600080fd5b87359650602088013595506040880135945060608801359350608088013567ffffffffffffffff8082111561082f57600080fd5b818a0191508a601f83011261084357600080fd5b81358181111561085257600080fd5b8b602082850101111561086457600080fd5b60208301955080945050505061087c60a089016107d0565b905092959891949750929550565b60006020828403121561089c57600080fd5b81356108a7816107b8565b9392505050565b6000602082840312156108c057600080fd5b5035919050565b60018060a01b038316815260006020604081840152835180604085015260005b81811015610903578581018301518582016060015282016108e7565b81811115610915576000606083870101525b50601f01601f191692909201606001949350505050565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006109c960208301848661098c565b949350505050565b6000602082840312156109e357600080fd5b5051919050565b838152604060208201526000610a0460408301848661098c565b9594505050505056fea2646970667358221220e7dca6bd4df7f5f6dafa874c8f411cd92054731fefd5309ddf74a2854e21243064736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "changeFastbridge(address)": { + "details": "Changes the fastBridge, useful to increase the claim deposit.", + "params": { + "_fastBridgeSender": "The address of the new fastBridge." + } + }, + "relayCreateDispute(uint256,bytes32,uint256,uint256,bytes,address)": { + "details": "Provide the same parameters as on the originalChain while creating a dispute. Providing incorrect parameters will create a different hash than on the originalChain and will not affect the actual dispute/arbitrable's ruling.", + "params": { + "_arbitrable": "arbitrable", + "_choices": "number of ruling choices", + "_extraData": "extraData", + "_originalBlockHash": "originalBlockHash", + "_originalChainID": "originalChainId", + "_originalDisputeID": "originalDisputeID" + } + }, + "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": 22235, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 22241, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "fastBridgeSender", + "offset": 0, + "slot": "1", + "type": "t_contract(IFastBridgeSender)16804" + }, + { + "astId": 22244, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "receiverGateway", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 22251, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "disputeIDtoHash", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_bytes32)" + }, + { + "astId": 22255, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "disputeHashtoID", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 22260, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "disputeHashtoRelayedData", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_bytes32,t_struct(RelayedData)22233_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IFastBridgeSender)16804": { + "encoding": "inplace", + "label": "contract IFastBridgeSender", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_struct(RelayedData)22233_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct HomeGateway.RelayedData)", + "numberOfBytes": "32", + "value": "t_struct(RelayedData)22233_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)22233_storage": { + "encoding": "inplace", + "label": "struct HomeGateway.RelayedData", + "members": [ + { + "astId": 22230, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "arbitrationCost", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 22232, + "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/IncrementalNG.json b/contracts/deployments/arbitrumGoerli/IncrementalNG.json new file mode 100644 index 000000000..a9735b579 --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/IncrementalNG.json @@ -0,0 +1,177 @@ +{ + "address": "0x99c1f883f0f5de1737099F1BCB268d1f8D450f8b", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_start", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_block", + "type": "uint256" + } + ], + "name": "contribute", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_block", + "type": "uint256" + } + ], + "name": "getRN", + "outputs": [ + { + "internalType": "uint256", + "name": "RN", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_block", + "type": "uint256" + } + ], + "name": "getUncorrelatedRN", + "outputs": [ + { + "internalType": "uint256", + "name": "RN", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "number", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_block", + "type": "uint256" + } + ], + "name": "requestRN", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ], + "transactionHash": "0x9fbf29ef1288d656276fdcf0a57532886bab09682059470b4314060f4ffdc74b", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x99c1f883f0f5de1737099F1BCB268d1f8D450f8b", + "transactionIndex": 1, + "gasUsed": "159448", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x278be5d4c47ef4c29f37eea46010e6e72f6c7ff623155ec61fd1a6da5cf4ec7d", + "transactionHash": "0x9fbf29ef1288d656276fdcf0a57532886bab09682059470b4314060f4ffdc74b", + "logs": [], + "blockNumber": 92257, + "cumulativeGasUsed": "159448", + "status": 1, + "byzantium": true + }, + "args": [ + 67193503189 + ], + "numDeployments": 1, + "solcInputHash": "5fd7985a85ea36ff278713e62f7ea890", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_start\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"contribute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"getRN\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"RN\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"getUncorrelatedRN\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"RN\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"number\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"requestRN\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"contribute(uint256)\":{\"details\":\"Contribute to the reward of a random number. All the ETH will be lost forever.\",\"params\":{\"_block\":\"Block the random number is linked to.\"}},\"getRN(uint256)\":{\"details\":\"Get the \\\"random number\\\", which is predictable.\",\"params\":{\"_block\":\"Block the random number is linked to.\"},\"returns\":{\"RN\":\"Random Number. If the number is not ready or has not been required 0 instead.\"}},\"getUncorrelatedRN(uint256)\":{\"details\":\"Get a uncorrelated random number. Act like getRN but give a different number for each sender. This is to prevent users from getting correlated numbers.\",\"params\":{\"_block\":\"Block the random number is linked to.\"},\"returns\":{\"RN\":\"Random Number. If the number is not ready or has not been required 0 instead.\"}},\"requestRN(uint256)\":{\"details\":\"Request a random number.\",\"params\":{\"_block\":\"Block linked to the request.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/rng/IncrementalNG.sol\":\"IncrementalNG\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/rng/IncrementalNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @title Incremental Number Generator\\n * @author JayBuidl \\n * @dev A Random Number Generator which returns a number incremented by 1 each time. Useful as a fallback method.\\n */\\n\\npragma solidity ^0.8;\\nimport \\\"./RNG.sol\\\";\\n\\ncontract IncrementalNG is RNG {\\n uint256 public number;\\n\\n constructor(uint256 _start) {\\n number = _start;\\n }\\n\\n /**\\n * @dev Contribute to the reward of a random number. All the ETH will be lost forever.\\n * @param _block Block the random number is linked to.\\n */\\n function contribute(uint256 _block) public payable override {\\n /* NOP */\\n }\\n\\n /**\\n * @dev Get the \\\"random number\\\", which is predictable.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getRN(uint256 _block) public override returns (uint256 RN) {\\n unchecked {\\n return number++;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x14be6938f8c6600fc8e5e6b3e76f9f3b0ef22e1263109f7e704e5f02979fd605\",\"license\":\"MIT\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@clesaege]\\n * @reviewers: [@remedcu]\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title Random Number Generator Standard\\n * @author Cl\\u00e9ment Lesaege - \\n * @dev This is an abstract contract\\n */\\nabstract contract RNG {\\n /**\\n * @dev Contribute to the reward of a random number.\\n * @param _block Block the random number is linked to.\\n */\\n function contribute(uint256 _block) public payable virtual;\\n\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRN(uint256 _block) public payable {\\n contribute(_block);\\n }\\n\\n /**\\n * @dev Get the random number.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getRN(uint256 _block) public virtual returns (uint256 RN);\\n\\n /**\\n * @dev Get a uncorrelated random number. Act like getRN but give a different number for each sender.\\n * This is to prevent users from getting correlated numbers.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getUncorrelatedRN(uint256 _block) public returns (uint256 RN) {\\n uint256 baseRN = getRN(_block);\\n if (baseRN == 0) return 0;\\n else return uint256(keccak256(abi.encode(msg.sender, baseRN)));\\n }\\n}\\n\",\"keccak256\":\"0x854bcb147fe44383cba7a5fdbcb69b3c0a9a71435c80eb73c172222da472a855\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516101df3803806101df83398101604081905261002f91610037565b600055610050565b60006020828403121561004957600080fd5b5051919050565b6101808061005f6000396000f3fe60806040526004361061004a5760003560e01c80631c73601e1461004f5780637b9c34e0146100815780638381f58a14610096578063c1cbbca7146100ac578063ca4742f1146100bd575b600080fd5b34801561005b57600080fd5b5061006f61006a366004610131565b6100e7565b60405190815260200160405180910390f35b61009461008f366004610131565b6100ba565b005b3480156100a257600080fd5b5061006f60005481565b6100946100ba366004610131565b50565b3480156100c957600080fd5b5061006f6100d8366004610131565b50600080546001810190915590565b60008054600181018255806100ff5750600092915050565b6040805133602082015290810182905260600160408051601f1981840301815291905280516020909101209392505050565b60006020828403121561014357600080fd5b503591905056fea264697066735822122022ad28fe2b2684e8b3818ef53b92c7942e24f5b3746f478b031e2fa17fd10ae864736f6c63430008090033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c80631c73601e1461004f5780637b9c34e0146100815780638381f58a14610096578063c1cbbca7146100ac578063ca4742f1146100bd575b600080fd5b34801561005b57600080fd5b5061006f61006a366004610131565b6100e7565b60405190815260200160405180910390f35b61009461008f366004610131565b6100ba565b005b3480156100a257600080fd5b5061006f60005481565b6100946100ba366004610131565b50565b3480156100c957600080fd5b5061006f6100d8366004610131565b50600080546001810190915590565b60008054600181018255806100ff5750600092915050565b6040805133602082015290810182905260600160408051601f1981840301815291905280516020909101209392505050565b60006020828403121561014357600080fd5b503591905056fea264697066735822122022ad28fe2b2684e8b3818ef53b92c7942e24f5b3746f478b031e2fa17fd10ae864736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "contribute(uint256)": { + "details": "Contribute to the reward of a random number. All the ETH will be lost forever.", + "params": { + "_block": "Block the random number is linked to." + } + }, + "getRN(uint256)": { + "details": "Get the \"random number\", which is predictable.", + "params": { + "_block": "Block the random number is linked to." + }, + "returns": { + "RN": "Random Number. If the number is not ready or has not been required 0 instead." + } + }, + "getUncorrelatedRN(uint256)": { + "details": "Get a uncorrelated random number. Act like getRN but give a different number for each sender. This is to prevent users from getting correlated numbers.", + "params": { + "_block": "Block the random number is linked to." + }, + "returns": { + "RN": "Random Number. If the number is not ready or has not been required 0 instead." + } + }, + "requestRN(uint256)": { + "details": "Request a random number.", + "params": { + "_block": "Block linked to the request." + } + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 24350, + "contract": "src/rng/IncrementalNG.sol:IncrementalNG", + "label": "number", + "offset": 0, + "slot": "0", + "type": "t_uint256" + } + ], + "types": { + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerli/KlerosCore.json b/contracts/deployments/arbitrumGoerli/KlerosCore.json new file mode 100644 index 000000000..bac9d65a9 --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/KlerosCore.json @@ -0,0 +1,2699 @@ +{ + "address": "0x87142b7E9C7D026776499120D902AF8896C07894", + "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": "_disputeID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_roundID", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint96", + "name": "_fromSubcourtID", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "_toSubcourtID", + "type": "uint96" + } + ], + "name": "CourtJump", + "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": "_subcourtID", + "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": "_subcourtID", + "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": "uint256", + "name": "_subcourtID", + "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": "SubcourtCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "string", + "name": "_param", + "type": "string" + } + ], + "name": "SubcourtModified", + "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": "address payable", + "name": "_governor", + "type": "address" + } + ], + "name": "changeGovernor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_subcourtID", + "type": "uint96" + }, + { + "internalType": "bool", + "name": "_hiddenVotes", + "type": "bool" + } + ], + "name": "changeHiddenVotes", + "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": "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": "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" + }, + { + "internalType": "uint256[]", + "name": "_supportedDisputeKits", + "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": [], + "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": "subcourtID", + "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": "subcourtID", + "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": "_subcourtID", + "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": "_subcourtID", + "type": "uint96" + } + ], + "name": "getJurorBalance", + "outputs": [ + { + "internalType": "uint256", + "name": "staked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "locked", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_disputeID", + "type": "uint256" + } + ], + "name": "getLastRoundResult", + "outputs": [ + { + "internalType": "uint256", + "name": "winningChoice", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "tied", + "type": "bool" + } + ], + "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": "_subcourtID", + "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": "_subcourtID", + "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": "_subcourtID", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_stake", + "type": "uint256" + } + ], + "name": "setStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x8c8bea12fe97af57a6e19d35c42c6de667e81de195721df6e0260403ef0b3a79", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x87142b7E9C7D026776499120D902AF8896C07894", + "transactionIndex": 1, + "gasUsed": "5827557", + "logsBloom": "0x40000000000000000000000000000000000000000000000000000000020000000000000000000000100000000000000000000000100000000000000000040000000000000000000000000000000000000000000000040000000000000000000000000000020000000000000000000800400000000008000000000000000000000000000000000000004000000000040000000000000000000000000000000000080000000000000000000000000000000000010000000000000000000000000000000008000000000000000000000000000000000000000000000000000060000000003000001000000000000000800000000000000000000000000000000000", + "blockHash": "0x9f168da76449a182ba1befdf8868bf959e81082a1f6628bc278ceadeada23f1d", + "transactionHash": "0x8c8bea12fe97af57a6e19d35c42c6de667e81de195721df6e0260403ef0b3a79", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 133630, + "transactionHash": "0x8c8bea12fe97af57a6e19d35c42c6de667e81de195721df6e0260403ef0b3a79", + "address": "0x87142b7E9C7D026776499120D902AF8896C07894", + "topics": [ + "0x7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000008f1a2b8f9b04320375856580fc6b1669cb12a9ee", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x9f168da76449a182ba1befdf8868bf959e81082a1f6628bc278ceadeada23f1d" + }, + { + "transactionIndex": 1, + "blockNumber": 133630, + "transactionHash": "0x8c8bea12fe97af57a6e19d35c42c6de667e81de195721df6e0260403ef0b3a79", + "address": "0x87142b7E9C7D026776499120D902AF8896C07894", + "topics": [ + "0x2e689e2ae8e3c8e02797c3ff9998e8297e587a74bc6d0e48b6b5991f70991d1c", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad78ebc5ac62000000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000", + "logIndex": 1, + "blockHash": "0x9f168da76449a182ba1befdf8868bf959e81082a1f6628bc278ceadeada23f1d" + }, + { + "transactionIndex": 1, + "blockNumber": 133630, + "transactionHash": "0x8c8bea12fe97af57a6e19d35c42c6de667e81de195721df6e0260403ef0b3a79", + "address": "0x87142b7E9C7D026776499120D902AF8896C07894", + "topics": [ + "0xb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc79", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0x9f168da76449a182ba1befdf8868bf959e81082a1f6628bc278ceadeada23f1d" + } + ], + "blockNumber": 133630, + "cumulativeGasUsed": "5827557", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610", + "0x0000000000000000000000000000000000000000", + "0x8F1a2B8F9b04320375856580Fc6B1669Cb12a9EE", + [ + 120, + 120 + ], + false, + [ + "200000000000000000000", + 10000, + "100000000000000000", + 3 + ], + [ + 0, + 0, + 0, + 0 + ], + 3 + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_fromSubcourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"_toSubcourtID\",\"type\":\"uint96\"}],\"name\":\"CourtJump\",\"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\":\"_subcourtID\",\"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\":\"_subcourtID\",\"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\":\"uint256\",\"name\":\"_subcourtID\",\"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\":\"SubcourtCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_param\",\"type\":\"string\"}],\"name\":\"SubcourtModified\",\"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\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"}],\"name\":\"changeHiddenVotes\",\"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\":\"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\":\"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\"},{\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"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\":[],\"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\":\"subcourtID\",\"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\":\"subcourtID\",\"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\":\"_subcourtID\",\"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\":\"_subcourtID\",\"type\":\"uint96\"}],\"name\":\"getJurorBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"staked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"locked\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getLastRoundResult\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"}],\"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\":\"_subcourtID\",\"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\":\"_subcourtID\",\"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\":\"_subcourtID\",\"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 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 arbitration cost.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeHiddenVotes(uint96,bool)\":{\"details\":\"Changes the `hiddenVotes` property value of a specified subcourt.\",\"params\":{\"_hiddenVotes\":\"The new value for the `hiddenVotes` property value.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"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.\"}},\"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.\"}},\"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.\"}},\"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 subcourt (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.\"}},\"createSubcourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256,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.\",\"_supportedDisputeKits\":\"Indexes of dispute kits that this subcourt will support.\",\"_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.\"}},\"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\":{\"_disputeKitIDs\":\"The IDs of dispute kits which support should be added/removed.\",\"_enable\":\"Whether add or remove the dispute kits from the subcourt.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"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\":{\"_subcourtID\":\"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 subcourt.\",\"params\":{\"_stake\":\"The new stake.\",\"_subcourtID\":\"The ID of the subcourt.\"}}},\"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\":200},\"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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling);\\n\\n /** @dev Returns the voting data from the most relevant round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @return winningChoice The winning choice of this round.\\n * @return tied Whether it's a tie or not.\\n */\\n function getLastRoundResult(uint256 _coreDisputeID) external view returns (uint256 winningChoice, bool tied);\\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(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) 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 )\\n external\\n view\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n );\\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\":\"0x235f027aa27fa972c56d863cfbc33832c8100135cf32d6827294de138e97dd44\",\"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 subcourtID; // The ID of the subcourt 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[] subcourtIDs; // The IDs of subcourts 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 subcourt in the form `stakedTokens[subcourtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the subcourt in the form `lockedTokens[subcourtID]`.\\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 subcourtID; // The ID of the subcourt.\\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 subcourts.\\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 _subcourtID, 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 SubcourtCreated(\\n uint256 indexed _subcourtID,\\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 SubcourtModified(uint96 indexed _subcourtID, string _param);\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _subcourtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromSubcourtID,\\n uint96 _toSubcourtID\\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 SubcourtCreated.\\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 SubcourtCreated(\\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 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 * @param _supportedDisputeKits Indexes of dispute kits that this subcourt will support.\\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 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 subcourtID = 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(subcourtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(subcourtID);\\n emit SubcourtCreated(\\n subcourtID,\\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 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(\\n _subcourtID == GENERAL_COURT || courts[courts[_subcourtID].parent].minStake <= _minStake,\\n \\\"MinStake lower than parent court\\\"\\n );\\n for (uint256 i = 0; i < courts[_subcourtID].children.length; i++) {\\n require(courts[courts[_subcourtID].children[i]].minStake >= _minStake, \\\"MinStake lower than parent court\\\");\\n }\\n\\n courts[_subcourtID].minStake = _minStake;\\n emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeHiddenVotes(uint96 _subcourtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_subcourtID].hiddenVotes = _hiddenVotes;\\n emit SubcourtModified(_subcourtID, \\\"hiddenVotes\\\");\\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(uint96 _subcourtID, uint256[4] memory _timesPerPeriod)\\n external\\n onlyByGovernor\\n {\\n courts[_subcourtID].timesPerPeriod = _timesPerPeriod;\\n emit SubcourtModified(_subcourtID, \\\"timesPerPeriod\\\");\\n }\\n\\n /** @dev Adds/removes court's support for specified dispute kits.\\n * @param _subcourtID The ID of the subcourt.\\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 subcourt.\\n */\\n function enableDisputeKits(\\n uint96 _subcourtID,\\n uint256[] memory _disputeKitIDs,\\n bool _enable\\n ) external onlyByGovernor {\\n Court storage subcourt = courts[_subcourtID];\\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(_subcourtID, _disputeKitIDs[i], true);\\n } else {\\n require(\\n !(_subcourtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't disable Root DK in General\\\"\\n );\\n enableDisputeKit(_subcourtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\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, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _subcourtID, _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.subcourtID, 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 subcourt (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(uint256 _numberOfChoices, bytes memory _extraData)\\n external\\n payable\\n override\\n returns (uint256 disputeID)\\n {\\n require(msg.value >= arbitrationCost(_extraData), \\\"ETH too low for arbitration cost\\\");\\n\\n (uint96 subcourtID, , uint256 disputeKitID) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n require(courts[subcourtID].supportedDisputeKits[disputeKitID], \\\"DK unsupported by subcourt\\\");\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.subcourtID = subcourtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.subcourtID];\\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.subcourtID];\\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.subcourtID] += round.tokensAtStakePerJuror;\\n round.drawnJurors.push(drawnAddress);\\n emit Draw(drawnAddress, _disputeID, currentRound, i);\\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(\\n uint256 _disputeID,\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) 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 newSubcourtID = dispute.subcourtID;\\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[newDisputeKitID].jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n newSubcourtID = courts[newSubcourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newSubcourtID].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 newSubcourtID = courts[newSubcourtID].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[newSubcourtID].supportedDisputeKits[newDisputeKitID]) {\\n newSubcourtID = GENERAL_COURT;\\n }\\n\\n if (newSubcourtID != dispute.subcourtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.subcourtID, newSubcourtID);\\n }\\n }\\n\\n dispute.subcourtID = newSubcourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newSubcourtID];\\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(\\n uint256 _disputeID,\\n uint256 _round,\\n uint256 _iterations\\n ) 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.subcourtID] -= 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.subcourtID] >= courts[dispute.subcourtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.subcourtID] - penalty;\\n setStakeForAccount(account, dispute.subcourtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.subcourtID] != 0) {\\n setStakeForAccount(account, dispute.subcourtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n for (uint256 j = 0; j < jurors[account].subcourtIDs.length; j++) {\\n setStakeForAccount(account, jurors[account].subcourtIDs[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.subcourtID] -=\\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.subcourtID] == 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 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)\\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 subcourtID, uint256 minJurors, ) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[subcourtID].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.subcourtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n if (dispute.subcourtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent subcourt.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current subcourt.\\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.subcourtID].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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n return disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round)\\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 _subcourtID)\\n external\\n view\\n returns (uint256 staked, uint256 locked)\\n {\\n staked = jurors[_juror].stakedTokens[_subcourtID];\\n locked = jurors[_juror].lockedTokens[_subcourtID];\\n }\\n\\n function isSupported(uint96 _subcourtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_subcourtID].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 _subcourtID 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 _subcourtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_subcourtID];\\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(bytes32 _key, uint256 _nodeIndex)\\n public\\n view\\n returns (\\n uint256 K,\\n uint256 length,\\n bytes32 ID\\n )\\n {\\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.subcourtID];\\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 getLastRoundResult(uint256 _disputeID) external view returns (uint256 winningChoice, bool tied) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (winningChoice, tied) = disputeKitNodes[round.disputeKitID].disputeKit.getLastRoundResult(_disputeID);\\n }\\n\\n function getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function enableDisputeKit(\\n uint96 _subcourtID,\\n uint256 _disputeKitID,\\n bool _enable\\n ) internal {\\n courts[_subcourtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_subcourtID, _disputeKitID, _enable);\\n }\\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 * @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 _subcourtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_subcourtID == FORKING_COURT || _subcourtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_subcourtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_subcourtID].minStake || _stake < juror.lockedTokens[_subcourtID]) return false;\\n if (currentStake == 0 && juror.subcourtIDs.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 subcourtID: _subcourtID,\\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.subcourtIDs.push(_subcourtID);\\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[_subcourtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\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 }\\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[_subcourtID] - currentStake + _stake;\\n juror.stakedTokens[_subcourtID] = newTotalStake;\\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 == GENERAL_COURT) finished = true;\\n else currentSubcourtID = courts[currentSubcourtID].parent;\\n }\\n\\n emit StakeSet(_account, _subcourtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a subcourt 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 subcourt ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return subcourtID The subcourt ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\n function extraDataToSubcourtIDMinJurorsDisputeKit(bytes memory _extraData)\\n internal\\n view\\n returns (\\n uint96 subcourtID,\\n uint256 minJurors,\\n uint256 disputeKitID\\n )\\n {\\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 subcourtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (subcourtID == FORKING_COURT || subcourtID >= courts.length) {\\n subcourtID = 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 subcourtID = GENERAL_COURT;\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n /** @dev Packs an account and a subcourt ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _subcourtID The subcourt ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndSubcourtIDToStakePathID(address _account, uint96 _subcourtID)\\n internal\\n pure\\n returns (bytes32 stakePathID)\\n {\\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 /** @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(\\n address _from,\\n address _to,\\n uint256 _value\\n ) 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\":\"0xd8593fcedfc04eba288fded13f7ccdfe51224d65b75117bad4baee156037949f\",\"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": "0x60806040526001600f553480156200001657600080fd5b5060405162006780380380620067808339810160408190526200003991620005d3565b600080546001600160a01b038b81166001600160a01b0319928316178355600180548c831690841617815560028054928c1692909316919091179091558651600355602080880151600455426005556008805490920182558183526040805160a08101825284815281518581528084019092529293918301915081526001600160a01b0389166020808301919091526000604083018190526060909201829052835460018181018655948352918190208351600490930201918255828101518051939492936200011193850192919091019062000458565b5060408281015160028301805460608601511515600160a01b026001600160a81b03199091166001600160a01b0393841617179055608090930151600390920191909155516000918816906001907f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498908490a4600780546001018155600090815260405163483abc4f60e11b8152600c60048201526024810191909152604481018290527326858D60FE92b50b34e236B46874e0272434427590639075789e9060640160006040518083038186803b158015620001ed57600080fd5b505af415801562000202573d6000803e3d6000fd5b5050600780546001810182556000918252600b027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160601b0319168155604080518381526020810190915290935091505080516200027291600184019160209091019062000458565b50805460ff60601b19166c01000000000000000000000000861515021781558351600282015560208401516003820155604084015160048083019190915560608501516005830155620002cc9060068301908590620004a8565b5060405163483abc4f60e11b8152600c600482015260016024820152604481018390527326858D60FE92b50b34e236B46874e0272434427590639075789e9060640160006040518083038186803b1580156200032757600080fd5b505af41580156200033c573d6000803e3d6000fd5b5050825486516020808901516040808b015160608c0151825160008152948501928390526001600160601b039096169750600196507f2e689e2ae8e3c8e02797c3ff9998e8297e587a74bc6d0e48b6b5991f70991d1c95620003a7958e959094938d918d91620006eb565b60405180910390a3620003bd60018080620003cd565b5050505050505050505062000790565b806007846001600160601b031681548110620003ed57620003ed620006d5565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b82805482825590600052602060002090810192821562000496579160200282015b828111156200049657825182559160200191906001019062000479565b50620004a4929150620004d8565b5090565b82600481019282156200049657916020028201828111156200049657825182559160200191906001019062000479565b5b80821115620004a45760008155600101620004d9565b6001600160a01b03811681146200050557600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b038111828210171562000543576200054362000508565b60405290565b805180151581146200055a57600080fd5b919050565b600082601f8301126200057157600080fd5b604051608081016001600160401b038111828210171562000596576200059662000508565b604052806080840185811115620005ac57600080fd5b845b81811015620005c8578051835260209283019201620005ae565b509195945050505050565b60008060008060008060008060006102008a8c031215620005f357600080fd5b89516200060081620004ef565b809950506020808b01516200061581620004ef565b60408c01519099506200062881620004ef565b60608c01519098506200063b81620004ef565b9650609f8b018c136200064d57600080fd5b620006576200051e565b8060c08d018e8111156200066a57600080fd5b60808e015b818110156200068857805184529284019284016200066f565b50819850620006978162000549565b975050505050620006ac8b60e08c016200055f565b9250620006be8b6101608c016200055f565b91506101e08a015190509295985092959850929598565b634e487b7160e01b600052603260045260246000fd5b60006101608083018b1515845260208b818601528a604086015289606086015288608086015260a085018860005b6004811015620007385781518352918301919083019060010162000719565b50505061012085018790526101408501929092528451908190526101808401918086019160005b818110156200077d578351855293820193928201926001016200075f565b50929d9c50505050505050505050505050565b615fe080620007a06000396000f3fe6080604052600436106103cd5760003560e01c8063823cfd70116101fd578063c13517e111610118578063e4c0aaf4116100ab578063f7434ea91161007a578063f7434ea914610c99578063f8bdb57b14610cb9578063fbf405b014610cd9578063fc6f8f1614610cf9578063fe524c3914610d1957600080fd5b8063e4c0aaf414610bbb578063eaff425a14610bdb578063f12ada8b14610bf0578063f6b4d82d14610c1057600080fd5b8063cf0c38f8116100e7578063cf0c38f814610b08578063d1c1df4814610b28578063d2b8035a14610b86578063d8b03fd814610ba657600080fd5b8063c13517e114610aa2578063c258bb1914610ab5578063c356990214610ad5578063c71f425314610ae857600080fd5b8063b1c9fe6e11610190578063b70c4e941161015f578063b70c4e94146109fd578063b888adfa14610a12578063bfabfe8f14610a28578063c057eca714610a8c57600080fd5b8063b1c9fe6e14610984578063b2866af7146109b2578063b31b4540146109d2578063b4a61608146109e857600080fd5b80638edf4741116101cc5780638edf4741146108da5780639b05c261146108fa578063a57366e71461092f578063afe15cfb1461094f57600080fd5b8063823cfd701461084d578063840bc19c1461086d5780638a9bb02a146108885780638bb04875146108ba57600080fd5b806334d5fb31116102ed57806357260364116102805780636235593f1161024f5780636235593f146107e35780636c1eb1b9146107f8578063751accd01461080d5780637717a6e81461082d57600080fd5b8063572603641461076357806359354c771461078357806359ec827e146107a35780635bc24dd3146107c357600080fd5b80633e1d09be116102bc5780633e1d09be146106cf57806343d4137f146106ef578063564a565d1461071c57806356acb0501461074d57600080fd5b806334d5fb311461065757806335975f4a1461066c5780633a1578601461068c5780633cfd1184146106a257600080fd5b806319b81529116103655780632922d604116103345780632922d604146105e15780632b6a63f1146106015780632d29a47b146106215780632ea7b4d01461064157600080fd5b806319b815291461050d5780631c3db16d1461053d5780631f5a0dd21461055d57806327e6ec8a146105b457600080fd5b80630d1b9d1a116103a15780630d1b9d1a146104665780630d83b940146104b45780630e083ec9146104d7578063115d5376146104ed57600080fd5b8062f5822c146103d25780630b274f2e146103f45780630b7414bc146104095780630c340a2414610429575b600080fd5b3480156103de57600080fd5b506103f26103ed36600461557c565b610d39565b005b34801561040057600080fd5b506103f2610d8e565b34801561041557600080fd5b506103f2610424366004615691565b61137a565b34801561043557600080fd5b50600054610449906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561047257600080fd5b506104866104813660046156f3565b611571565b604080519485526001600160a01b03909316602085015290151591830191909152606082015260800161045d565b3480156104c057600080fd5b506104c9600181565b60405190815260200161045d565b3480156104e357600080fd5b506104c9600e5481565b3480156104f957600080fd5b506103f26105083660046156f3565b6115ba565b34801561051957600080fd5b5061052d6105283660046156f3565b611c24565b604051901515815260200161045d565b34801561054957600080fd5b506104c96105583660046156f3565b611d1b565b34801561056957600080fd5b5061057d6105783660046156f3565b611e26565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c00161045d565b3480156105c057600080fd5b506105c9600081565b6040516001600160601b03909116815260200161045d565b3480156105ed57600080fd5b506104c96105fc36600461570c565b611e7d565b34801561060d57600080fd5b506103f261061c36600461579c565b611eb4565b34801561062d57600080fd5b506103f261063c366004615840565b612272565b34801561064d57600080fd5b506104c961271081565b34801561066357600080fd5b506105c9600181565b34801561067857600080fd5b506103f26106873660046156f3565b612b1d565b34801561069857600080fd5b506104c960065481565b3480156106ae57600080fd5b506106c26106bd36600461586c565b612c5a565b60405161045d91906158aa565b3480156106db57600080fd5b506103f26106ea3660046158b8565b612ccb565b3480156106fb57600080fd5b5061070f61070a3660046156f3565b612edd565b60405161045d919061591d565b34801561072857600080fd5b5061073c6107373660046156f3565b612f59565b60405161045d95949392919061595a565b34801561075957600080fd5b506104c9600f5481565b34801561076f57600080fd5b506103f261077e366004615999565b612fb5565b34801561078f57600080fd5b506103f261079e3660046158b8565b613064565b3480156107af57600080fd5b506104c96107be3660046156f3565b613105565b3480156107cf57600080fd5b506103f26107de3660046158b8565b613255565b3480156107ef57600080fd5b506104c9600081565b34801561080457600080fd5b506104c9600a81565b34801561081957600080fd5b506103f2610828366004615a3d565b6132f0565b34801561083957600080fd5b506103f26108483660046158b8565b6133c2565b34801561085957600080fd5b506103f26108683660046156f3565b613410565b34801561087957600080fd5b506104c96001600160ff1b0381565b34801561089457600080fd5b506108a86108a336600461570c565b61343f565b60405161045d96959493929190615a96565b3480156108c657600080fd5b506103f26108d53660046156f3565b61351f565b3480156108e657600080fd5b506104c96108f53660046156f3565b613688565b34801561090657600080fd5b5061091a6109153660046156f3565b6136a9565b6040805192835290151560208301520161045d565b34801561093b57600080fd5b506103f261094a3660046158b8565b6137b3565b34801561095b57600080fd5b5061096f61096a3660046156f3565b61385b565b6040805192835260208301919091520161045d565b34801561099057600080fd5b506002546109a590600160a01b900460ff1681565b60405161045d9190615b0b565b3480156109be57600080fd5b506103f26109cd3660046156f3565b613908565b3480156109de57600080fd5b506104c960045481565b3480156109f457600080fd5b506104c9600481565b348015610a0957600080fd5b5061052d613937565b348015610a1e57600080fd5b506104c960055481565b348015610a3457600080fd5b50610a71610a4336600461570c565b6000918252600c60209081526040808420805460028201549486526004909101909252909220549192909190565b6040805193845260208401929092529082015260600161045d565b348015610a9857600080fd5b506104c960035481565b6104c9610ab0366004615b25565b613979565b348015610ac157600080fd5b506103f2610ad036600461557c565b613cfb565b6103f2610ae3366004615b6c565b613d47565b348015610af457600080fd5b506104c9610b033660046156f3565b6143ca565b348015610b1457600080fd5b50600254610449906001600160a01b031681565b348015610b3457600080fd5b5061096f610b43366004615ba6565b6001600160a01b03919091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610b9257600080fd5b506103f2610ba136600461570c565b614432565b348015610bb257600080fd5b5061070f614725565b348015610bc757600080fd5b506103f2610bd636600461557c565b61477d565b348015610be757600080fd5b506104c9600381565b348015610bfc57600080fd5b506103f2610c0b366004615bd2565b6147c9565b348015610c1c57600080fd5b50610c67610c2b3660046156f3565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b03909316602085015291830152606082015260800161045d565b348015610ca557600080fd5b506104c9610cb4366004615bf0565b614a22565b348015610cc557600080fd5b506103f2610cd4366004615c25565b614a76565b348015610ce557600080fd5b50600154610449906001600160a01b031681565b348015610d0557600080fd5b506104c9610d143660046156f3565b614b2a565b348015610d2557600080fd5b5061052d610d343660046158b8565b614b59565b6000546001600160a01b03163314610d6c5760405162461bcd60e51b8152600401610d6390615c5c565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610dae57610dae615930565b1415610e7457600354600554610dc49042615c99565b1015610e125760405162461bcd60e51b815260206004820152601960248201527f4d696e5374616b696e6754696d65206e6f7420706173736564000000000000006044820152606401610d63565b600954610e585760405162461bcd60e51b81526020600482015260146024820152734e6f20444b206e6565647320667265657a696e6760601b6044820152606401610d63565b6002805460ff60a01b1916600160a01b1790554360065561132f565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b158015610eaf57600080fd5b505afa158015610ec3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee79190615cb0565b600954909150600090610efc90600190615ccd565b90505b6000811261131f57600060098281548110610f1c57610f1c615d0c565b906000526020600020015490506000600860098481548110610f4057610f40615d0c565b906000526020600020015481548110610f5b57610f5b615d0c565b60009182526020909120600260049092020101546001600160a01b03169050838015610ff55750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b158015610fbb57600080fd5b505afa158015610fcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff39190615cb0565b155b1561110f57806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561103557600080fd5b505af1158015611049573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561108657600080fd5b505afa15801561109a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110be9190615cb0565b61110a5760405162461bcd60e51b815260206004820152601e60248201527f536f6d6520444b206e6f7420696e205265736f6c76696e6720706861736500006044820152606401610d63565b61130c565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561114857600080fd5b505afa15801561115c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111809190615cb0565b6111cc5760405162461bcd60e51b815260206004820152601e60248201527f536f6d6520444b206e6f7420696e205265736f6c76696e6720706861736500006044820152606401610d63565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561120557600080fd5b505afa158015611219573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123d9190615d22565b61130c5760006008838154811061125657611256615d0c565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b1990921691909117905560095461129290600190615ccd565b8312156112e457600980546112a990600190615c99565b815481106112b9576112b9615d0c565b9060005260206000200154600984815481106112d7576112d7615d0c565b6000918252602090912001555b60098054806112f5576112f5615d3b565b600190038181906000526020600020016000905590555b50508061131890615d51565b9050610eff565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161137091600160a01b90910460ff1690615b0b565b60405180910390a1565b6000546001600160a01b031633146113a45760405162461bcd60e51b8152600401610d6390615c5c565b60006007846001600160601b0316815481106113c2576113c2615d0c565b90600052602060002090600b0201905060005b835181101561156a5782156114905760008482815181106113f8576113f8615d0c565b60200260200101511180156114295750600854845185908390811061141f5761141f615d0c565b6020026020010151105b6114665760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610d63565b61148b8585838151811061147c5761147c615d0c565b60200260200101516001614ba1565b611558565b6001600160601b03851660011480156114e65750600060088583815181106114ba576114ba615d0c565b6020026020010151815481106114d2576114d2615d0c565b906000526020600020906004020160000154145b156115335760405162461bcd60e51b815260206004820181905260248201527f43616e27742064697361626c6520526f6f7420444b20696e2047656e6572616c6044820152606401610d63565b6115588585838151811061154957611549615d0c565b60200260200101516000614ba1565b8061156281615d6f565b9150506113d5565b5050505050565b6008818154811061158157600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106115cf576115cf615d0c565b600091825260208220600490910201805460078054929450916001600160601b0390911690811061160257611602615d0c565b6000918252602082206003850154600b90920201925061162490600190615c99565b9050600083600301828154811061163d5761163d615d0c565b6000918252602082206007909102019150600185015460ff16600481111561166757611667615930565b141561179a5760008211806116b957506001840154600684019060ff16600481111561169557611695615930565b600481106116a5576116a5615d0c565b015460028501546116b69042615c99565b10155b6117055760405162461bcd60e51b815260206004820152601e60248201527f45766964656e6365206e6f7420706173736564202626202141707065616c00006044820152606401610d63565b60038101546006820154146117545760405162461bcd60e51b815260206004820152601560248201527444697370757465207374696c6c2064726177696e6760581b6044820152606401610d63565b8254600160601b900460ff1661176b57600261176e565b60015b60018086018054909160ff199091169083600481111561179057611790615930565b0217905550611bd6565b60018085015460ff1660048111156117b4576117b4615930565b1415611905576001840154600684019060ff1660048111156117d8576117d8615930565b600481106117e8576117e8615d0c565b015460028501546117f99042615c99565b1015806118a25750600881600001548154811061181857611818615d0c565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b15801561186a57600080fd5b505afa15801561187e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a29190615cb0565b6118ee5760405162461bcd60e51b815260206004820152601860248201527f436f6d6d697420706572696f64206e6f742070617373656400000000000000006044820152606401610d63565b6001808501805460029260ff199091169083611790565b6002600185015460ff16600481111561192057611920615930565b1415611aa8576001840154600684019060ff16600481111561194457611944615930565b6004811061195457611954615d0c565b015460028501546119659042615c99565b101580611a0e5750600881600001548154811061198457611984615d0c565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b1580156119d657600080fd5b505afa1580156119ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0e9190615cb0565b611a535760405162461bcd60e51b8152602060048201526016602482015275159bdd19481c195c9a5bd9081b9bdd081c185cdcd95960521b6044820152606401610d63565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611bd6565b6003600185015460ff166004811115611ac357611ac3615930565b1415611b6d576001840154600684019060ff166004811115611ae757611ae7615930565b60048110611af757611af7615d0c565b01546002850154611b089042615c99565b1015611b565760405162461bcd60e51b815260206004820152601860248201527f41707065616c20706572696f64206e6f742070617373656400000000000000006044820152606401610d63565b6001808501805460049260ff199091169083611790565b6004600185015460ff166004811115611b8857611b88615930565b1415611bd65760405162461bcd60e51b815260206004820152601760248201527f4469737075746520706572696f642069732066696e616c0000000000000000006044820152606401610d63565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611c159160ff1690615d8a565b60405180910390a25050505050565b600080600a8381548110611c3a57611c3a615d0c565b6000918252602082206003600490920201908101805491935090611c6090600190615c99565b81548110611c7057611c70615d0c565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611ca357611ca3615d0c565b90600052602060002090600b02019050806005015482600301541015611cce57506000949350505050565b80546007805490916001600160601b0316908110611cee57611cee615d0c565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600a8381548110611d3157611d31615d0c565b6000918252602082206003600490920201908101805491935090611d5790600190615c99565b81548110611d6757611d67615d0c565b9060005260206000209060070201905060006008826000015481548110611d9057611d90615d0c565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018790526001600160a01b031691508190631c3db16d9060240160206040518083038186803b158015611de557600080fd5b505afa158015611df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1d9190615d22565b95945050505050565b60078181548110611e3657600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000828152600c60205260408120600201805483908110611ea057611ea0615d0c565b906000526020600020015490505b92915050565b6000546001600160a01b03163314611ede5760405162461bcd60e51b8152600401610d6390615c5c565b8660078a6001600160601b031681548110611efb57611efb615d0c565b90600052602060002090600b0201600201541115611f2b5760405162461bcd60e51b8152600401610d6390615d98565b6000815111611f6c5760405162461bcd60e51b815260206004820152600d60248201526c21537570706f7274656420444b60981b6044820152606401610d63565b6001600160601b038916611fc25760405162461bcd60e51b815260206004820181905260248201527f496e76616c69643a20466f726b696e6720636f75727420617320706172656e746044820152606401610d63565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b83518110156120df57600084828151811061201757612017615d0c565b60200260200101511180156120485750600854845185908390811061203e5761203e615d0c565b6020026020010151105b6120855760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610d63565b600182600a01600086848151811061209f5761209f615d0c565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806120d790615d6f565b915050611ffa565b5080546bffffffffffffffffffffffff19166001600160601b038c16178155604080516000815260208101918290525161211d9160018401916154b9565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556121609060068301908790615504565b5060405163483abc4f60e11b8152600c600482015260248101839052604481018590527326858D60FE92b50b34e236B46874e0272434427590639075789e9060640160006040518083038186803b1580156121ba57600080fd5b505af41580156121ce573d6000803e3d6000fd5b5050505060078b6001600160601b0316815481106121ee576121ee615d0c565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907f2e689e2ae8e3c8e02797c3ff9998e8297e587a74bc6d0e48b6b5991f70991d1c9061225d908e908e908e908e908e908e908e908e90615dcd565b60405180910390a35050505050505050505050565b6000600a848154811061228757612287615d0c565b600091825260209091206004918202019150600182015460ff1660048111156122b2576122b2615930565b146122f35760405162461bcd60e51b815260206004820152601160248201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b6044820152606401610d63565b600081600301848154811061230a5761230a615d0c565b906000526020600020906007020190506000600882600001548154811061233357612333615d0c565b60009182526020822060049182020160020154908401546001600160a01b039091169250612362908690615e25565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b1580156123bb57600080fd5b505afa1580156123cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f39190615d22565b90506000808261240e5783861115612409578395505b61242e565b612419846002615e3d565b86111561242e5761242b846002615e3d565b95505b60048801545b86811015612af7578481101561286c57604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b15801561249257600080fd5b505afa1580156124a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ca9190615d22565b91506127108211156124dc5761271091505b60006127106124eb8482615c99565b8b600101546124fa9190615e3d565b6125049190615e72565b90506125108188615e25565b965089600601828154811061252757612527615d0c565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b03168552600201909252908220805491965083929091612574908490615c99565b90915550508a546007805483926001600160601b031690811061259957612599615d0c565b90600052602060002090600b0201600201546125b59190615e25565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b0316845260010190915290205410612649576001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152812054612627908390615c99565b8c549091506126429086906001600160601b03168385614c29565b505061269a565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b031684526001019091529020541561269a578a546126989085906001600160601b0316600084614c29565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b1580156126e857600080fd5b505afa1580156126fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127209190615cb0565b6127bd5760005b6001600160a01b0385166000908152600b60205260409020548110156127bb576001600160a01b0385166000908152600b6020526040902080546127a89187918490811061277757612777615d0c565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316600080614c29565b50806127b381615d6f565b915050612727565b505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e196127f284615e86565b60408051918252600060208301520160405180910390a3612814600187615c99565b8214156128665784612866576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f1505060005461286493506001600160a01b03169150899050615243565b505b50612ae5565b6001600160a01b038816634fe264fb8e8e6128878986615ea3565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b1580156128cb57600080fd5b505afa1580156128df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129039190615d22565b91506127108211156129155761271091505b600689016129238683615ea3565b8154811061293357612933615d0c565b60009182526020909120015460018a01546001600160a01b03909116935061271090612960908490615e3d565b61296a9190615e72565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600201909152812080549091906129aa908490615c99565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b03168452600101909152902054612a12576000612710838b600101546129f99190615e3d565b612a039190615e72565b9050612a0f8482615243565b50505b600061271083612a22878a615e72565b612a2c9190615e3d565b612a369190615e72565b9050600061271084878d60020154612a4e9190615e72565b612a589190615e3d565b612a629190615e72565b9050612a6e8583615243565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e198484604051612ada929190918252602082015260400190565b60405180910390a350505b80612aef81615d6f565b915050612434565b5084886005015414612b0b57600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff166001811115612b3d57612b3d615930565b14612b7c5760405162461bcd60e51b815260206004820152600f60248201526e10a9ba30b5b4b73390383430b9b29760891b6044820152606401610d63565b6000600e54600183600f54612b919190615e25565b612b9b9190615c99565b11612ba65781612bc1565b600f54600e54612bb69190615c99565b612bc1906001615e25565b9050600081600f54612bd39190615e25565b600f549091505b81811015612c52576000818152600d60205260409020805460018201546002830154612c22926001600160a01b03811692600160a01b9091046001600160601b031691614c29565b50506000818152600d60205260408120818155600181018290556002015580612c4a81615d6f565b915050612bda565b50600f555050565b612c62615531565b60006007836001600160601b031681548110612c8057612c80615d0c565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b815481526020019060010190808311612cab575050505050915050919050565b6000546001600160a01b03163314612cf55760405162461bcd60e51b8152600401610d6390615c5c565b6001600160601b03821660011480612d68575080600780846001600160601b031681548110612d2657612d26615d0c565b60009182526020909120600b909102015481546001600160601b03909116908110612d5357612d53615d0c565b90600052602060002090600b02016002015411155b612d845760405162461bcd60e51b8152600401610d6390615d98565b60005b6007836001600160601b031681548110612da357612da3615d0c565b90600052602060002090600b020160010180549050811015612e5c5781600780856001600160601b031681548110612ddd57612ddd615d0c565b90600052602060002090600b02016001018381548110612dff57612dff615d0c565b906000526020600020015481548110612e1a57612e1a615d0c565b90600052602060002090600b0201600201541015612e4a5760405162461bcd60e51b8152600401610d6390615d98565b80612e5481615d6f565b915050612d87565b50806007836001600160601b031681548110612e7a57612e7a615d0c565b90600052602060002090600b020160020181905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600890820152676d696e5374616b6560c01b604082015260600190565b60405180910390a25050565b606060088281548110612ef257612ef2615d0c565b9060005260206000209060040201600101805480602002602001604051908101604052809291908181526020018280548015612f4d57602002820191906000526020600020905b815481526020019060010190808311612f39575b50505050509050919050565b600a8181548110612f6957600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b6000546001600160a01b03163314612fdf5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b031681548110612ffc57612ffc615d0c565b90600052602060002090600b020160060190600461301b929190615504565b50816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b6000546001600160a01b0316331461308e5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b0316815481106130ab576130ab615d0c565b90600052602060002090600b020160040181905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b600080600a838154811061311b5761311b615d0c565b600091825260208220600360049092020190810180549193509061314190600190615c99565b8154811061315157613151615d0c565b600091825260208220845460078054938102909201945090916001600160601b0390911690811061318457613184615d0c565b90600052602060002090600b0201905080600501548260030154106132235782546001600160601b0316600114156131c5576001600160ff1b03935061324d565b60038201546131d5906002615e3d565b6131e0906001615e25565b81546007805490916001600160601b031690811061320057613200615d0c565b90600052602060002090600b02016004015461321c9190615e3d565b935061324d565b6003820154613233906002615e3d565b61323e906001615e25565b8160040154611e1d9190615e3d565b505050919050565b6000546001600160a01b0316331461327f5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b03168154811061329c5761329c615d0c565b90600052602060002090600b020160030181905550816001600160601b0316600080516020615f8b833981519152604051612ed190602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b0316331461331a5760405162461bcd60e51b8152600401610d6390615c5c565b6000836001600160a01b031683836040516133359190615ee3565b60006040518083038185875af1925050503d8060008114613372576040519150601f19603f3d011682016040523d82523d6000602084013e613377565b606091505b50509050806133bc5760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610d63565b50505050565b6133cf3383836000614c29565b61340c5760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610d63565b5050565b6000546001600160a01b0316331461343a5760405162461bcd60e51b8152600401610d6390615c5c565b600355565b6000806000806060600080600a898154811061345d5761345d615d0c565b9060005260206000209060040201600301888154811061347f5761347f615d0c565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561350157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116134e3575b50505050509150965096509650965096509650509295509295509295565b6000600a828154811061353457613534615d0c565b600091825260209091206004918202019150600182015460ff16600481111561355f5761355f615930565b146135a05760405162461bcd60e51b815260206004820152601160248201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b6044820152606401610d63565b6001810154610100900460ff16156135fa5760405162461bcd60e51b815260206004820152601760248201527f52756c696e6720616c72656164792065786563757465640000000000000000006044820152606401610d63565b600061360583611d1b565b60018301805461ff001916610100179055825460405163188d362b60e11b815260048101869052602481018390529192506001600160a01b03600160601b909104169063311a6c5690604401600060405180830381600087803b15801561366b57600080fd5b505af115801561367f573d6000803e3d6000fd5b50505050505050565b6009818154811061369857600080fd5b600091825260209091200154905081565b6000806000600a84815481106136c1576136c1615d0c565b60009182526020822060036004909202019081018054919350906136e790600190615c99565b815481106136f7576136f7615d0c565b90600052602060002090600702019050600881600001548154811061371e5761371e615d0c565b6000918252602090912060049182020160020154604051639b05c26160e01b81529182018790526001600160a01b031690639b05c26190602401604080518083038186803b15801561376f57600080fd5b505afa158015613783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a79190615eff565b90969095509350505050565b6000546001600160a01b031633146137dd5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b0316815481106137fa576137fa615d0c565b90600052602060002090600b020160050181905550816001600160601b0316600080516020615f8b833981519152604051612ed19060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a848154811061387357613873615d0c565b6000918252602090912060049091020190506003600182015460ff1660048111156138a0576138a0615930565b14156138f9576002810154815460078054929550916001600160601b039091169081106138cf576138cf615d0c565b600091825260209091206009600b90920201015460028201546138f29190615e25565b9150613902565b60009250600091505b50915091565b6000546001600160a01b031633146139325760405162461bcd60e51b8152600401610d6390615c5c565b600455565b60006001600254600160a01b900460ff16600181111561395957613959615930565b14801561397457506004546005546139719042615c99565b10155b905090565b600061398482614a22565b3410156139d35760405162461bcd60e51b815260206004820181905260248201527f45544820746f6f206c6f7720666f72206172626974726174696f6e20636f73746044820152606401610d63565b6000806139df8461530f565b92505091506007826001600160601b031681548110613a0057613a00615d0c565b60009182526020808320848452600a600b90930201919091019052604090205460ff16613a6f5760405162461bcd60e51b815260206004820152601a60248201527f444b20756e737570706f7274656420627920737562636f7572740000000000006044820152606401610d63565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa909101556008805492965090929184908110613afa57613afa615d0c565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b03909116908110613b3b57613b3b615d0c565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613b7a9034615e72565b600380830191909155858255820154600283015461271091613b9b91615e3d565b613ba59190615e72565b60018201553460028201556008805486908110613bc457613bc4615d0c565b906000526020600020906004020160020160149054906101000a900460ff16613c5b57600160088681548110613bfc57613bfc615d0c565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede54091613c90918b918e918e91600401615f24565b600060405180830381600087803b158015613caa57600080fd5b505af1158015613cbe573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b03163314613d255760405162461bcd60e51b8152600401610d6390615c5c565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b613d5083613105565b341015613d9f5760405162461bcd60e51b815260206004820152601b60248201527f45544820746f6f206c6f7720666f722061707065616c20636f737400000000006044820152606401610d63565b6000600a8481548110613db457613db4615d0c565b6000918252602090912060049091020190506003600182015460ff166004811115613de157613de1615930565b14613e275760405162461bcd60e51b815260206004820152601660248201527544697370757465206e6f742061707065616c61626c6560501b6044820152606401610d63565b60038101805460009190613e3d90600190615c99565b81548110613e4d57613e4d615d0c565b906000526020600020906007020190506008816000015481548110613e7457613e74615d0c565b60009182526020909120600490910201600201546001600160a01b03163314613ed25760405162461bcd60e51b815260206004820152601060248201526f44697370757465204b6974206f6e6c7960801b6044820152606401610d63565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019183908110613f1357613f13615d0c565b90600052602060002090600b020160050154846003015410614117576007836001600160601b031681548110613f4b57613f4b615d0c565b600091825260208220600b90910201546001600160601b031693505b600a81101561405c576007846001600160601b031681548110613f8c57613f8c615d0c565b60009182526020808320868452600a600b90930201919091019052604090205460ff1615613fb95761405c565b600060088481548110613fce57613fce615d0c565b906000526020600020906004020160000154146140115760088381548110613ff857613ff8615d0c565b906000526020600020906004020160000154925061404a565b6007846001600160601b03168154811061402d5761402d615d0c565b60009182526020909120600b90910201546001600160601b031693505b8061405481615d6f565b915050613f67565b506007836001600160601b03168154811061407957614079615d0c565b60009182526020808320858452600a600b90930201919091019052604090205460ff166140a557600192505b84546001600160601b0384811691161461411757845460038601546001600160601b03909116906140d890600190615c99565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546bffffffffffffffffffffffff19166001600160601b038416908117865560018601805460ff191690554260028701556007805460009290811061415f5761415f615d0c565b90600052602060002090600b0201905080600401543461417f9190615e72565b82600301819055506127108160030154826002015461419e9190615e3d565b6141a89190615e72565b600183015534600283015582825560088054849081106141ca576141ca615d0c565b906000526020600020906004020160020160149054906101000a900460ff166142615760016008848154811061420257614202615d0c565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b8454825414614347578454600387015461427d90600190615c99565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460088260000154815481106142cb576142cb615d0c565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede54092614314928e928e928e929101615f24565b600060405180830381600087803b15801561432e57600080fd5b505af1158015614342573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516143b79190615d8a565b60405180910390a2505050505050505050565b600080600a83815481106143e0576143e0615d0c565b9060005260206000209060040201905080600301600182600301805490506144089190615c99565b8154811061441857614418615d0c565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff16600181111561445257614452615930565b1461448d5760405162461bcd60e51b815260206004820152600b60248201526a57726f6e6720706861736560a81b6044820152606401610d63565b6000600a83815481106144a2576144a2615d0c565b906000526020600020906004020190506000600182600301805490506144c89190615c99565b905060008260030182815481106144e1576144e1615d0c565b6000918252602082206007909102019150600184015460ff16600481111561450b5761450b615930565b1461454b5760405162461bcd60e51b815260206004820152601060248201526f08515d9a59195b98d9481c195c9a5bd960821b6044820152606401610d63565b6000600882600001548154811061456457614564615d0c565b60009182526020822060026004909202010154600684015460038501546001600160a01b039092169350919061459a8884615e25565b11156145aa5783600301546145b4565b6145b48783615e25565b9050815b8181101561471a57604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b15801561460557600080fd5b505af1158015614619573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061463d9190615f6d565b90506001600160a01b038116156147075760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614693908490615e25565b909155505060068601805460018101825560009182526020918290200180546001600160a01b0319166001600160a01b038416908117909155604080518a81529283018590528c927f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a35b508061471281615d6f565b9150506145b8565b505050505050505050565b6060600980548060200260200160405190810160405280929190818152602001828054801561477357602002820191906000526020600020905b81548152602001906001019080831161475f575b5050505050905090565b6000546001600160a01b031633146147a75760405162461bcd60e51b8152600401610d6390615c5c565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146147f35760405162461bcd60e51b8152600401610d6390615c5c565b60085480821061482f5760405162461bcd60e51b81526020600482015260076024820152660854185c995b9d60ca1b6044820152606401610d63565b600082156148ac576008838154811061484a5761484a615d0c565b90600052602060002090600402016003015460016148689190615e25565b9050600a81106148ac5760405162461bcd60e51b815260206004820152600f60248201526e088cae0e8d040d8caeccad840dac2f608b1b6044820152606401610d63565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee38101918255915180519394919361495e937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee4019291909101906154b9565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b039093169290921791909117905560809091015160039091015560088054849081106149b8576149b8615d0c565b600091825260208083206001600490930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a4826133bc576133bc6001836001614ba1565b6000806000614a308461530f565b5091509150806007836001600160601b031681548110614a5257614a52615d0c565b90600052602060002090600b020160040154614a6e9190615e3d565b949350505050565b6000546001600160a01b03163314614aa05760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b031681548110614abd57614abd615d0c565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b6000600a8281548110614b3f57614b3f615d0c565b600091825260209091206003600490920201015492915050565b60006007836001600160601b031681548110614b7757614b77615d0c565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b806007846001600160601b031681548110614bbe57614bbe615d0c565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b60006001600160601b0384161580614c4b57506007546001600160601b038516115b15614c5857506000614a6e565b6001600160a01b0385166000908152600b6020526040812090614c7b8787615393565b604051637521ccb160e01b8152600c60048201526001600160601b0388166024820152604481018290529091506000907326858D60FE92b50b34e236B46874e0272434427590637521ccb19060640160206040518083038186803b158015614ce257600080fd5b505af4158015614cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d1a9190615d22565b90508515614da8576007876001600160601b031681548110614d3e57614d3e615d0c565b90600052602060002090600b020160020154861080614d7657506001600160601b038716600090815260028401602052604090205486105b15614d875760009350505050614a6e565b80158015614d9757508254600411155b15614da85760009350505050614a6e565b6000600254600160a01b900460ff166001811115614dc857614dc8615930565b14614e74576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e60008154614e1390615d6f565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b039093169290921782558201516001808301919091556060909201516002909101559350614a6e92505050565b6000818710614ef157614e878288615c99565b90508015614edf57614e9a8930836153db565b15614ee45781614edf578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b6150c6565b6000945050505050614a6e565b8661508e576001600160601b03881660009081526002850160205260409020548690614f1d9084615c99565b614f279190615c99565b90508015614edf57614f398982615243565b15614ee45760005b845481101561508857886001600160601b0316856000018281548110614f6957614f69615d0c565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031614156150765784548590614fa690600190615c99565b81548110614fb657614fb6615d0c565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316856000018281548110614ff457614ff4615d0c565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b031602179055508460000180548061504057615040615d3b565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055615088565b8061508081615d6f565b915050614f41565b506150c6565b856150998884615c99565b6150a39190615c99565b905080156150c6576150b58982615243565b6150c6576000945050505050614a6e565b6001600160601b038816600090815260018501602052604081205488906150ee908590615c99565b6150f89190615e25565b6001600160601b038a16600081815260018801602052604081208390559192505b816151dc57604051631712e1c560e11b8152600c600482015260248101829052604481018b9052606481018790527326858D60FE92b50b34e236B46874e0272434427590632e25c38a9060840160006040518083038186803b15801561517e57600080fd5b505af4158015615192573d6000803e3d6000fd5b5050505060018114156151a85760019150615119565b600781815481106151bb576151bb615d0c565b60009182526020909120600b90910201546001600160601b03169050615119565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600093849384939116916152a39190615ee3565b6000604051808303816000865af19150503d80600081146152e0576040519150601f19603f3d011682016040523d82523d6000602084013e6152e5565b606091505b5091509150818015611e1d575080511580611e1d575080806020019051810190611e1d9190615cb0565b60008060006040845110615381575050506020810151604082015160608301516001600160601b038316158061535057506007546001600160601b03841610155b1561535a57600192505b8161536457600391505b80158061537357506008548110155b1561537c575060015b61538c565b506001915060039050815b9193909250565b600060405160005b60148110156153b6578481600c011a8183015360010161539b565b5060145b60208110156153d25783811a818301536001016153ba565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600093849384939116916154439190615ee3565b6000604051808303816000865af19150503d8060008114615480576040519150601f19603f3d011682016040523d82523d6000602084013e615485565b606091505b50915091508180156154af5750805115806154af5750808060200190518101906154af9190615cb0565b9695505050505050565b8280548282559060005260206000209081019282156154f4579160200282015b828111156154f45782518255916020019190600101906154d9565b5061550092915061554f565b5090565b82600481019282156154f457916020028201828111156154f45782518255916020019190600101906154d9565b60405180608001604052806004906020820280368337509192915050565b5b808211156155005760008155600101615550565b6001600160a01b038116811461557957600080fd5b50565b60006020828403121561558e57600080fd5b813561559981615564565b9392505050565b80356001600160601b03811681146155b757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156155fb576155fb6155bc565b604052919050565b600082601f83011261561457600080fd5b8135602067ffffffffffffffff821115615630576156306155bc565b8160051b61563f8282016155d2565b928352848101820192828101908785111561565957600080fd5b83870192505b848310156156785782358252918301919083019061565f565b979650505050505050565b801515811461557957600080fd5b6000806000606084860312156156a657600080fd5b6156af846155a0565b9250602084013567ffffffffffffffff8111156156cb57600080fd5b6156d786828701615603565b92505060408401356156e881615683565b809150509250925092565b60006020828403121561570557600080fd5b5035919050565b6000806040838503121561571f57600080fd5b50508035926020909101359150565b600082601f83011261573f57600080fd5b6040516080810181811067ffffffffffffffff82111715615762576157626155bc565b60405280608084018581111561577757600080fd5b845b81811015615791578035835260209283019201615779565b509195945050505050565b60008060008060008060008060006101808a8c0312156157bb57600080fd5b6157c48a6155a0565b985060208a01356157d481615683565b975060408a0135965060608a0135955060808a0135945060a08a013593506157ff8b60c08c0161572e565b92506101408a013591506101608a013567ffffffffffffffff81111561582457600080fd5b6158308c828d01615603565b9150509295985092959850929598565b60008060006060848603121561585557600080fd5b505081359360208301359350604090920135919050565b60006020828403121561587e57600080fd5b615599826155a0565b8060005b60048110156133bc57815184526020938401939091019060010161588b565b60808101611eae8284615887565b600080604083850312156158cb57600080fd5b6158d4836155a0565b946020939093013593505050565b600081518084526020808501945080840160005b83811015615912578151875295820195908201906001016158f6565b509495945050505050565b60208152600061559960208301846158e2565b634e487b7160e01b600052602160045260246000fd5b6005811061595657615956615930565b9052565b6001600160601b03861681526001600160a01b038516602082015260a081016159866040830186615946565b9215156060820152608001529392505050565b60008060a083850312156159ac57600080fd5b6159b5836155a0565b91506159c4846020850161572e565b90509250929050565b600082601f8301126159de57600080fd5b813567ffffffffffffffff8111156159f8576159f86155bc565b615a0b601f8201601f19166020016155d2565b818152846020838601011115615a2057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215615a5257600080fd5b8335615a5d81615564565b925060208401359150604084013567ffffffffffffffff811115615a8057600080fd5b615a8c868287016159cd565b9150509250925092565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b81811015615af25784516001600160a01b031683529383019391830191600101615acd565b50508093505050508260a0830152979650505050505050565b6020810160028310615b1f57615b1f615930565b91905290565b60008060408385031215615b3857600080fd5b82359150602083013567ffffffffffffffff811115615b5657600080fd5b615b62858286016159cd565b9150509250929050565b600080600060608486031215615b8157600080fd5b8335925060208401359150604084013567ffffffffffffffff811115615a8057600080fd5b60008060408385031215615bb957600080fd5b8235615bc481615564565b91506159c4602084016155a0565b60008060408385031215615be557600080fd5b82356158d481615564565b600060208284031215615c0257600080fd5b813567ffffffffffffffff811115615c1957600080fd5b614a6e848285016159cd565b60008060408385031215615c3857600080fd5b615c41836155a0565b91506020830135615c5181615683565b809150509250929050565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015615cab57615cab615c83565b500390565b600060208284031215615cc257600080fd5b815161559981615683565b60008083128015600160ff1b850184121615615ceb57615ceb615c83565b6001600160ff1b0384018313811615615d0657615d06615c83565b50500390565b634e487b7160e01b600052603260045260246000fd5b600060208284031215615d3457600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b821415615d6757615d67615c83565b506000190190565b6000600019821415615d8357615d83615c83565b5060010190565b60208101611eae8284615946565b6020808252818101527f4d696e5374616b65206c6f776572207468616e20706172656e7420636f757274604082015260600190565b60006101608a15158352896020840152886040840152876060840152866080840152615dfc60a0840187615887565b8461012084015280610140840152615e16818401856158e2565b9b9a5050505050505050505050565b60008219821115615e3857615e38615c83565b500190565b6000816000190483118215151615615e5757615e57615c83565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615e8157615e81615e5c565b500490565b6000600160ff1b821415615e9c57615e9c615c83565b5060000390565b600082615eb257615eb2615e5c565b500690565b60005b83811015615ed2578181015183820152602001615eba565b838111156133bc5750506000910152565b60008251615ef5818460208701615eb7565b9190910192915050565b60008060408385031215615f1257600080fd5b825191506020830151615c5181615683565b8481528360208201526080604082015260008351806080840152615f4f8160a0850160208801615eb7565b606083019390935250601f91909101601f19160160a0019392505050565b600060208284031215615f7f57600080fd5b81516155998161556456fefb75175e7dd144a612469a4316b0a6e4cee24cb54400dfdc7bfe1546cd0e309da2646970667358221220bab7ca22ba7f0c78e8966a0b829254e7d3e1b2cbc13dda910dd083e0c8d0af6464736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106103cd5760003560e01c8063823cfd70116101fd578063c13517e111610118578063e4c0aaf4116100ab578063f7434ea91161007a578063f7434ea914610c99578063f8bdb57b14610cb9578063fbf405b014610cd9578063fc6f8f1614610cf9578063fe524c3914610d1957600080fd5b8063e4c0aaf414610bbb578063eaff425a14610bdb578063f12ada8b14610bf0578063f6b4d82d14610c1057600080fd5b8063cf0c38f8116100e7578063cf0c38f814610b08578063d1c1df4814610b28578063d2b8035a14610b86578063d8b03fd814610ba657600080fd5b8063c13517e114610aa2578063c258bb1914610ab5578063c356990214610ad5578063c71f425314610ae857600080fd5b8063b1c9fe6e11610190578063b70c4e941161015f578063b70c4e94146109fd578063b888adfa14610a12578063bfabfe8f14610a28578063c057eca714610a8c57600080fd5b8063b1c9fe6e14610984578063b2866af7146109b2578063b31b4540146109d2578063b4a61608146109e857600080fd5b80638edf4741116101cc5780638edf4741146108da5780639b05c261146108fa578063a57366e71461092f578063afe15cfb1461094f57600080fd5b8063823cfd701461084d578063840bc19c1461086d5780638a9bb02a146108885780638bb04875146108ba57600080fd5b806334d5fb31116102ed57806357260364116102805780636235593f1161024f5780636235593f146107e35780636c1eb1b9146107f8578063751accd01461080d5780637717a6e81461082d57600080fd5b8063572603641461076357806359354c771461078357806359ec827e146107a35780635bc24dd3146107c357600080fd5b80633e1d09be116102bc5780633e1d09be146106cf57806343d4137f146106ef578063564a565d1461071c57806356acb0501461074d57600080fd5b806334d5fb311461065757806335975f4a1461066c5780633a1578601461068c5780633cfd1184146106a257600080fd5b806319b81529116103655780632922d604116103345780632922d604146105e15780632b6a63f1146106015780632d29a47b146106215780632ea7b4d01461064157600080fd5b806319b815291461050d5780631c3db16d1461053d5780631f5a0dd21461055d57806327e6ec8a146105b457600080fd5b80630d1b9d1a116103a15780630d1b9d1a146104665780630d83b940146104b45780630e083ec9146104d7578063115d5376146104ed57600080fd5b8062f5822c146103d25780630b274f2e146103f45780630b7414bc146104095780630c340a2414610429575b600080fd5b3480156103de57600080fd5b506103f26103ed36600461557c565b610d39565b005b34801561040057600080fd5b506103f2610d8e565b34801561041557600080fd5b506103f2610424366004615691565b61137a565b34801561043557600080fd5b50600054610449906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561047257600080fd5b506104866104813660046156f3565b611571565b604080519485526001600160a01b03909316602085015290151591830191909152606082015260800161045d565b3480156104c057600080fd5b506104c9600181565b60405190815260200161045d565b3480156104e357600080fd5b506104c9600e5481565b3480156104f957600080fd5b506103f26105083660046156f3565b6115ba565b34801561051957600080fd5b5061052d6105283660046156f3565b611c24565b604051901515815260200161045d565b34801561054957600080fd5b506104c96105583660046156f3565b611d1b565b34801561056957600080fd5b5061057d6105783660046156f3565b611e26565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c00161045d565b3480156105c057600080fd5b506105c9600081565b6040516001600160601b03909116815260200161045d565b3480156105ed57600080fd5b506104c96105fc36600461570c565b611e7d565b34801561060d57600080fd5b506103f261061c36600461579c565b611eb4565b34801561062d57600080fd5b506103f261063c366004615840565b612272565b34801561064d57600080fd5b506104c961271081565b34801561066357600080fd5b506105c9600181565b34801561067857600080fd5b506103f26106873660046156f3565b612b1d565b34801561069857600080fd5b506104c960065481565b3480156106ae57600080fd5b506106c26106bd36600461586c565b612c5a565b60405161045d91906158aa565b3480156106db57600080fd5b506103f26106ea3660046158b8565b612ccb565b3480156106fb57600080fd5b5061070f61070a3660046156f3565b612edd565b60405161045d919061591d565b34801561072857600080fd5b5061073c6107373660046156f3565b612f59565b60405161045d95949392919061595a565b34801561075957600080fd5b506104c9600f5481565b34801561076f57600080fd5b506103f261077e366004615999565b612fb5565b34801561078f57600080fd5b506103f261079e3660046158b8565b613064565b3480156107af57600080fd5b506104c96107be3660046156f3565b613105565b3480156107cf57600080fd5b506103f26107de3660046158b8565b613255565b3480156107ef57600080fd5b506104c9600081565b34801561080457600080fd5b506104c9600a81565b34801561081957600080fd5b506103f2610828366004615a3d565b6132f0565b34801561083957600080fd5b506103f26108483660046158b8565b6133c2565b34801561085957600080fd5b506103f26108683660046156f3565b613410565b34801561087957600080fd5b506104c96001600160ff1b0381565b34801561089457600080fd5b506108a86108a336600461570c565b61343f565b60405161045d96959493929190615a96565b3480156108c657600080fd5b506103f26108d53660046156f3565b61351f565b3480156108e657600080fd5b506104c96108f53660046156f3565b613688565b34801561090657600080fd5b5061091a6109153660046156f3565b6136a9565b6040805192835290151560208301520161045d565b34801561093b57600080fd5b506103f261094a3660046158b8565b6137b3565b34801561095b57600080fd5b5061096f61096a3660046156f3565b61385b565b6040805192835260208301919091520161045d565b34801561099057600080fd5b506002546109a590600160a01b900460ff1681565b60405161045d9190615b0b565b3480156109be57600080fd5b506103f26109cd3660046156f3565b613908565b3480156109de57600080fd5b506104c960045481565b3480156109f457600080fd5b506104c9600481565b348015610a0957600080fd5b5061052d613937565b348015610a1e57600080fd5b506104c960055481565b348015610a3457600080fd5b50610a71610a4336600461570c565b6000918252600c60209081526040808420805460028201549486526004909101909252909220549192909190565b6040805193845260208401929092529082015260600161045d565b348015610a9857600080fd5b506104c960035481565b6104c9610ab0366004615b25565b613979565b348015610ac157600080fd5b506103f2610ad036600461557c565b613cfb565b6103f2610ae3366004615b6c565b613d47565b348015610af457600080fd5b506104c9610b033660046156f3565b6143ca565b348015610b1457600080fd5b50600254610449906001600160a01b031681565b348015610b3457600080fd5b5061096f610b43366004615ba6565b6001600160a01b03919091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610b9257600080fd5b506103f2610ba136600461570c565b614432565b348015610bb257600080fd5b5061070f614725565b348015610bc757600080fd5b506103f2610bd636600461557c565b61477d565b348015610be757600080fd5b506104c9600381565b348015610bfc57600080fd5b506103f2610c0b366004615bd2565b6147c9565b348015610c1c57600080fd5b50610c67610c2b3660046156f3565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b03909316602085015291830152606082015260800161045d565b348015610ca557600080fd5b506104c9610cb4366004615bf0565b614a22565b348015610cc557600080fd5b506103f2610cd4366004615c25565b614a76565b348015610ce557600080fd5b50600154610449906001600160a01b031681565b348015610d0557600080fd5b506104c9610d143660046156f3565b614b2a565b348015610d2557600080fd5b5061052d610d343660046158b8565b614b59565b6000546001600160a01b03163314610d6c5760405162461bcd60e51b8152600401610d6390615c5c565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610dae57610dae615930565b1415610e7457600354600554610dc49042615c99565b1015610e125760405162461bcd60e51b815260206004820152601960248201527f4d696e5374616b696e6754696d65206e6f7420706173736564000000000000006044820152606401610d63565b600954610e585760405162461bcd60e51b81526020600482015260146024820152734e6f20444b206e6565647320667265657a696e6760601b6044820152606401610d63565b6002805460ff60a01b1916600160a01b1790554360065561132f565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b158015610eaf57600080fd5b505afa158015610ec3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee79190615cb0565b600954909150600090610efc90600190615ccd565b90505b6000811261131f57600060098281548110610f1c57610f1c615d0c565b906000526020600020015490506000600860098481548110610f4057610f40615d0c565b906000526020600020015481548110610f5b57610f5b615d0c565b60009182526020909120600260049092020101546001600160a01b03169050838015610ff55750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b158015610fbb57600080fd5b505afa158015610fcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff39190615cb0565b155b1561110f57806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561103557600080fd5b505af1158015611049573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561108657600080fd5b505afa15801561109a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110be9190615cb0565b61110a5760405162461bcd60e51b815260206004820152601e60248201527f536f6d6520444b206e6f7420696e205265736f6c76696e6720706861736500006044820152606401610d63565b61130c565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561114857600080fd5b505afa15801561115c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111809190615cb0565b6111cc5760405162461bcd60e51b815260206004820152601e60248201527f536f6d6520444b206e6f7420696e205265736f6c76696e6720706861736500006044820152606401610d63565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561120557600080fd5b505afa158015611219573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123d9190615d22565b61130c5760006008838154811061125657611256615d0c565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b1990921691909117905560095461129290600190615ccd565b8312156112e457600980546112a990600190615c99565b815481106112b9576112b9615d0c565b9060005260206000200154600984815481106112d7576112d7615d0c565b6000918252602090912001555b60098054806112f5576112f5615d3b565b600190038181906000526020600020016000905590555b50508061131890615d51565b9050610eff565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161137091600160a01b90910460ff1690615b0b565b60405180910390a1565b6000546001600160a01b031633146113a45760405162461bcd60e51b8152600401610d6390615c5c565b60006007846001600160601b0316815481106113c2576113c2615d0c565b90600052602060002090600b0201905060005b835181101561156a5782156114905760008482815181106113f8576113f8615d0c565b60200260200101511180156114295750600854845185908390811061141f5761141f615d0c565b6020026020010151105b6114665760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610d63565b61148b8585838151811061147c5761147c615d0c565b60200260200101516001614ba1565b611558565b6001600160601b03851660011480156114e65750600060088583815181106114ba576114ba615d0c565b6020026020010151815481106114d2576114d2615d0c565b906000526020600020906004020160000154145b156115335760405162461bcd60e51b815260206004820181905260248201527f43616e27742064697361626c6520526f6f7420444b20696e2047656e6572616c6044820152606401610d63565b6115588585838151811061154957611549615d0c565b60200260200101516000614ba1565b8061156281615d6f565b9150506113d5565b5050505050565b6008818154811061158157600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106115cf576115cf615d0c565b600091825260208220600490910201805460078054929450916001600160601b0390911690811061160257611602615d0c565b6000918252602082206003850154600b90920201925061162490600190615c99565b9050600083600301828154811061163d5761163d615d0c565b6000918252602082206007909102019150600185015460ff16600481111561166757611667615930565b141561179a5760008211806116b957506001840154600684019060ff16600481111561169557611695615930565b600481106116a5576116a5615d0c565b015460028501546116b69042615c99565b10155b6117055760405162461bcd60e51b815260206004820152601e60248201527f45766964656e6365206e6f7420706173736564202626202141707065616c00006044820152606401610d63565b60038101546006820154146117545760405162461bcd60e51b815260206004820152601560248201527444697370757465207374696c6c2064726177696e6760581b6044820152606401610d63565b8254600160601b900460ff1661176b57600261176e565b60015b60018086018054909160ff199091169083600481111561179057611790615930565b0217905550611bd6565b60018085015460ff1660048111156117b4576117b4615930565b1415611905576001840154600684019060ff1660048111156117d8576117d8615930565b600481106117e8576117e8615d0c565b015460028501546117f99042615c99565b1015806118a25750600881600001548154811061181857611818615d0c565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b15801561186a57600080fd5b505afa15801561187e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a29190615cb0565b6118ee5760405162461bcd60e51b815260206004820152601860248201527f436f6d6d697420706572696f64206e6f742070617373656400000000000000006044820152606401610d63565b6001808501805460029260ff199091169083611790565b6002600185015460ff16600481111561192057611920615930565b1415611aa8576001840154600684019060ff16600481111561194457611944615930565b6004811061195457611954615d0c565b015460028501546119659042615c99565b101580611a0e5750600881600001548154811061198457611984615d0c565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b1580156119d657600080fd5b505afa1580156119ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0e9190615cb0565b611a535760405162461bcd60e51b8152602060048201526016602482015275159bdd19481c195c9a5bd9081b9bdd081c185cdcd95960521b6044820152606401610d63565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611bd6565b6003600185015460ff166004811115611ac357611ac3615930565b1415611b6d576001840154600684019060ff166004811115611ae757611ae7615930565b60048110611af757611af7615d0c565b01546002850154611b089042615c99565b1015611b565760405162461bcd60e51b815260206004820152601860248201527f41707065616c20706572696f64206e6f742070617373656400000000000000006044820152606401610d63565b6001808501805460049260ff199091169083611790565b6004600185015460ff166004811115611b8857611b88615930565b1415611bd65760405162461bcd60e51b815260206004820152601760248201527f4469737075746520706572696f642069732066696e616c0000000000000000006044820152606401610d63565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611c159160ff1690615d8a565b60405180910390a25050505050565b600080600a8381548110611c3a57611c3a615d0c565b6000918252602082206003600490920201908101805491935090611c6090600190615c99565b81548110611c7057611c70615d0c565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611ca357611ca3615d0c565b90600052602060002090600b02019050806005015482600301541015611cce57506000949350505050565b80546007805490916001600160601b0316908110611cee57611cee615d0c565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600a8381548110611d3157611d31615d0c565b6000918252602082206003600490920201908101805491935090611d5790600190615c99565b81548110611d6757611d67615d0c565b9060005260206000209060070201905060006008826000015481548110611d9057611d90615d0c565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018790526001600160a01b031691508190631c3db16d9060240160206040518083038186803b158015611de557600080fd5b505afa158015611df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1d9190615d22565b95945050505050565b60078181548110611e3657600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000828152600c60205260408120600201805483908110611ea057611ea0615d0c565b906000526020600020015490505b92915050565b6000546001600160a01b03163314611ede5760405162461bcd60e51b8152600401610d6390615c5c565b8660078a6001600160601b031681548110611efb57611efb615d0c565b90600052602060002090600b0201600201541115611f2b5760405162461bcd60e51b8152600401610d6390615d98565b6000815111611f6c5760405162461bcd60e51b815260206004820152600d60248201526c21537570706f7274656420444b60981b6044820152606401610d63565b6001600160601b038916611fc25760405162461bcd60e51b815260206004820181905260248201527f496e76616c69643a20466f726b696e6720636f75727420617320706172656e746044820152606401610d63565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b83518110156120df57600084828151811061201757612017615d0c565b60200260200101511180156120485750600854845185908390811061203e5761203e615d0c565b6020026020010151105b6120855760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610d63565b600182600a01600086848151811061209f5761209f615d0c565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806120d790615d6f565b915050611ffa565b5080546bffffffffffffffffffffffff19166001600160601b038c16178155604080516000815260208101918290525161211d9160018401916154b9565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556121609060068301908790615504565b5060405163483abc4f60e11b8152600c6004820152602481018390526044810185905273__$52cf47af9c3c0d67e54ac2a3225447effa$__90639075789e9060640160006040518083038186803b1580156121ba57600080fd5b505af41580156121ce573d6000803e3d6000fd5b5050505060078b6001600160601b0316815481106121ee576121ee615d0c565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907f2e689e2ae8e3c8e02797c3ff9998e8297e587a74bc6d0e48b6b5991f70991d1c9061225d908e908e908e908e908e908e908e908e90615dcd565b60405180910390a35050505050505050505050565b6000600a848154811061228757612287615d0c565b600091825260209091206004918202019150600182015460ff1660048111156122b2576122b2615930565b146122f35760405162461bcd60e51b815260206004820152601160248201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b6044820152606401610d63565b600081600301848154811061230a5761230a615d0c565b906000526020600020906007020190506000600882600001548154811061233357612333615d0c565b60009182526020822060049182020160020154908401546001600160a01b039091169250612362908690615e25565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b1580156123bb57600080fd5b505afa1580156123cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f39190615d22565b90506000808261240e5783861115612409578395505b61242e565b612419846002615e3d565b86111561242e5761242b846002615e3d565b95505b60048801545b86811015612af7578481101561286c57604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b15801561249257600080fd5b505afa1580156124a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ca9190615d22565b91506127108211156124dc5761271091505b60006127106124eb8482615c99565b8b600101546124fa9190615e3d565b6125049190615e72565b90506125108188615e25565b965089600601828154811061252757612527615d0c565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b03168552600201909252908220805491965083929091612574908490615c99565b90915550508a546007805483926001600160601b031690811061259957612599615d0c565b90600052602060002090600b0201600201546125b59190615e25565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b0316845260010190915290205410612649576001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152812054612627908390615c99565b8c549091506126429086906001600160601b03168385614c29565b505061269a565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b031684526001019091529020541561269a578a546126989085906001600160601b0316600084614c29565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b1580156126e857600080fd5b505afa1580156126fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127209190615cb0565b6127bd5760005b6001600160a01b0385166000908152600b60205260409020548110156127bb576001600160a01b0385166000908152600b6020526040902080546127a89187918490811061277757612777615d0c565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316600080614c29565b50806127b381615d6f565b915050612727565b505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e196127f284615e86565b60408051918252600060208301520160405180910390a3612814600187615c99565b8214156128665784612866576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f1505060005461286493506001600160a01b03169150899050615243565b505b50612ae5565b6001600160a01b038816634fe264fb8e8e6128878986615ea3565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b1580156128cb57600080fd5b505afa1580156128df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129039190615d22565b91506127108211156129155761271091505b600689016129238683615ea3565b8154811061293357612933615d0c565b60009182526020909120015460018a01546001600160a01b03909116935061271090612960908490615e3d565b61296a9190615e72565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600201909152812080549091906129aa908490615c99565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b03168452600101909152902054612a12576000612710838b600101546129f99190615e3d565b612a039190615e72565b9050612a0f8482615243565b50505b600061271083612a22878a615e72565b612a2c9190615e3d565b612a369190615e72565b9050600061271084878d60020154612a4e9190615e72565b612a589190615e3d565b612a629190615e72565b9050612a6e8583615243565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e198484604051612ada929190918252602082015260400190565b60405180910390a350505b80612aef81615d6f565b915050612434565b5084886005015414612b0b57600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff166001811115612b3d57612b3d615930565b14612b7c5760405162461bcd60e51b815260206004820152600f60248201526e10a9ba30b5b4b73390383430b9b29760891b6044820152606401610d63565b6000600e54600183600f54612b919190615e25565b612b9b9190615c99565b11612ba65781612bc1565b600f54600e54612bb69190615c99565b612bc1906001615e25565b9050600081600f54612bd39190615e25565b600f549091505b81811015612c52576000818152600d60205260409020805460018201546002830154612c22926001600160a01b03811692600160a01b9091046001600160601b031691614c29565b50506000818152600d60205260408120818155600181018290556002015580612c4a81615d6f565b915050612bda565b50600f555050565b612c62615531565b60006007836001600160601b031681548110612c8057612c80615d0c565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b815481526020019060010190808311612cab575050505050915050919050565b6000546001600160a01b03163314612cf55760405162461bcd60e51b8152600401610d6390615c5c565b6001600160601b03821660011480612d68575080600780846001600160601b031681548110612d2657612d26615d0c565b60009182526020909120600b909102015481546001600160601b03909116908110612d5357612d53615d0c565b90600052602060002090600b02016002015411155b612d845760405162461bcd60e51b8152600401610d6390615d98565b60005b6007836001600160601b031681548110612da357612da3615d0c565b90600052602060002090600b020160010180549050811015612e5c5781600780856001600160601b031681548110612ddd57612ddd615d0c565b90600052602060002090600b02016001018381548110612dff57612dff615d0c565b906000526020600020015481548110612e1a57612e1a615d0c565b90600052602060002090600b0201600201541015612e4a5760405162461bcd60e51b8152600401610d6390615d98565b80612e5481615d6f565b915050612d87565b50806007836001600160601b031681548110612e7a57612e7a615d0c565b90600052602060002090600b020160020181905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600890820152676d696e5374616b6560c01b604082015260600190565b60405180910390a25050565b606060088281548110612ef257612ef2615d0c565b9060005260206000209060040201600101805480602002602001604051908101604052809291908181526020018280548015612f4d57602002820191906000526020600020905b815481526020019060010190808311612f39575b50505050509050919050565b600a8181548110612f6957600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b6000546001600160a01b03163314612fdf5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b031681548110612ffc57612ffc615d0c565b90600052602060002090600b020160060190600461301b929190615504565b50816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b6000546001600160a01b0316331461308e5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b0316815481106130ab576130ab615d0c565b90600052602060002090600b020160040181905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b600080600a838154811061311b5761311b615d0c565b600091825260208220600360049092020190810180549193509061314190600190615c99565b8154811061315157613151615d0c565b600091825260208220845460078054938102909201945090916001600160601b0390911690811061318457613184615d0c565b90600052602060002090600b0201905080600501548260030154106132235782546001600160601b0316600114156131c5576001600160ff1b03935061324d565b60038201546131d5906002615e3d565b6131e0906001615e25565b81546007805490916001600160601b031690811061320057613200615d0c565b90600052602060002090600b02016004015461321c9190615e3d565b935061324d565b6003820154613233906002615e3d565b61323e906001615e25565b8160040154611e1d9190615e3d565b505050919050565b6000546001600160a01b0316331461327f5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b03168154811061329c5761329c615d0c565b90600052602060002090600b020160030181905550816001600160601b0316600080516020615f8b833981519152604051612ed190602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b0316331461331a5760405162461bcd60e51b8152600401610d6390615c5c565b6000836001600160a01b031683836040516133359190615ee3565b60006040518083038185875af1925050503d8060008114613372576040519150601f19603f3d011682016040523d82523d6000602084013e613377565b606091505b50509050806133bc5760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610d63565b50505050565b6133cf3383836000614c29565b61340c5760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610d63565b5050565b6000546001600160a01b0316331461343a5760405162461bcd60e51b8152600401610d6390615c5c565b600355565b6000806000806060600080600a898154811061345d5761345d615d0c565b9060005260206000209060040201600301888154811061347f5761347f615d0c565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561350157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116134e3575b50505050509150965096509650965096509650509295509295509295565b6000600a828154811061353457613534615d0c565b600091825260209091206004918202019150600182015460ff16600481111561355f5761355f615930565b146135a05760405162461bcd60e51b815260206004820152601160248201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b6044820152606401610d63565b6001810154610100900460ff16156135fa5760405162461bcd60e51b815260206004820152601760248201527f52756c696e6720616c72656164792065786563757465640000000000000000006044820152606401610d63565b600061360583611d1b565b60018301805461ff001916610100179055825460405163188d362b60e11b815260048101869052602481018390529192506001600160a01b03600160601b909104169063311a6c5690604401600060405180830381600087803b15801561366b57600080fd5b505af115801561367f573d6000803e3d6000fd5b50505050505050565b6009818154811061369857600080fd5b600091825260209091200154905081565b6000806000600a84815481106136c1576136c1615d0c565b60009182526020822060036004909202019081018054919350906136e790600190615c99565b815481106136f7576136f7615d0c565b90600052602060002090600702019050600881600001548154811061371e5761371e615d0c565b6000918252602090912060049182020160020154604051639b05c26160e01b81529182018790526001600160a01b031690639b05c26190602401604080518083038186803b15801561376f57600080fd5b505afa158015613783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a79190615eff565b90969095509350505050565b6000546001600160a01b031633146137dd5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b0316815481106137fa576137fa615d0c565b90600052602060002090600b020160050181905550816001600160601b0316600080516020615f8b833981519152604051612ed19060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a848154811061387357613873615d0c565b6000918252602090912060049091020190506003600182015460ff1660048111156138a0576138a0615930565b14156138f9576002810154815460078054929550916001600160601b039091169081106138cf576138cf615d0c565b600091825260209091206009600b90920201015460028201546138f29190615e25565b9150613902565b60009250600091505b50915091565b6000546001600160a01b031633146139325760405162461bcd60e51b8152600401610d6390615c5c565b600455565b60006001600254600160a01b900460ff16600181111561395957613959615930565b14801561397457506004546005546139719042615c99565b10155b905090565b600061398482614a22565b3410156139d35760405162461bcd60e51b815260206004820181905260248201527f45544820746f6f206c6f7720666f72206172626974726174696f6e20636f73746044820152606401610d63565b6000806139df8461530f565b92505091506007826001600160601b031681548110613a0057613a00615d0c565b60009182526020808320848452600a600b90930201919091019052604090205460ff16613a6f5760405162461bcd60e51b815260206004820152601a60248201527f444b20756e737570706f7274656420627920737562636f7572740000000000006044820152606401610d63565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa909101556008805492965090929184908110613afa57613afa615d0c565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b03909116908110613b3b57613b3b615d0c565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613b7a9034615e72565b600380830191909155858255820154600283015461271091613b9b91615e3d565b613ba59190615e72565b60018201553460028201556008805486908110613bc457613bc4615d0c565b906000526020600020906004020160020160149054906101000a900460ff16613c5b57600160088681548110613bfc57613bfc615d0c565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede54091613c90918b918e918e91600401615f24565b600060405180830381600087803b158015613caa57600080fd5b505af1158015613cbe573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b03163314613d255760405162461bcd60e51b8152600401610d6390615c5c565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b613d5083613105565b341015613d9f5760405162461bcd60e51b815260206004820152601b60248201527f45544820746f6f206c6f7720666f722061707065616c20636f737400000000006044820152606401610d63565b6000600a8481548110613db457613db4615d0c565b6000918252602090912060049091020190506003600182015460ff166004811115613de157613de1615930565b14613e275760405162461bcd60e51b815260206004820152601660248201527544697370757465206e6f742061707065616c61626c6560501b6044820152606401610d63565b60038101805460009190613e3d90600190615c99565b81548110613e4d57613e4d615d0c565b906000526020600020906007020190506008816000015481548110613e7457613e74615d0c565b60009182526020909120600490910201600201546001600160a01b03163314613ed25760405162461bcd60e51b815260206004820152601060248201526f44697370757465204b6974206f6e6c7960801b6044820152606401610d63565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019183908110613f1357613f13615d0c565b90600052602060002090600b020160050154846003015410614117576007836001600160601b031681548110613f4b57613f4b615d0c565b600091825260208220600b90910201546001600160601b031693505b600a81101561405c576007846001600160601b031681548110613f8c57613f8c615d0c565b60009182526020808320868452600a600b90930201919091019052604090205460ff1615613fb95761405c565b600060088481548110613fce57613fce615d0c565b906000526020600020906004020160000154146140115760088381548110613ff857613ff8615d0c565b906000526020600020906004020160000154925061404a565b6007846001600160601b03168154811061402d5761402d615d0c565b60009182526020909120600b90910201546001600160601b031693505b8061405481615d6f565b915050613f67565b506007836001600160601b03168154811061407957614079615d0c565b60009182526020808320858452600a600b90930201919091019052604090205460ff166140a557600192505b84546001600160601b0384811691161461411757845460038601546001600160601b03909116906140d890600190615c99565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546bffffffffffffffffffffffff19166001600160601b038416908117865560018601805460ff191690554260028701556007805460009290811061415f5761415f615d0c565b90600052602060002090600b0201905080600401543461417f9190615e72565b82600301819055506127108160030154826002015461419e9190615e3d565b6141a89190615e72565b600183015534600283015582825560088054849081106141ca576141ca615d0c565b906000526020600020906004020160020160149054906101000a900460ff166142615760016008848154811061420257614202615d0c565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b8454825414614347578454600387015461427d90600190615c99565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460088260000154815481106142cb576142cb615d0c565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede54092614314928e928e928e929101615f24565b600060405180830381600087803b15801561432e57600080fd5b505af1158015614342573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516143b79190615d8a565b60405180910390a2505050505050505050565b600080600a83815481106143e0576143e0615d0c565b9060005260206000209060040201905080600301600182600301805490506144089190615c99565b8154811061441857614418615d0c565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff16600181111561445257614452615930565b1461448d5760405162461bcd60e51b815260206004820152600b60248201526a57726f6e6720706861736560a81b6044820152606401610d63565b6000600a83815481106144a2576144a2615d0c565b906000526020600020906004020190506000600182600301805490506144c89190615c99565b905060008260030182815481106144e1576144e1615d0c565b6000918252602082206007909102019150600184015460ff16600481111561450b5761450b615930565b1461454b5760405162461bcd60e51b815260206004820152601060248201526f08515d9a59195b98d9481c195c9a5bd960821b6044820152606401610d63565b6000600882600001548154811061456457614564615d0c565b60009182526020822060026004909202010154600684015460038501546001600160a01b039092169350919061459a8884615e25565b11156145aa5783600301546145b4565b6145b48783615e25565b9050815b8181101561471a57604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b15801561460557600080fd5b505af1158015614619573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061463d9190615f6d565b90506001600160a01b038116156147075760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614693908490615e25565b909155505060068601805460018101825560009182526020918290200180546001600160a01b0319166001600160a01b038416908117909155604080518a81529283018590528c927f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a35b508061471281615d6f565b9150506145b8565b505050505050505050565b6060600980548060200260200160405190810160405280929190818152602001828054801561477357602002820191906000526020600020905b81548152602001906001019080831161475f575b5050505050905090565b6000546001600160a01b031633146147a75760405162461bcd60e51b8152600401610d6390615c5c565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146147f35760405162461bcd60e51b8152600401610d6390615c5c565b60085480821061482f5760405162461bcd60e51b81526020600482015260076024820152660854185c995b9d60ca1b6044820152606401610d63565b600082156148ac576008838154811061484a5761484a615d0c565b90600052602060002090600402016003015460016148689190615e25565b9050600a81106148ac5760405162461bcd60e51b815260206004820152600f60248201526e088cae0e8d040d8caeccad840dac2f608b1b6044820152606401610d63565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee38101918255915180519394919361495e937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee4019291909101906154b9565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b039093169290921791909117905560809091015160039091015560088054849081106149b8576149b8615d0c565b600091825260208083206001600490930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a4826133bc576133bc6001836001614ba1565b6000806000614a308461530f565b5091509150806007836001600160601b031681548110614a5257614a52615d0c565b90600052602060002090600b020160040154614a6e9190615e3d565b949350505050565b6000546001600160a01b03163314614aa05760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b031681548110614abd57614abd615d0c565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b6000600a8281548110614b3f57614b3f615d0c565b600091825260209091206003600490920201015492915050565b60006007836001600160601b031681548110614b7757614b77615d0c565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b806007846001600160601b031681548110614bbe57614bbe615d0c565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b60006001600160601b0384161580614c4b57506007546001600160601b038516115b15614c5857506000614a6e565b6001600160a01b0385166000908152600b6020526040812090614c7b8787615393565b604051637521ccb160e01b8152600c60048201526001600160601b03881660248201526044810182905290915060009073__$52cf47af9c3c0d67e54ac2a3225447effa$__90637521ccb19060640160206040518083038186803b158015614ce257600080fd5b505af4158015614cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d1a9190615d22565b90508515614da8576007876001600160601b031681548110614d3e57614d3e615d0c565b90600052602060002090600b020160020154861080614d7657506001600160601b038716600090815260028401602052604090205486105b15614d875760009350505050614a6e565b80158015614d9757508254600411155b15614da85760009350505050614a6e565b6000600254600160a01b900460ff166001811115614dc857614dc8615930565b14614e74576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e60008154614e1390615d6f565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b039093169290921782558201516001808301919091556060909201516002909101559350614a6e92505050565b6000818710614ef157614e878288615c99565b90508015614edf57614e9a8930836153db565b15614ee45781614edf578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b6150c6565b6000945050505050614a6e565b8661508e576001600160601b03881660009081526002850160205260409020548690614f1d9084615c99565b614f279190615c99565b90508015614edf57614f398982615243565b15614ee45760005b845481101561508857886001600160601b0316856000018281548110614f6957614f69615d0c565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031614156150765784548590614fa690600190615c99565b81548110614fb657614fb6615d0c565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316856000018281548110614ff457614ff4615d0c565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b031602179055508460000180548061504057615040615d3b565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055615088565b8061508081615d6f565b915050614f41565b506150c6565b856150998884615c99565b6150a39190615c99565b905080156150c6576150b58982615243565b6150c6576000945050505050614a6e565b6001600160601b038816600090815260018501602052604081205488906150ee908590615c99565b6150f89190615e25565b6001600160601b038a16600081815260018801602052604081208390559192505b816151dc57604051631712e1c560e11b8152600c600482015260248101829052604481018b90526064810187905273__$52cf47af9c3c0d67e54ac2a3225447effa$__90632e25c38a9060840160006040518083038186803b15801561517e57600080fd5b505af4158015615192573d6000803e3d6000fd5b5050505060018114156151a85760019150615119565b600781815481106151bb576151bb615d0c565b60009182526020909120600b90910201546001600160601b03169050615119565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600093849384939116916152a39190615ee3565b6000604051808303816000865af19150503d80600081146152e0576040519150601f19603f3d011682016040523d82523d6000602084013e6152e5565b606091505b5091509150818015611e1d575080511580611e1d575080806020019051810190611e1d9190615cb0565b60008060006040845110615381575050506020810151604082015160608301516001600160601b038316158061535057506007546001600160601b03841610155b1561535a57600192505b8161536457600391505b80158061537357506008548110155b1561537c575060015b61538c565b506001915060039050815b9193909250565b600060405160005b60148110156153b6578481600c011a8183015360010161539b565b5060145b60208110156153d25783811a818301536001016153ba565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600093849384939116916154439190615ee3565b6000604051808303816000865af19150503d8060008114615480576040519150601f19603f3d011682016040523d82523d6000602084013e615485565b606091505b50915091508180156154af5750805115806154af5750808060200190518101906154af9190615cb0565b9695505050505050565b8280548282559060005260206000209081019282156154f4579160200282015b828111156154f45782518255916020019190600101906154d9565b5061550092915061554f565b5090565b82600481019282156154f457916020028201828111156154f45782518255916020019190600101906154d9565b60405180608001604052806004906020820280368337509192915050565b5b808211156155005760008155600101615550565b6001600160a01b038116811461557957600080fd5b50565b60006020828403121561558e57600080fd5b813561559981615564565b9392505050565b80356001600160601b03811681146155b757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156155fb576155fb6155bc565b604052919050565b600082601f83011261561457600080fd5b8135602067ffffffffffffffff821115615630576156306155bc565b8160051b61563f8282016155d2565b928352848101820192828101908785111561565957600080fd5b83870192505b848310156156785782358252918301919083019061565f565b979650505050505050565b801515811461557957600080fd5b6000806000606084860312156156a657600080fd5b6156af846155a0565b9250602084013567ffffffffffffffff8111156156cb57600080fd5b6156d786828701615603565b92505060408401356156e881615683565b809150509250925092565b60006020828403121561570557600080fd5b5035919050565b6000806040838503121561571f57600080fd5b50508035926020909101359150565b600082601f83011261573f57600080fd5b6040516080810181811067ffffffffffffffff82111715615762576157626155bc565b60405280608084018581111561577757600080fd5b845b81811015615791578035835260209283019201615779565b509195945050505050565b60008060008060008060008060006101808a8c0312156157bb57600080fd5b6157c48a6155a0565b985060208a01356157d481615683565b975060408a0135965060608a0135955060808a0135945060a08a013593506157ff8b60c08c0161572e565b92506101408a013591506101608a013567ffffffffffffffff81111561582457600080fd5b6158308c828d01615603565b9150509295985092959850929598565b60008060006060848603121561585557600080fd5b505081359360208301359350604090920135919050565b60006020828403121561587e57600080fd5b615599826155a0565b8060005b60048110156133bc57815184526020938401939091019060010161588b565b60808101611eae8284615887565b600080604083850312156158cb57600080fd5b6158d4836155a0565b946020939093013593505050565b600081518084526020808501945080840160005b83811015615912578151875295820195908201906001016158f6565b509495945050505050565b60208152600061559960208301846158e2565b634e487b7160e01b600052602160045260246000fd5b6005811061595657615956615930565b9052565b6001600160601b03861681526001600160a01b038516602082015260a081016159866040830186615946565b9215156060820152608001529392505050565b60008060a083850312156159ac57600080fd5b6159b5836155a0565b91506159c4846020850161572e565b90509250929050565b600082601f8301126159de57600080fd5b813567ffffffffffffffff8111156159f8576159f86155bc565b615a0b601f8201601f19166020016155d2565b818152846020838601011115615a2057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215615a5257600080fd5b8335615a5d81615564565b925060208401359150604084013567ffffffffffffffff811115615a8057600080fd5b615a8c868287016159cd565b9150509250925092565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b81811015615af25784516001600160a01b031683529383019391830191600101615acd565b50508093505050508260a0830152979650505050505050565b6020810160028310615b1f57615b1f615930565b91905290565b60008060408385031215615b3857600080fd5b82359150602083013567ffffffffffffffff811115615b5657600080fd5b615b62858286016159cd565b9150509250929050565b600080600060608486031215615b8157600080fd5b8335925060208401359150604084013567ffffffffffffffff811115615a8057600080fd5b60008060408385031215615bb957600080fd5b8235615bc481615564565b91506159c4602084016155a0565b60008060408385031215615be557600080fd5b82356158d481615564565b600060208284031215615c0257600080fd5b813567ffffffffffffffff811115615c1957600080fd5b614a6e848285016159cd565b60008060408385031215615c3857600080fd5b615c41836155a0565b91506020830135615c5181615683565b809150509250929050565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015615cab57615cab615c83565b500390565b600060208284031215615cc257600080fd5b815161559981615683565b60008083128015600160ff1b850184121615615ceb57615ceb615c83565b6001600160ff1b0384018313811615615d0657615d06615c83565b50500390565b634e487b7160e01b600052603260045260246000fd5b600060208284031215615d3457600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b821415615d6757615d67615c83565b506000190190565b6000600019821415615d8357615d83615c83565b5060010190565b60208101611eae8284615946565b6020808252818101527f4d696e5374616b65206c6f776572207468616e20706172656e7420636f757274604082015260600190565b60006101608a15158352896020840152886040840152876060840152866080840152615dfc60a0840187615887565b8461012084015280610140840152615e16818401856158e2565b9b9a5050505050505050505050565b60008219821115615e3857615e38615c83565b500190565b6000816000190483118215151615615e5757615e57615c83565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615e8157615e81615e5c565b500490565b6000600160ff1b821415615e9c57615e9c615c83565b5060000390565b600082615eb257615eb2615e5c565b500690565b60005b83811015615ed2578181015183820152602001615eba565b838111156133bc5750506000910152565b60008251615ef5818460208701615eb7565b9190910192915050565b60008060408385031215615f1257600080fd5b825191506020830151615c5181615683565b8481528360208201526080604082015260008351806080840152615f4f8160a0850160208801615eb7565b606083019390935250601f91909101601f19160160a0019392505050565b600060208284031215615f7f57600080fd5b81516155998161556456fefb75175e7dd144a612469a4316b0a6e4cee24cb54400dfdc7bfe1546cd0e309da2646970667358221220bab7ca22ba7f0c78e8966a0b829254e7d3e1b2cbc13dda910dd083e0c8d0af6464736f6c63430008090033", + "libraries": { + "SortitionSumTreeFactory": "0x26858D60FE92b50b34e236B46874e02724344275" + }, + "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 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 arbitration cost." + } + }, + "changeGovernor(address)": { + "details": "Changes the `governor` storage variable.", + "params": { + "_governor": "The new value for the `governor` storage variable." + } + }, + "changeHiddenVotes(uint96,bool)": { + "details": "Changes the `hiddenVotes` property value of a specified subcourt.", + "params": { + "_hiddenVotes": "The new value for the `hiddenVotes` property value.", + "_subcourtID": "The ID of the subcourt." + } + }, + "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." + } + }, + "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." + } + }, + "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." + } + }, + "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 subcourt (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." + } + }, + "createSubcourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256,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.", + "_supportedDisputeKits": "Indexes of dispute kits that this subcourt will support.", + "_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." + } + }, + "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": { + "_disputeKitIDs": "The IDs of dispute kits which support should be added/removed.", + "_enable": "Whether add or remove the dispute kits from the subcourt.", + "_subcourtID": "The ID of the subcourt." + } + }, + "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": { + "_subcourtID": "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 subcourt.", + "params": { + "_stake": "The new stake.", + "_subcourtID": "The ID of the subcourt." + } + } + }, + "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 + }, + "storageLayout": { + "storage": [ + { + "astId": 2078, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 2081, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "pinakion", + "offset": 0, + "slot": "1", + "type": "t_contract(IERC20)663" + }, + { + "astId": 2083, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "jurorProsecutionModule", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 2086, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "phase", + "offset": 20, + "slot": "2", + "type": "t_enum(Phase)1945" + }, + { + "astId": 2088, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "minStakingTime", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 2090, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "maxFreezingTime", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 2092, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "lastPhaseChange", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 2094, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "freezeBlock", + "offset": 0, + "slot": "6", + "type": "t_uint256" + }, + { + "astId": 2098, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "courts", + "offset": 0, + "slot": "7", + "type": "t_array(t_struct(Court)1975_storage)dyn_storage" + }, + { + "astId": 2102, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disputeKitNodes", + "offset": 0, + "slot": "8", + "type": "t_array(t_struct(DisputeKitNode)2033_storage)dyn_storage" + }, + { + "astId": 2105, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disputesKitIDsThatNeedFreezing", + "offset": 0, + "slot": "9", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 2109, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disputes", + "offset": 0, + "slot": "10", + "type": "t_array(t_struct(Dispute)1992_storage)dyn_storage" + }, + { + "astId": 2114, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "jurors", + "offset": 0, + "slot": "11", + "type": "t_mapping(t_address,t_struct(Juror)2020_storage)" + }, + { + "astId": 2117, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "sortitionSumTrees", + "offset": 0, + "slot": "12", + "type": "t_struct(SortitionSumTrees)19815_storage" + }, + { + "astId": 2122, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "delayedStakes", + "offset": 0, + "slot": "13", + "type": "t_mapping(t_uint256,t_struct(DelayedStake)2042_storage)" + }, + { + "astId": 2124, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "delayedStakeWriteIndex", + "offset": 0, + "slot": "14", + "type": "t_uint256" + }, + { + "astId": 2127, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "delayedStakeReadIndex", + "offset": 0, + "slot": "15", + "type": "t_uint256" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Court)1975_storage)dyn_storage": { + "base": "t_struct(Court)1975_storage", + "encoding": "dynamic_array", + "label": "struct KlerosCore.Court[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Dispute)1992_storage)dyn_storage": { + "base": "t_struct(Dispute)1992_storage", + "encoding": "dynamic_array", + "label": "struct KlerosCore.Dispute[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(DisputeKitNode)2033_storage)dyn_storage": { + "base": "t_struct(DisputeKitNode)2033_storage", + "encoding": "dynamic_array", + "label": "struct KlerosCore.DisputeKitNode[]", + "numberOfBytes": "32" + }, + "t_array(t_struct(Round)2008_storage)dyn_storage": { + "base": "t_struct(Round)2008_storage", + "encoding": "dynamic_array", + "label": "struct KlerosCore.Round[]", + "numberOfBytes": "32" + }, + "t_array(t_uint256)4_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[4]", + "numberOfBytes": "128" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_array(t_uint96)dyn_storage": { + "base": "t_uint96", + "encoding": "dynamic_array", + "label": "uint96[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IArbitrable)1739": { + "encoding": "inplace", + "label": "contract IArbitrable", + "numberOfBytes": "20" + }, + "t_contract(IDisputeKit)1928": { + "encoding": "inplace", + "label": "contract IDisputeKit", + "numberOfBytes": "20" + }, + "t_contract(IERC20)663": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_enum(Period)1951": { + "encoding": "inplace", + "label": "enum KlerosCore.Period", + "numberOfBytes": "1" + }, + "t_enum(Phase)1945": { + "encoding": "inplace", + "label": "enum KlerosCore.Phase", + "numberOfBytes": "1" + }, + "t_mapping(t_address,t_struct(Juror)2020_storage)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => struct KlerosCore.Juror)", + "numberOfBytes": "32", + "value": "t_struct(Juror)2020_storage" + }, + "t_mapping(t_bytes32,t_struct(SortitionSumTree)19809_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct SortitionSumTreeFactory.SortitionSumTree)", + "numberOfBytes": "32", + "value": "t_struct(SortitionSumTree)19809_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_bool)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_mapping(t_uint256,t_struct(DelayedStake)2042_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct KlerosCore.DelayedStake)", + "numberOfBytes": "32", + "value": "t_struct(DelayedStake)2042_storage" + }, + "t_mapping(t_uint96,t_uint256)": { + "encoding": "mapping", + "key": "t_uint96", + "label": "mapping(uint96 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(Court)1975_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.Court", + "members": [ + { + "astId": 1953, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "parent", + "offset": 0, + "slot": "0", + "type": "t_uint96" + }, + { + "astId": 1955, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "hiddenVotes", + "offset": 12, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 1958, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "children", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 1960, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "minStake", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 1962, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "alpha", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 1964, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "feeForJuror", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 1966, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "jurorsForCourtJump", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 1970, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "timesPerPeriod", + "offset": 0, + "slot": "6", + "type": "t_array(t_uint256)4_storage" + }, + { + "astId": 1974, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "supportedDisputeKits", + "offset": 0, + "slot": "10", + "type": "t_mapping(t_uint256,t_bool)" + } + ], + "numberOfBytes": "352" + }, + "t_struct(DelayedStake)2042_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.DelayedStake", + "members": [ + { + "astId": 2035, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "account", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 2037, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "subcourtID", + "offset": 20, + "slot": "0", + "type": "t_uint96" + }, + { + "astId": 2039, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "stake", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 2041, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "penalty", + "offset": 0, + "slot": "2", + "type": "t_uint256" + } + ], + "numberOfBytes": "96" + }, + "t_struct(Dispute)1992_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.Dispute", + "members": [ + { + "astId": 1977, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "subcourtID", + "offset": 0, + "slot": "0", + "type": "t_uint96" + }, + { + "astId": 1980, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "arbitrated", + "offset": 12, + "slot": "0", + "type": "t_contract(IArbitrable)1739" + }, + { + "astId": 1983, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "period", + "offset": 0, + "slot": "1", + "type": "t_enum(Period)1951" + }, + { + "astId": 1985, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "ruled", + "offset": 1, + "slot": "1", + "type": "t_bool" + }, + { + "astId": 1987, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "lastPeriodChange", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 1991, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "rounds", + "offset": 0, + "slot": "3", + "type": "t_array(t_struct(Round)2008_storage)dyn_storage" + } + ], + "numberOfBytes": "128" + }, + "t_struct(DisputeKitNode)2033_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.DisputeKitNode", + "members": [ + { + "astId": 2022, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "parent", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 2025, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "children", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 2028, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disputeKit", + "offset": 0, + "slot": "2", + "type": "t_contract(IDisputeKit)1928" + }, + { + "astId": 2030, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "needsFreezing", + "offset": 20, + "slot": "2", + "type": "t_bool" + }, + { + "astId": 2032, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "depthLevel", + "offset": 0, + "slot": "3", + "type": "t_uint256" + } + ], + "numberOfBytes": "128" + }, + "t_struct(Juror)2020_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.Juror", + "members": [ + { + "astId": 2011, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "subcourtIDs", + "offset": 0, + "slot": "0", + "type": "t_array(t_uint96)dyn_storage" + }, + { + "astId": 2015, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "stakedTokens", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint96,t_uint256)" + }, + { + "astId": 2019, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "lockedTokens", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint96,t_uint256)" + } + ], + "numberOfBytes": "96" + }, + "t_struct(Round)2008_storage": { + "encoding": "inplace", + "label": "struct KlerosCore.Round", + "members": [ + { + "astId": 1994, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "disputeKitID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 1996, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "tokensAtStakePerJuror", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 1998, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "totalFeesForJurors", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 2000, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "nbVotes", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 2002, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "repartitions", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 2004, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "penalties", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 2007, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "drawnJurors", + "offset": 0, + "slot": "6", + "type": "t_array(t_address)dyn_storage" + } + ], + "numberOfBytes": "224" + }, + "t_struct(SortitionSumTree)19809_storage": { + "encoding": "inplace", + "label": "struct SortitionSumTreeFactory.SortitionSumTree", + "members": [ + { + "astId": 19794, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "K", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 19797, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "stack", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 19800, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "nodes", + "offset": 0, + "slot": "2", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 19804, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "IDsToNodeIndexes", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 19808, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "nodeIndexesToIDs", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_uint256,t_bytes32)" + } + ], + "numberOfBytes": "160" + }, + "t_struct(SortitionSumTrees)19815_storage": { + "encoding": "inplace", + "label": "struct SortitionSumTreeFactory.SortitionSumTrees", + "members": [ + { + "astId": 19814, + "contract": "src/arbitration/KlerosCore.sol:KlerosCore", + "label": "sortitionSumTrees", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(SortitionSumTree)19809_storage)" + } + ], + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint96": { + "encoding": "inplace", + "label": "uint96", + "numberOfBytes": "12" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerli/PolicyRegistry.json b/contracts/deployments/arbitrumGoerli/PolicyRegistry.json new file mode 100644 index 000000000..4a3a1243c --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/PolicyRegistry.json @@ -0,0 +1,208 @@ +{ + "address": "0xf637A0a4415CCFB97407846486b6be663d3C33ef", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_subcourtID", + "type": "uint256" + }, + { + "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": "_subcourtID", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_policy", + "type": "string" + } + ], + "name": "setPolicy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x7d2432f632f6cc67631b815b1e302c7ace8ae32474334c9b86b04c0cf473e06b", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xf637A0a4415CCFB97407846486b6be663d3C33ef", + "transactionIndex": 1, + "gasUsed": "377115", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0f23d1869698403901179289154fcd74c5c80024ed024876ff56edb765b32d84", + "transactionHash": "0x7d2432f632f6cc67631b815b1e302c7ace8ae32474334c9b86b04c0cf473e06b", + "logs": [], + "blockNumber": 246010, + "cumulativeGasUsed": "377115", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3" + ], + "numDeployments": 1, + "solcInputHash": "c8bb8c3f437d0a05adb8cac05ba37521", + "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\":\"_subcourtID\",\"type\":\"uint256\"},{\"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\":\"_subcourtID\",\"type\":\"uint256\"},{\"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 subcourt.\",\"events\":{\"PolicyUpdate(uint256,string)\":{\"details\":\"Emitted when a policy is updated.\",\"params\":{\"_policy\":\"The URI of the policy JSON.\",\"_subcourtID\":\"The ID of the policy's subcourt.\"}}},\"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)\":{\"details\":\"Sets the policy for the specified subcourt.\",\"params\":{\"_policy\":\"The URI of the policy JSON.\",\"_subcourtID\":\"The ID of the specified subcourt.\"}}},\"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\":200},\"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 subcourt.\\n */\\ncontract PolicyRegistry {\\n \\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /** \\n * @dev Emitted when a policy is updated.\\n * @param _subcourtID The ID of the policy's subcourt.\\n * @param _policy The URI of the policy JSON.\\n */\\n event PolicyUpdate(uint indexed _subcourtID, string _policy);\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor;\\n mapping(uint => 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 subcourt.\\n * @param _subcourtID The ID of the specified subcourt.\\n * @param _policy The URI of the policy JSON.\\n */\\n function setPolicy(uint _subcourtID, string calldata _policy) external onlyByGovernor {\\n policies[_subcourtID] = _policy;\\n emit PolicyUpdate(_subcourtID, policies[_subcourtID]);\\n }\\n}\",\"keccak256\":\"0x224176fa133ecf1ff7aed4d24b78f90510e097df35853c6af5d12316d24236e0\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516105fe3803806105fe83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61056b806100936000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063d3e8948314610081578063e4c0aaf4146100a1578063f00adf5e146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f366004610338565b6100c9565b6040516100789190610351565b6100b46100af3660046103a6565b610163565b005b6100b46100c43660046103d6565b6101e0565b600160205260009081526040902080546100e290610452565b80601f016020809104026020016040519081016040528092919081815260200182805461010e90610452565b801561015b5780601f106101305761010080835404028352916020019161015b565b820191906000526020600020905b81548152906001019060200180831161013e57829003601f168201915b505050505081565b6000546001600160a01b031633146101be5760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146102365760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064016101b5565b600083815260016020526040902061024f90838361029f565b50827f6363e8b93c0bbb112f6247819a99f3c99f4a3e0f8e119a64e5ceb6edb9b3cc7b60016000868152602001908152602001600020604051610292919061048d565b60405180910390a2505050565b8280546102ab90610452565b90600052602060002090601f0160209004810192826102cd5760008555610313565b82601f106102e65782800160ff19823516178555610313565b82800160010185558215610313579182015b828111156103135782358255916020019190600101906102f8565b5061031f929150610323565b5090565b5b8082111561031f5760008155600101610324565b60006020828403121561034a57600080fd5b5035919050565b600060208083528351808285015260005b8181101561037e57858101830151858201604001528201610362565b81811115610390576000604083870101525b50601f01601f1916929092016040019392505050565b6000602082840312156103b857600080fd5b81356001600160a01b03811681146103cf57600080fd5b9392505050565b6000806000604084860312156103eb57600080fd5b83359250602084013567ffffffffffffffff8082111561040a57600080fd5b818601915086601f83011261041e57600080fd5b81358181111561042d57600080fd5b87602082850101111561043f57600080fd5b6020830194508093505050509250925092565b600181811c9082168061046657607f821691505b6020821081141561048757634e487b7160e01b600052602260045260246000fd5b50919050565b600060208083526000845481600182811c9150808316806104af57607f831692505b8583108114156104cd57634e487b7160e01b85526022600452602485fd5b8786018381526020018180156104ea57600181146104fb57610526565b60ff19861682528782019650610526565b60008b81526020902060005b8681101561052057815484820152908501908901610507565b83019750505b5094999850505050505050505056fea26469706673582212200c1103223f1ae8d623c1720f16b59b98b5d08187d8ac12e3332e184f6d0beead64736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063d3e8948314610081578063e4c0aaf4146100a1578063f00adf5e146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f366004610338565b6100c9565b6040516100789190610351565b6100b46100af3660046103a6565b610163565b005b6100b46100c43660046103d6565b6101e0565b600160205260009081526040902080546100e290610452565b80601f016020809104026020016040519081016040528092919081815260200182805461010e90610452565b801561015b5780601f106101305761010080835404028352916020019161015b565b820191906000526020600020905b81548152906001019060200180831161013e57829003601f168201915b505050505081565b6000546001600160a01b031633146101be5760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146102365760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064016101b5565b600083815260016020526040902061024f90838361029f565b50827f6363e8b93c0bbb112f6247819a99f3c99f4a3e0f8e119a64e5ceb6edb9b3cc7b60016000868152602001908152602001600020604051610292919061048d565b60405180910390a2505050565b8280546102ab90610452565b90600052602060002090601f0160209004810192826102cd5760008555610313565b82601f106102e65782800160ff19823516178555610313565b82800160010185558215610313579182015b828111156103135782358255916020019190600101906102f8565b5061031f929150610323565b5090565b5b8082111561031f5760008155600101610324565b60006020828403121561034a57600080fd5b5035919050565b600060208083528351808285015260005b8181101561037e57858101830151858201604001528201610362565b81811115610390576000604083870101525b50601f01601f1916929092016040019392505050565b6000602082840312156103b857600080fd5b81356001600160a01b03811681146103cf57600080fd5b9392505050565b6000806000604084860312156103eb57600080fd5b83359250602084013567ffffffffffffffff8082111561040a57600080fd5b818601915086601f83011261041e57600080fd5b81358181111561042d57600080fd5b87602082850101111561043f57600080fd5b6020830194508093505050509250925092565b600181811c9082168061046657607f821691505b6020821081141561048757634e487b7160e01b600052602260045260246000fd5b50919050565b600060208083526000845481600182811c9150808316806104af57607f831692505b8583108114156104cd57634e487b7160e01b85526022600452602485fd5b8786018381526020018180156104ea57600181146104fb57610526565b60ff19861682528782019650610526565b60008b81526020902060005b8681101561052057815484820152908501908901610507565b83019750505b5094999850505050505050505056fea26469706673582212200c1103223f1ae8d623c1720f16b59b98b5d08187d8ac12e3332e184f6d0beead64736f6c63430008090033", + "devdoc": { + "author": "Enrique Piqueras - ", + "details": "A contract to maintain a policy for each subcourt.", + "events": { + "PolicyUpdate(uint256,string)": { + "details": "Emitted when a policy is updated.", + "params": { + "_policy": "The URI of the policy JSON.", + "_subcourtID": "The ID of the policy's subcourt." + } + } + }, + "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)": { + "details": "Sets the policy for the specified subcourt.", + "params": { + "_policy": "The URI of the policy JSON.", + "_subcourtID": "The ID of the specified subcourt." + } + } + }, + "title": "PolicyRegistry", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 11, + "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 15, + "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", + "label": "policies", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_string_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_string_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumGoerli/SortitionSumTreeFactory.json b/contracts/deployments/arbitrumGoerli/SortitionSumTreeFactory.json new file mode 100644 index 000000000..c36f54adc --- /dev/null +++ b/contracts/deployments/arbitrumGoerli/SortitionSumTreeFactory.json @@ -0,0 +1,81 @@ +{ + "address": "0x26858D60FE92b50b34e236B46874e02724344275", + "abi": [], + "transactionHash": "0xe5c4898601dbb4af462181e795620033f931e3d53df752d54b666307ef3c61a1", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x26858D60FE92b50b34e236B46874e02724344275", + "transactionIndex": 1, + "gasUsed": "573063", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x5232c03f50c5a8c48d335b346f6aab213b5bce955ac380ecaf01398122fbd1dc", + "transactionHash": "0xe5c4898601dbb4af462181e795620033f931e3d53df752d54b666307ef3c61a1", + "logs": [], + "blockNumber": 92259, + "cumulativeGasUsed": "573063", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "5fd7985a85ea36ff278713e62f7ea890", + "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\":200},\"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": "0x61096861003a600b82828239805160001a60731461002d57634e487b7160e01b600052600060045260246000fd5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80632e25c38a1461005b57806365b81f4f1461007d5780637521ccb1146100a85780639075789e146100c9575b600080fd5b81801561006757600080fd5b5061007b61007636600461077c565b6100e9565b005b61009061008b36600461077c565b610437565b60405161009f939291906107ae565b60405180910390f35b6100bb6100b6366004610807565b6105a2565b60405190815260200161009f565b8180156100d557600080fd5b5061007b6100e4366004610807565b6105f8565b6000838152602085815260408083208484526003810190925290912054806102af5783156102aa5760018201546101fc57506002810180546001808201835560009283526020909220810185905590811480159061015b5750815461014f600183610849565b6101599190610876565b155b156101f757815460009061016f908361088a565b600081815260048501602052604081205491925061018e84600161089e565b9050846002018560020184815481106101a9576101a96108b6565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b610277565b60018083018054909161020e91610849565b8154811061021e5761021e6108b6565b906000526020600020015490508160010180548061023e5761023e6108cc565b600190038181906000526020600020016000905590558382600201828154811061026a5761026a6108b6565b6000918252602090912001555b600083815260038301602090815260408083208490558383526004850190915290208390556102aa8686836001886106be565b61042f565b8361034c5760008260020182815481106102cb576102cb6108b6565b9060005260206000200154905060008360020183815481106102ef576102ef6108b6565b600091825260208083209091019290925560018086018054918201815582528282200184905585815260038501825260408082208290558482526004860190925290812081905561034690889088908590856106be565b5061042f565b816002018181548110610361576103616108b6565b9060005260206000200154841461042f5760008483600201838154811061038a5761038a6108b6565b9060005260206000200154111590506000816103d057858460020184815481106103b6576103b66108b6565b90600052602060002001546103cb9190610849565b6103fb565b8360020183815481106103e5576103e56108b6565b9060005260206000200154866103fb9190610849565b905085846002018481548110610413576104136108b6565b60009182526020909120015561042c88888585856106be565b50505b505050505050565b60008381526020859052604081206060908290815b6002820154811015610494576002820154825461046a9083906108e2565b61047590600161089e565b1061048257809450610494565b8061048c81610901565b91505061044c565b5060006104a1878661089e565b60028301549091506104b3878361089e565b116104be57856104ce565b60028201546104ce908290610849565b67ffffffffffffffff8111156104e6576104e661091c565b60405190808252806020026020018201604052801561050f578160200160208202803683370190505b5093506000815b600284015481101561059457878210156105795783600201818154811061053f5761053f6108b6565b906000526020600020015486838151811061055c5761055c6108b6565b60209081029190910101528161057181610901565b925050610582565b60019450610594565b8061058c81610901565b915050610516565b505050509450945094915050565b60008281526020848152604080832084845260038101909252822054806105cc57600092506105ef565b8160020181815481106105e1576105e16108b6565b906000526020600020015492505b50509392505050565b60008281526020849052604090208054156106515760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b60448201526064015b60405180910390fd5b600182116106a15760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e00000000006044820152606401610648565b908155600201805460018101825560009182526020822001555050565b6000848152602086905260409020835b80156107735781546106e1600183610849565b6106eb919061088a565b9050836107225782826002018281548110610708576107086108b6565b906000526020600020015461071d9190610849565b61074d565b82826002018281548110610738576107386108b6565b906000526020600020015461074d919061089e565b826002018281548110610762576107626108b6565b6000918252602090912001556106ce565b50505050505050565b6000806000806080858703121561079257600080fd5b5050823594602084013594506040840135936060013592509050565b6000606082018583526020606081850152818651808452608086019150828801935060005b818110156107ef578451835293830193918301916001016107d3565b50508093505050508215156040830152949350505050565b60008060006060848603121561081c57600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561085b5761085b610833565b500390565b634e487b7160e01b600052601260045260246000fd5b60008261088557610885610860565b500690565b60008261089957610899610860565b500490565b600082198211156108b1576108b1610833565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60008160001904831182151516156108fc576108fc610833565b500290565b600060001982141561091557610915610833565b5060010190565b634e487b7160e01b600052604160045260246000fdfea264697066735822122058cf627324ea4c721ffb09a792fe9574d0b5013a17a5ec7cbe352bbc4071a41064736f6c63430008090033", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600436106100565760003560e01c80632e25c38a1461005b57806365b81f4f1461007d5780637521ccb1146100a85780639075789e146100c9575b600080fd5b81801561006757600080fd5b5061007b61007636600461077c565b6100e9565b005b61009061008b36600461077c565b610437565b60405161009f939291906107ae565b60405180910390f35b6100bb6100b6366004610807565b6105a2565b60405190815260200161009f565b8180156100d557600080fd5b5061007b6100e4366004610807565b6105f8565b6000838152602085815260408083208484526003810190925290912054806102af5783156102aa5760018201546101fc57506002810180546001808201835560009283526020909220810185905590811480159061015b5750815461014f600183610849565b6101599190610876565b155b156101f757815460009061016f908361088a565b600081815260048501602052604081205491925061018e84600161089e565b9050846002018560020184815481106101a9576101a96108b6565b60009182526020808320909101548354600181018555938352818320909301929092559384526004860180825260408086208690558486526003880183528086208490559285529052909120555b610277565b60018083018054909161020e91610849565b8154811061021e5761021e6108b6565b906000526020600020015490508160010180548061023e5761023e6108cc565b600190038181906000526020600020016000905590558382600201828154811061026a5761026a6108b6565b6000918252602090912001555b600083815260038301602090815260408083208490558383526004850190915290208390556102aa8686836001886106be565b61042f565b8361034c5760008260020182815481106102cb576102cb6108b6565b9060005260206000200154905060008360020183815481106102ef576102ef6108b6565b600091825260208083209091019290925560018086018054918201815582528282200184905585815260038501825260408082208290558482526004860190925290812081905561034690889088908590856106be565b5061042f565b816002018181548110610361576103616108b6565b9060005260206000200154841461042f5760008483600201838154811061038a5761038a6108b6565b9060005260206000200154111590506000816103d057858460020184815481106103b6576103b66108b6565b90600052602060002001546103cb9190610849565b6103fb565b8360020183815481106103e5576103e56108b6565b9060005260206000200154866103fb9190610849565b905085846002018481548110610413576104136108b6565b60009182526020909120015561042c88888585856106be565b50505b505050505050565b60008381526020859052604081206060908290815b6002820154811015610494576002820154825461046a9083906108e2565b61047590600161089e565b1061048257809450610494565b8061048c81610901565b91505061044c565b5060006104a1878661089e565b60028301549091506104b3878361089e565b116104be57856104ce565b60028201546104ce908290610849565b67ffffffffffffffff8111156104e6576104e661091c565b60405190808252806020026020018201604052801561050f578160200160208202803683370190505b5093506000815b600284015481101561059457878210156105795783600201818154811061053f5761053f6108b6565b906000526020600020015486838151811061055c5761055c6108b6565b60209081029190910101528161057181610901565b925050610582565b60019450610594565b8061058c81610901565b915050610516565b505050509450945094915050565b60008281526020848152604080832084845260038101909252822054806105cc57600092506105ef565b8160020181815481106105e1576105e16108b6565b906000526020600020015492505b50509392505050565b60008281526020849052604090208054156106515760405162461bcd60e51b81526020600482015260146024820152732a3932b29030b63932b0b23c9032bc34b9ba399760611b60448201526064015b60405180910390fd5b600182116106a15760405162461bcd60e51b815260206004820152601b60248201527f4b206d7573742062652067726561746572207468616e206f6e652e00000000006044820152606401610648565b908155600201805460018101825560009182526020822001555050565b6000848152602086905260409020835b80156107735781546106e1600183610849565b6106eb919061088a565b9050836107225782826002018281548110610708576107086108b6565b906000526020600020015461071d9190610849565b61074d565b82826002018281548110610738576107386108b6565b906000526020600020015461074d919061089e565b826002018281548110610762576107626108b6565b6000918252602090912001556106ce565b50505050505050565b6000806000806080858703121561079257600080fd5b5050823594602084013594506040840135936060013592509050565b6000606082018583526020606081850152818651808452608086019150828801935060005b818110156107ef578451835293830193918301916001016107d3565b50508093505050508215156040830152949350505050565b60008060006060848603121561081c57600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052601160045260246000fd5b60008282101561085b5761085b610833565b500390565b634e487b7160e01b600052601260045260246000fd5b60008261088557610885610860565b500690565b60008261089957610899610860565b500490565b600082198211156108b1576108b1610833565b500190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b60008160001904831182151516156108fc576108fc610833565b500290565b600060001982141561091557610915610833565b5060010190565b634e487b7160e01b600052604160045260246000fdfea264697066735822122058cf627324ea4c721ffb09a792fe9574d0b5013a17a5ec7cbe352bbc4071a41064736f6c63430008090033", + "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/arbitrumRinkeby/ConstantNG.json b/contracts/deployments/arbitrumRinkeby/ConstantNG.json deleted file mode 100644 index a3c0b94de..000000000 --- a/contracts/deployments/arbitrumRinkeby/ConstantNG.json +++ /dev/null @@ -1,168 +0,0 @@ -{ - "address": "0x4401A368dea8D5761AEEFfd3c4a674086dea0666", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "_number", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_block", - "type": "uint256" - } - ], - "name": "contribute", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_block", - "type": "uint256" - } - ], - "name": "getRN", - "outputs": [ - { - "internalType": "uint256", - "name": "RN", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_block", - "type": "uint256" - } - ], - "name": "getUncorrelatedRN", - "outputs": [ - { - "internalType": "uint256", - "name": "RN", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "number", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_block", - "type": "uint256" - } - ], - "name": "requestRN", - "outputs": [], - "stateMutability": "payable", - "type": "function" - } - ], - "transactionHash": "0xd895745c58c5c5446c2d0cf1c0361948728603c976a6778fd7a88117c360510d", - "receipt": { - "to": null, - "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x4401A368dea8D5761AEEFfd3c4a674086dea0666", - "transactionIndex": 0, - "gasUsed": "1272164", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x7a54453a6c172718f25498599fa57f0e6ecd8d7ea906c5a63994731178695146", - "transactionHash": "0xd895745c58c5c5446c2d0cf1c0361948728603c976a6778fd7a88117c360510d", - "logs": [], - "blockNumber": 9361437, - "cumulativeGasUsed": "7164", - "status": 1, - "byzantium": true - }, - "args": [ - 42 - ], - "numDeployments": 1, - "solcInputHash": "9627b78546d73cee66a2022d221ca6c9", - "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"contribute\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"getRN\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"RN\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"getUncorrelatedRN\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"RN\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"number\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"requestRN\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_number\":\"The number to always return.\"}},\"contribute(uint256)\":{\"details\":\"Contribute to the reward of a random number. All the ETH will be lost forever.\",\"params\":{\"_block\":\"Block the random number is linked to.\"}},\"getRN(uint256)\":{\"details\":\"Get the \\\"random number\\\" (which is always the same).\",\"params\":{\"_block\":\"Block the random number is linked to.\"},\"returns\":{\"RN\":\"Random Number. If the number is not ready or has not been required 0 instead.\"}},\"getUncorrelatedRN(uint256)\":{\"details\":\"Get a uncorrelated random number. Act like getRN but give a different number for each sender. This is to prevent users from getting correlated numbers.\",\"params\":{\"_block\":\"Block the random number is linked to.\"},\"returns\":{\"RN\":\"Random Number. If the number is not ready or has not been required 0 instead.\"}},\"requestRN(uint256)\":{\"details\":\"Request a random number.\",\"params\":{\"_block\":\"Block linked to the request.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/rng/ConstantNG.sol\":\"ConstantNG\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/rng/ConstantNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @title Constant Number Generator\\n * @author Cl\\u00e9ment Lesaege - \\n * @dev A Random Number Generator which always return the same number. Usefull in order to make tests.\\n */\\n\\npragma solidity ^0.8;\\nimport \\\"./RNG.sol\\\";\\n\\ncontract ConstantNG is RNG {\\n uint256 public immutable number;\\n\\n /**\\n * @dev Constructor.\\n * @param _number The number to always return.\\n */\\n constructor(uint256 _number) {\\n number = _number;\\n }\\n\\n /**\\n * @dev Contribute to the reward of a random number. All the ETH will be lost forever.\\n * @param _block Block the random number is linked to.\\n */\\n function contribute(uint256 _block) public payable override {}\\n\\n /**\\n * @dev Get the \\\"random number\\\" (which is always the same).\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getRN(uint256 _block) public view override returns (uint256 RN) {\\n return number;\\n }\\n}\\n\",\"keccak256\":\"0xa36e4dbc69128b01a005e4a9ce79a4c0f555be0963497e7cabdb76028f00e44c\",\"license\":\"MIT\"},\"src/rng/RNG.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@clesaege]\\n * @reviewers: [@remedcu]\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title Random Number Generator Standard\\n * @author Cl\\u00e9ment Lesaege - \\n * @dev This is an abstract contract\\n */\\nabstract contract RNG {\\n /**\\n * @dev Contribute to the reward of a random number.\\n * @param _block Block the random number is linked to.\\n */\\n function contribute(uint256 _block) public payable virtual;\\n\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRN(uint256 _block) public payable {\\n contribute(_block);\\n }\\n\\n /**\\n * @dev Get the random number.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getRN(uint256 _block) public virtual returns (uint256 RN);\\n\\n /**\\n * @dev Get a uncorrelated random number. Act like getRN but give a different number for each sender.\\n * This is to prevent users from getting correlated numbers.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getUncorrelatedRN(uint256 _block) public returns (uint256 RN) {\\n uint256 baseRN = getRN(_block);\\n if (baseRN == 0) return 0;\\n else return uint256(keccak256(abi.encode(msg.sender, baseRN)));\\n }\\n}\\n\",\"keccak256\":\"0x854bcb147fe44383cba7a5fdbcb69b3c0a9a71435c80eb73c172222da472a855\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b5060405161024438038061024483398101604081905261002f91610037565b608052610050565b60006020828403121561004957600080fd5b5051919050565b6080516101cd6100776000396000818160a80152818160f9015261011f01526101cd6000f3fe60806040526004361061004a5760003560e01c80631c73601e1461004f5780637b9c34e0146100815780638381f58a14610096578063c1cbbca7146100ca578063ca4742f1146100db575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461017e565b61011b565b60405190815260200160405180910390f35b61009461008f36600461017e565b6100d8565b005b3480156100a257600080fd5b5061006f7f000000000000000000000000000000000000000000000000000000000000000081565b6100946100d836600461017e565b50565b3480156100e757600080fd5b5061006f6100f636600461017e565b507f000000000000000000000000000000000000000000000000000000000000000090565b60007f00000000000000000000000000000000000000000000000000000000000000008061014c5750600092915050565b6040805133602082015290810182905260600160408051601f1981840301815291905280516020909101209392505050565b60006020828403121561019057600080fd5b503591905056fea2646970667358221220693d5cc66e09ccd6a6d6637ad435b22e4b44841e2e761be701bf91040945c1fc64736f6c634300080a0033", - "deployedBytecode": "0x60806040526004361061004a5760003560e01c80631c73601e1461004f5780637b9c34e0146100815780638381f58a14610096578063c1cbbca7146100ca578063ca4742f1146100db575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461017e565b61011b565b60405190815260200160405180910390f35b61009461008f36600461017e565b6100d8565b005b3480156100a257600080fd5b5061006f7f000000000000000000000000000000000000000000000000000000000000000081565b6100946100d836600461017e565b50565b3480156100e757600080fd5b5061006f6100f636600461017e565b507f000000000000000000000000000000000000000000000000000000000000000090565b60007f00000000000000000000000000000000000000000000000000000000000000008061014c5750600092915050565b6040805133602082015290810182905260600160408051601f1981840301815291905280516020909101209392505050565b60006020828403121561019057600080fd5b503591905056fea2646970667358221220693d5cc66e09ccd6a6d6637ad435b22e4b44841e2e761be701bf91040945c1fc64736f6c634300080a0033", - "devdoc": { - "kind": "dev", - "methods": { - "constructor": { - "details": "Constructor.", - "params": { - "_number": "The number to always return." - } - }, - "contribute(uint256)": { - "details": "Contribute to the reward of a random number. All the ETH will be lost forever.", - "params": { - "_block": "Block the random number is linked to." - } - }, - "getRN(uint256)": { - "details": "Get the \"random number\" (which is always the same).", - "params": { - "_block": "Block the random number is linked to." - }, - "returns": { - "RN": "Random Number. If the number is not ready or has not been required 0 instead." - } - }, - "getUncorrelatedRN(uint256)": { - "details": "Get a uncorrelated random number. Act like getRN but give a different number for each sender. This is to prevent users from getting correlated numbers.", - "params": { - "_block": "Block the random number is linked to." - }, - "returns": { - "RN": "Random Number. If the number is not ready or has not been required 0 instead." - } - }, - "requestRN(uint256)": { - "details": "Request a random number.", - "params": { - "_block": "Block linked to the request." - } - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} diff --git a/contracts/deployments/arbitrumRinkeby/DisputeKitClassic.json b/contracts/deployments/arbitrumRinkeby/DisputeKitClassic.json index 80e919875..a8b496bea 100644 --- a/contracts/deployments/arbitrumRinkeby/DisputeKitClassic.json +++ b/contracts/deployments/arbitrumRinkeby/DisputeKitClassic.json @@ -1,5 +1,5 @@ { - "address": "0x6b9268082415b5499175849E46AaE4EDf819916F", + "address": "0xA2c538AA05BBCc44c213441f6f3777223D2BF9e5", "abi": [ { "inputs": [ @@ -904,19 +904,19 @@ "type": "function" } ], - "transactionHash": "0xe286d868c1b02db0394c4f1c21b04a83a3861b8aa795503eb7c94c3c758fc06a", + "transactionHash": "0x4b45304bb73451188e13c640f8469233418c330fbc60347b56b467d18268389e", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x6b9268082415b5499175849E46AaE4EDf819916F", - "transactionIndex": 0, - "gasUsed": "58776671", + "contractAddress": "0xA2c538AA05BBCc44c213441f6f3777223D2BF9e5", + "transactionIndex": 1, + "gasUsed": "3795502", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x52d660221bef2e23f8764baf26b1d90739cd263ddbab0ad48c711fdf8d8ce548", - "transactionHash": "0xe286d868c1b02db0394c4f1c21b04a83a3861b8aa795503eb7c94c3c758fc06a", + "blockHash": "0x55bd2d69b9b0a124bb59bdcdf9d6df315b912dac22ab468cd6fc9f4badba4404", + "transactionHash": "0x4b45304bb73451188e13c640f8469233418c330fbc60347b56b467d18268389e", "logs": [], - "blockNumber": 13351471, - "cumulativeGasUsed": "27272190", + "blockNumber": 14452891, + "cumulativeGasUsed": "3795502", "status": 1, "byzantium": true }, @@ -925,11 +925,11 @@ "0x0000000000000000000000000000000000000000", "0x078dAd05373d19d7fd6829735b765F12242a4300" ], - "numDeployments": 2, - "solcInputHash": "d464953816050410147003aa7264a227", - "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\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"ChoiceFunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"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\":\"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\":\"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\":\"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\"}],\"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\"}],\"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\":\"getLastRoundResult\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"}],\"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\":\"rng\",\"outputs\":[{\"internalType\":\"contract RNG\",\"name\":\"\",\"type\":\"address\"}],\"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. `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)\":{\"details\":\"Changes the `_rng` storage variable.\",\"params\":{\"_rng\":\"The new value for the `RNGenerator` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_core\":\"The KlerosCore arbitrator.\",\"_governor\":\"The governor's address.\",\"_rng\":\"The random number generator.\"}},\"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\":{\"ruling\":\"The current ruling.\"}},\"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.\"}},\"getLastRoundResult(uint256)\":{\"details\":\"Returns the voting data from the most relevant round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\"},\"returns\":{\"tied\":\"Whether it's a tie or not.\",\"winningChoice\":\"The winning choice of this round.\"}},\"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\":200},\"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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling);\\n\\n /** @dev Returns the voting data from the most relevant round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @return winningChoice The winning choice of this round.\\n * @return tied Whether it's a tie or not.\\n */\\n function getLastRoundResult(uint256 _coreDisputeID) external view returns (uint256 winningChoice, bool tied);\\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(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) 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 )\\n external\\n view\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n );\\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\":\"0x235f027aa27fa972c56d863cfbc33832c8100135cf32d6827294de138e97dd44\",\"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 subcourtID; // The ID of the subcourt 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[] subcourtIDs; // The IDs of subcourts 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 subcourt in the form `stakedTokens[subcourtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the subcourt in the form `lockedTokens[subcourtID]`.\\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 subcourtID; // The ID of the subcourt.\\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 uint256 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint256 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_INDEX = 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 subcourts.\\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 StakeSet(address indexed _address, uint256 _subcourtID, uint256 _amount, uint256 _newTotalStake);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\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 SubcourtCreation(\\n uint256 indexed _subcourtID,\\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 SubcourtModification(uint96 indexed _subcourtID, string _param);\\n event DisputeKitCreation(IDisputeKit indexed _disputeKitAddress, uint256 indexed _parent);\\n event DisputeKitEnable(uint96 indexed _subcourtID, uint256 indexed _disputeKitID);\\n event DisputeKitDisable(uint96 indexed _subcourtID, uint256 indexed _disputeKitID);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromSubcourtID,\\n uint96 _toSubcourtID\\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, \\\"Access not allowed: 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\\n disputeKitNodes.push(); // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: 0,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n needsFreezing: false,\\n depthLevel: 0\\n })\\n );\\n\\n minStakingTime = _phaseTimeouts[0];\\n maxFreezingTime = _phaseTimeouts[1];\\n lastPhaseChange = block.timestamp;\\n\\n // Create the Forking court.\\n courts.push();\\n // TODO: fill the properties for Forking court.\\n\\n // Create the General court.\\n Court storage court = courts.push();\\n court.parent = 1; // TODO: Should the parent for General court be 0 or 1? In the former case the Forking court will become the top court after jumping.\\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 court.supportedDisputeKits[DISPUTE_KIT_CLASSIC_INDEX] = true;\\n\\n // TODO: fill the properties for Forking court.\\n sortitionSumTrees.createTree(bytes32(FORKING_COURT), _sortitionSumTreeK);\\n sortitionSumTrees.createTree(bytes32(GENERAL_COURT), _sortitionSumTreeK);\\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 doesn't exist\\\");\\n uint256 depthLevel;\\n\\n // Create new tree, which root should be supported by General court.\\n if (_parent == NULL_DISPUTE_KIT) {\\n courts[GENERAL_COURT].supportedDisputeKits[disputeKitID] = true;\\n } else {\\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 is at 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 }\\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 * @param _supportedDisputeKits Indexes of dispute kits that this subcourt will support.\\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 uint256[] memory _supportedDisputeKits\\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 require(_supportedDisputeKits.length > 0, \\\"Must support at least one DK\\\");\\n require(_parent != FORKING_COURT, \\\"Can't have Forking court as a parent\\\");\\n\\n uint256 subcourtID = 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(subcourtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(subcourtID);\\n emit SubcourtCreation(\\n subcourtID,\\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 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 == GENERAL_COURT || 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 emit SubcourtModification(_subcourtID, \\\"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 emit SubcourtModification(_subcourtID, \\\"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 emit SubcourtModification(_subcourtID, \\\"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 emit SubcourtModification(_subcourtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeHiddenVotes(uint96 _subcourtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_subcourtID].hiddenVotes = _hiddenVotes;\\n emit SubcourtModification(_subcourtID, \\\"hiddenVotes\\\");\\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(uint96 _subcourtID, uint256[4] memory _timesPerPeriod)\\n external\\n onlyByGovernor\\n {\\n courts[_subcourtID].timesPerPeriod = _timesPerPeriod;\\n emit SubcourtModification(_subcourtID, \\\"timesPerPeriod\\\");\\n }\\n\\n /** @dev Adds/removes court's support for specified dispute kits..\\n * @param _subcourtID The ID of the subcourt.\\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 subcourt.\\n */\\n function enableDisputeKits(\\n uint96 _subcourtID,\\n uint256[] memory _disputeKitIDs,\\n bool _enable\\n ) external onlyByGovernor {\\n Court storage subcourt = courts[_subcourtID];\\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 subcourt.supportedDisputeKits[_disputeKitIDs[i]] = true;\\n emit DisputeKitEnable(_subcourtID, _disputeKitIDs[i]);\\n } else {\\n require(\\n !(_subcourtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't remove root DK support from the general court\\\"\\n );\\n subcourt.supportedDisputeKits[_disputeKitIDs[i]] = false;\\n emit DisputeKitDisable(_subcourtID, _disputeKitIDs[i]);\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\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, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _subcourtID, _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, \\\"Should be in Staking phase.\\\");\\n\\n uint256 actualIterations = (delayedStakeReadIndex + _iterations) - 1 > delayedStakeWriteIndex\\n ? (delayedStakeWriteIndex - delayedStakeReadIndex) + 1\\n : _iterations;\\n uint256 newDelayedStakeReadIndex = delayedStakeReadIndex + actualIterations;\\n\\n for (uint256 i = delayedStakeReadIndex; i < newDelayedStakeReadIndex; i++) {\\n DelayedStake storage delayedStake = delayedStakes[i];\\n setStakeForAccount(delayedStake.account, delayedStake.subcourtID, 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 subcourt (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(uint256 _numberOfChoices, bytes memory _extraData)\\n external\\n payable\\n override\\n returns (uint256 disputeID)\\n {\\n require(msg.value >= arbitrationCost(_extraData), \\\"Not enough ETH to cover arbitration cost.\\\");\\n (uint96 subcourtID, , uint256 disputeKitID) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n\\n require(\\n courts[subcourtID].supportedDisputeKits[disputeKitID],\\n \\\"The dispute kit is not supported by this subcourt\\\"\\n );\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.subcourtID = subcourtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.subcourtID];\\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, \\\"The minimal staking time has not passed yet\\\");\\n require(disputesKitIDsThatNeedFreezing.length > 0, \\\"There are no dispute kit which need 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(), \\\"A dispute kit has not passed to Resolving phase\\\");\\n } else {\\n // Check if the dispute kit is ready for Staking phase.\\n require(disputeKit.isResolving(), \\\"A dispute kit has not passed to 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.subcourtID];\\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 \\\"The evidence period time has not passed yet and it is not an appeal.\\\"\\n );\\n require(round.drawnJurors.length == round.nbVotes, \\\"The dispute has not finished drawing yet.\\\");\\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 \\\"The commit period time has not passed yet.\\\"\\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 \\\"The vote period time has not passed yet\\\"\\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 \\\"The appeal period time has not passed yet.\\\"\\n );\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert(\\\"The dispute is already in the last period.\\\");\\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, \\\"Should be 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.subcourtID] += round.tokensAtStakePerJuror;\\n round.drawnJurors.push(drawnAddress);\\n emit Draw(drawnAddress, _disputeID, currentRound, i);\\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(\\n uint256 _disputeID,\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable {\\n require(msg.value >= appealCost(_disputeID), \\\"Not enough ETH to cover appeal cost.\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.appeal, \\\"Dispute is not appealable.\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n require(\\n msg.sender == address(disputeKitNodes[round.disputeKitID].disputeKit),\\n \\\"Access not allowed: Dispute Kit only.\\\"\\n );\\n\\n uint96 newSubcourtID = dispute.subcourtID;\\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[newDisputeKitID].jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n newSubcourtID = courts[newSubcourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newSubcourtID].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 newSubcourtID = courts[newSubcourtID].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[newSubcourtID].supportedDisputeKits[newDisputeKitID]) {\\n newSubcourtID = uint96(GENERAL_COURT);\\n }\\n\\n if (newSubcourtID != dispute.subcourtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.subcourtID, newSubcourtID);\\n }\\n }\\n\\n dispute.subcourtID = newSubcourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newSubcourtID];\\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(\\n uint256 _disputeID,\\n uint256 _round,\\n uint256 _iterations\\n ) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"Should be 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.subcourtID] -= 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.subcourtID] >= courts[dispute.subcourtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.subcourtID] - penalty;\\n setStakeForAccount(account, dispute.subcourtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.subcourtID] != 0) {\\n setStakeForAccount(account, dispute.subcourtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n for (uint256 j = 0; j < jurors[account].subcourtIDs.length; j++) {\\n setStakeForAccount(account, jurors[account].subcourtIDs[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.subcourtID] -=\\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.subcourtID] == 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, \\\"Should be 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 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)\\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 subcourtID, uint256 minJurors, ) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[subcourtID].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.subcourtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n if (dispute.subcourtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent subcourt.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current subcourt.\\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.subcourtID].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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n return disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round)\\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 Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.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 Dispute storage dispute = disputes[_disputeID];\\n return dispute.rounds.length;\\n }\\n\\n function getJurorBalance(address _juror, uint96 _subcourtID)\\n external\\n view\\n returns (uint256 staked, uint256 locked)\\n {\\n Juror storage juror = jurors[_juror];\\n staked = juror.stakedTokens[_subcourtID];\\n locked = juror.lockedTokens[_subcourtID];\\n }\\n\\n function isSupported(uint96 _subcourtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_subcourtID].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 _subcourtID 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 _subcourtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_subcourtID];\\n timesPerPeriod = court.timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n function getSortitionSumTreeK(bytes32 _key) public view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].K;\\n }\\n\\n function getSortitionSumTreeNode(bytes32 _key, uint256 _index) public view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].nodes[_index];\\n }\\n\\n function getSortitionSumTreeNodesLength(bytes32 _key) public view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].nodes.length;\\n }\\n\\n function getSortitionSumTree(bytes32 _key)\\n public\\n view\\n returns (\\n uint256 K,\\n uint256[] memory stack,\\n uint256[] memory nodes\\n )\\n {\\n SortitionSumTreeFactory.SortitionSumTree storage tree = sortitionSumTrees.sortitionSumTrees[_key];\\n K = tree.K;\\n stack = tree.stack;\\n nodes = tree.nodes;\\n }\\n\\n // TODO: some getters can be merged into a single function\\n function getSortitionSumTreeID(bytes32 _key, uint256 _nodeIndex) external view returns (bytes32 ID) {\\n ID = sortitionSumTrees.sortitionSumTrees[_key].nodeIndexesToIDs[_nodeIndex];\\n }\\n\\n function getSubcourtID(uint256 _disputeID) external view returns (uint256 subcourtID) {\\n return disputes[_disputeID].subcourtID;\\n }\\n\\n function getCurrentPeriod(uint256 _disputeID) external view returns (Period period) {\\n return disputes[_disputeID].period;\\n }\\n\\n function areVotesHidden(uint256 _subcourtID) external view returns (bool hiddenVotes) {\\n return courts[_subcourtID].hiddenVotes;\\n }\\n\\n function isRuled(uint256 _disputeID) external view returns (bool) {\\n return disputes[_disputeID].ruled;\\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 getFreezeBlock() external view returns (uint256) {\\n return freezeBlock;\\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) public 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.subcourtID];\\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 getLastRoundResult(uint256 _disputeID) external view returns (uint256 winningChoice, bool tied) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (winningChoice, tied) = disputeKitNodes[round.disputeKitID].disputeKit.getLastRoundResult(_disputeID);\\n }\\n\\n function getDisputeKitNodesLength() external view returns (uint256) {\\n return disputeKitNodes.length;\\n }\\n\\n function getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\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 * @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 _subcourtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_subcourtID == FORKING_COURT || _subcourtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_subcourtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_subcourtID].minStake || _stake < juror.lockedTokens[_subcourtID]) return false;\\n if (currentStake == 0 && juror.subcourtIDs.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 subcourtID: _subcourtID,\\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.subcourtIDs.push(_subcourtID);\\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[_subcourtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\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 }\\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[_subcourtID] - currentStake + _stake;\\n juror.stakedTokens[_subcourtID] = newTotalStake;\\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 == GENERAL_COURT) finished = true;\\n else currentSubcourtID = courts[currentSubcourtID].parent;\\n }\\n\\n emit StakeSet(_account, _subcourtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a subcourt 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 subcourt ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return subcourtID The subcourt ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\n function extraDataToSubcourtIDMinJurorsDisputeKit(bytes memory _extraData)\\n internal\\n view\\n returns (\\n uint96 subcourtID,\\n uint256 minJurors,\\n uint256 disputeKitID\\n )\\n {\\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 subcourtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (subcourtID == FORKING_COURT || subcourtID >= courts.length) {\\n subcourtID = uint96(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_INDEX; // 0 index is not used.\\n }\\n } else {\\n subcourtID = uint96(GENERAL_COURT);\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC_INDEX;\\n }\\n }\\n\\n /** @dev Packs an account and a subcourt ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _subcourtID The subcourt ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndSubcourtIDToStakePathID(address _account, uint96 _subcourtID)\\n internal\\n pure\\n returns (bytes32 stakePathID)\\n {\\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 /** @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(\\n address _from,\\n address _to,\\n uint256 _value\\n ) 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\":\"0xe51c00b74782151959e5a5c311afb7d7dcc715a6de7e8be2932f2c96ca4e9a58\",\"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 RNBlock; // The block number when the random number was requested.\\n uint256 public RN; // 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 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 */\\n constructor(\\n address _governor,\\n KlerosCore _core,\\n RNG _rng\\n ) BaseDisputeKit(_governor, _core) {\\n rng = _rng;\\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 */\\n function changeRandomNumberGenerator(RNG _rng) external onlyByGovernor {\\n rng = _rng;\\n // TODO: if current phase is generating, call rng.requestRN() for the next block\\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 }\\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 require(block.number >= core.getFreezeBlock() + 20, \\\"Too soon: L1 finality required\\\");\\n // TODO: RNG process is currently unfinished.\\n RNBlock = block.number;\\n rng.requestRN(block.number);\\n phase = Phase.generating;\\n } else if (phase == Phase.generating) {\\n RN = rng.getRN(RNBlock);\\n require(RN != 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(uint256 _coreDisputeID)\\n external\\n override\\n onlyByCore\\n notJumped(_coreDisputeID)\\n returns (address drawnAddress)\\n {\\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 bytes32 key = bytes32(core.getSubcourtID(_coreDisputeID)); // Get the ID of the tree.\\n uint256 drawnNumber = getRandomNumber();\\n\\n uint256 K = core.getSortitionSumTreeK(key);\\n uint256 nodesLength = core.getSortitionSumTreeNodesLength(key);\\n uint256 treeIndex = 0;\\n uint256 currentDrawnNumber = drawnNumber % 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.getSortitionSumTreeID(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.\\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 require(\\n core.getCurrentPeriod(_coreDisputeID) == KlerosCore.Period.commit,\\n \\\"The dispute should be in Commit period.\\\"\\n );\\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 require(round.votes[_voteIDs[i]].commit == bytes32(0), \\\"Already committed this vote.\\\");\\n round.votes[_voteIDs[i]].commit = _commit;\\n }\\n round.totalCommitted += _voteIDs.length;\\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 require(\\n core.getCurrentPeriod(_coreDisputeID) == KlerosCore.Period.vote,\\n \\\"The dispute should be in Vote period.\\\"\\n );\\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 bool hiddenVotes = core.areVotesHidden(core.getSubcourtID(_coreDisputeID));\\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 subcourts 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 if (this.currentRuling(_coreDisputeID) == _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 require(core.isRuled(_coreDisputeID), \\\"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 /** @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 */\\n function currentRuling(uint256 _coreDisputeID) external view override returns (uint256 ruling) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n ruling = round.tied ? 0 : round.winningChoice;\\n }\\n\\n function getLastRoundResult(uint256 _coreDisputeID)\\n external\\n view\\n override\\n returns (uint256 winningChoice, bool tied)\\n {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage lastRound = dispute.rounds[dispute.rounds.length - 1];\\n return (lastRound.winningChoice, lastRound.tied);\\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.getLastRoundResult(_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.getLastRoundResult(_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 )\\n external\\n view\\n override\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n )\\n {\\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 uint256 subcourtID = core.getSubcourtID(_coreDisputeID);\\n (uint256 lockedAmountPerJuror, , , , , ) = core.getRoundInfo(\\n _coreDisputeID,\\n core.getNumberOfRounds(_coreDisputeID) - 1\\n );\\n (uint256 stakedTokens, uint256 lockedTokens) = core.getJurorBalance(_juror, uint96(subcourtID));\\n return stakedTokens >= lockedTokens + lockedAmountPerJuror;\\n }\\n\\n /** @dev RNG function\\n * @return rn A random number.\\n */\\n function getRandomNumber() internal returns (uint256) {\\n return rng.getUncorrelatedRN(block.number);\\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\":\"0x38afcc3437782ccd29918a3cc4185a757ef71ae10481daecf57d64aa56b824a6\",\"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\\n/**\\n * @authors: [@clesaege]\\n * @reviewers: [@remedcu]\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title Random Number Generator Standard\\n * @author Cl\\u00e9ment Lesaege - \\n * @dev This is an abstract contract\\n */\\nabstract contract RNG {\\n /**\\n * @dev Contribute to the reward of a random number.\\n * @param _block Block the random number is linked to.\\n */\\n function contribute(uint256 _block) public payable virtual;\\n\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRN(uint256 _block) public payable {\\n contribute(_block);\\n }\\n\\n /**\\n * @dev Get the random number.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getRN(uint256 _block) public virtual returns (uint256 RN);\\n\\n /**\\n * @dev Get a uncorrelated random number. Act like getRN but give a different number for each sender.\\n * This is to prevent users from getting correlated numbers.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getUncorrelatedRN(uint256 _block) public returns (uint256 RN) {\\n uint256 baseRN = getRN(_block);\\n if (baseRN == 0) return 0;\\n else return uint256(keccak256(abi.encode(msg.sender, baseRN)));\\n }\\n}\\n\",\"keccak256\":\"0x854bcb147fe44383cba7a5fdbcb69b3c0a9a71435c80eb73c172222da472a855\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506040516200437d3803806200437d833981016040819052620000349162000090565b600080546001600160a01b039485166001600160a01b031991821617909155600180549385169382169390931790925560028054919093169116179055620000e4565b6001600160a01b03811681146200008d57600080fd5b50565b600080600060608486031215620000a657600080fd5b8351620000b38162000077565b6020850151909350620000c68162000077565b6040850151909250620000d98162000077565b809150509250925092565b61428980620000f46000396000f3fe6080604052600436106102045760003560e01c8063796490f911610118578063ba66fde7116100a0578063d605787b1161006f578063d605787b14610638578063da3beb8c14610658578063e349ad3014610479578063e4c0aaf414610678578063f2f4eb261461069857600080fd5b8063ba66fde7146105cd578063be467604146105ed578063c41bda6114610603578063c86ed8921461062357600080fd5b8063a6a7f0eb116100e7578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b8063796490f9146104795780637c04034e1461048f5780638e426460146104af5780639b05c261146104cf57600080fd5b80633b3041471161019b5780635c92e2f61161016a5780635c92e2f6146103b65780635e4a627d146103d657806369f3f041146103ec5780636d4cd8ea14610439578063751accd01461045957600080fd5b80633b304147146103345780634b2f0ea0146103545780634fe264fb14610367578063564a565d1461038757600080fd5b80630c340a24116101d75780630c340a241461028f5780631200aabc146102c75780631c3db16d146102f4578063362c34791461031457600080fd5b8063023d44df1461020957806303432744146102325780630b274f2e146102485780630baa64d11461025f575b600080fd5b34801561021557600080fd5b5061021f60035481565b6040519081526020015b60405180910390f35b34801561023e57600080fd5b5061021f60065481565b34801561025457600080fd5b5061025d6106b8565b005b34801561026b57600080fd5b5061027f61027a3660046138aa565b610c8a565b6040519015158152602001610229565b34801561029b57600080fd5b506000546102af906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102d357600080fd5b5061021f6102e23660046138aa565b60086020526000908152604090205481565b34801561030057600080fd5b5061021f61030f3660046138aa565b610d01565b34801561032057600080fd5b5061021f61032f3660046138db565b610d8b565b34801561034057600080fd5b506102af61034f3660046138aa565b61116d565b61025d610362366004613918565b611787565b34801561037357600080fd5b5061021f61038236600461393a565b612021565b34801561039357600080fd5b506103a76103a23660046138aa565b612171565b604051610229939291906139be565b3480156103c257600080fd5b5061025d6103d1366004613a34565b612237565b3480156103e257600080fd5b5061021f60045481565b3480156103f857600080fd5b5061040c61040736600461393a565b6125bc565b604080519687529415156020870152938501929092526060840152608083015260a082015260c001610229565b34801561044557600080fd5b5061027f6104543660046138aa565b612674565b34801561046557600080fd5b5061025d610474366004613b26565b6126eb565b34801561048557600080fd5b5061021f61271081565b34801561049b57600080fd5b5061025d6104aa366004613b93565b6127bd565b3480156104bb57600080fd5b5061025d6104ca366004613c2c565b612ec5565b3480156104db57600080fd5b506104ef6104ea3660046138aa565b612f11565b60408051928352901515602083015201610229565b34801561051057600080fd5b5061025d61051f366004613c8b565b612f94565b34801561053057600080fd5b5061054461053f36600461393a565b612fe6565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610229565b34801561057c57600080fd5b5060055461058a9060ff1681565b6040516102299190613ced565b3480156105a357600080fd5b5061021f614e2081565b3480156105b957600080fd5b5061025d6105c8366004613d15565b6130ac565b3480156105d957600080fd5b5061027f6105e836600461393a565b613265565b3480156105f957600080fd5b5061021f61138881565b34801561060f57600080fd5b5061025d61061e366004613c2c565b613300565b34801561062f57600080fd5b5061027f61334c565b34801561064457600080fd5b506002546102af906001600160a01b031681565b34801561066457600080fd5b5061021f610673366004613918565b61336c565b34801561068457600080fd5b5061025d610693366004613c2c565b6134cc565b3480156106a457600080fd5b506001546102af906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106fd57600080fd5b505afa158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190613d70565b600181111561074657610746613cd7565b14806107d35750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190613da6565b1561085e57600060055460ff1660028111156107f1576107f1613cd7565b14156108445760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600580546000919060ff19166001835b0217905550610c49565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ad57600080fd5b505afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e59190613d70565b60018111156108f6576108f6613cd7565b1415610c4957600060055460ff16600281111561091557610915613cd7565b1415610ac45760006006541161096d5760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f727300000000604482015260640161083b565b600160009054906101000a90046001600160a01b03166001600160a01b031663fa4148806040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f39190613dc1565b6109fe906014613df0565b431015610a4d5760405162461bcd60e51b815260206004820152601e60248201527f546f6f20736f6f6e3a204c312066696e616c6974792072657175697265640000604482015260640161083b565b4360038190556002546040516303dce1a760e51b815260048101929092526001600160a01b031690637b9c34e090602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050600580546001935090915060ff19168280610854565b600160055460ff166002811115610add57610add613cd7565b1415610bcf5760025460035460405163ca4742f160e01b81526001600160a01b039092169163ca4742f191610b189160040190815260200190565b602060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613dc1565b6004819055610bbb5760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161083b565b600580546002919060ff1916600183610854565b600260055460ff166002811115610be857610be8613cd7565b1415610c495760065415610c3e5760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e67207068617365000000604482015260640161083b565b6005805460ff191690555b6005546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c809160ff90911690613ced565b60405180910390a1565b600081815260086020526040812054600780548392908110610cae57610cae613e08565b60009182526020822060059091020180549092508290610cd090600190613e1e565b81548110610ce057610ce0613e08565b60009182526020909120600c90910201805460059091015414949350505050565b600081815260086020526040812054600780548392908110610d2557610d25613e08565b60009182526020822060059091020180549092508290610d4790600190613e1e565b81548110610d5757610d57613e08565b60009182526020909120600c90910201600381015490915060ff16610d80578060010154610d83565b60005b949350505050565b6001546040516325bfe6d160e11b8152600481018690526000916001600160a01b031690634b7fcda29060240160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e089190613da6565b610e545760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e0000000000604482015260640161083b565b600085815260086020526040812054600780549091908110610e7857610e78613e08565b60009182526020808320878452600360059093020191820190526040822054815491935083918110610eac57610eac613e08565b600091825260208220600154604051631c3db16d60e01b8152600481018c9052600c9390930290910193506001600160a01b031690631c3db16d9060240160206040518083038186803b158015610f0257600080fd5b505afa158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190613dc1565b600086815260078401602052604090205490915060ff16610f82576001600160a01b0387166000908152600883016020908152604080832088845290915290205493506110c8565b80851415610ff8576000858152600683016020526040902054610fa6576000610ff1565b600085815260068301602090815260408083205460098601546001600160a01b038c1685526008870184528285208a8652909352922054610fe79190613e35565b610ff19190613e6a565b93506110c8565b600081815260078301602052604090205460ff166110c85781600601600083600a0160018154811061102c5761102c613e08565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061106257611062613e08565b90600052602060002001548152602001908152602001600020546110869190613df0565b60098301546001600160a01b038916600090815260088501602090815260408083208a84529091529020546110bb9190613e35565b6110c59190613e6a565b93505b6001600160a01b038716600090815260088301602090815260408083208884529091528120558315611162576040516001600160a01b0388169085156108fc029086906000818181858888f1505060408051898152602081018990526001600160a01b038c1694508a93508c92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b505050949350505050565b6001546000906001600160a01b0316331461119a5760405162461bcd60e51b815260040161083b90613e7e565b6000828152600860205260409020546007805484929081106111be576111be613e08565b600091825260209091206002600590920201015460ff16156111f25760405162461bcd60e51b815260040161083b90613ec2565b600260055460ff16600281111561120b5761120b613cd7565b146112585760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e67207068617365000000000000604482015260640161083b565b60008381526008602052604081205460078054909190811061127c5761127c613e08565b6000918252602082206005909102018054909250829061129e90600190613e1e565b815481106112ae576112ae613e08565b600091825260208220600154604051637b5377bd60e11b8152600481018a9052600c9390930290910193506001600160a01b03169063f6a6ef7a9060240160206040518083038186803b15801561130457600080fd5b505afa158015611318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133c9190613dc1565b90506000611348613518565b60015460405163bd8193bb60e01b8152600481018590529192506000916001600160a01b039091169063bd8193bb9060240160206040518083038186803b15801561139257600080fd5b505afa1580156113a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ca9190613dc1565b60015460405163a9b713af60e01b8152600481018690529192506000916001600160a01b039091169063a9b713af9060240160206040518083038186803b15801561141457600080fd5b505afa158015611428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144c9190613dc1565b600154604051630a48b58160e21b81526004810187905260006024820181905292935082916001600160a01b031690632922d6049060440160206040518083038186803b15801561149c57600080fd5b505afa1580156114b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d49190613dc1565b6114de9086613ef9565b90505b826114ec8386613e35565b6114f7906001613df0565b10156115e45760015b8481116115de576000816115148588613e35565b61151e9190613df0565b600154604051630a48b58160e21b8152600481018b9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561156f57600080fd5b505afa158015611583573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a79190613dc1565b90508084106115c1576115ba8185613e1e565b93506115c9565b5092506115de565b505080806115d690613f0d565b915050611500565b506114e1565b60015460405163de1a1e5960e01b815260048101889052602481018490526000916001600160a01b03169063de1a1e599060440160206040518083038186803b15801561163057600080fd5b505afa158015611644573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116689190613dc1565b90506116738161359b565b9a5061167f8c8c6135c6565b15611773578760000160405180608001604052808d6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505087600b01548860000180549050141561176e576006805490600061176883613f28565b91905055505b611778565b60009a505b50505050505050505050919050565b6000828152600860205260409020546007805484929081106117ab576117ab613e08565b600091825260209091206002600590920201015460ff16156117df5760405162461bcd60e51b815260040161083b90613ec2565b60008381526008602052604081205460078054909190811061180357611803613e08565b9060005260206000209060050201905080600101548311156118675760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e604482015260640161083b565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b1580156118af57600080fd5b505afa1580156118c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e79190613f3f565b915091508142101580156118fa57508042105b61193f5760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b604482015260640161083b565b604051631c3db16d60e01b81526004810187905260009086903090631c3db16d9060240160206040518083038186803b15801561197b57600080fd5b505afa15801561198f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b39190613dc1565b14156119c25750612710611a42565b6127106113886119d28585613e1e565b6119dc9190613e35565b6119e69190613e6a565b6119f08442613e1e565b10611a3d5760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f73657200604482015260640161083b565b50614e205b83546000908590611a5590600190613e1e565b81548110611a6557611a65613e08565b60009182526020822060018054604051637e37c78b60e11b8152600481018e9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611abf57600080fd5b505afa158015611ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af79190613dc1565b611b019190613e1e565b600089815260078401602052604090205490915060ff1615611b655760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e0000000000604482015260640161083b565b600154604051632cf6413f60e11b8152600481018b90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611baa57600080fd5b505afa158015611bbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be29190613dc1565b90506000612710611bf38684613e35565b611bfd9190613e6a565b611c079083613df0565b60008b815260068601602052604081205491925090821115611caa5760008b81526006860160205260409020543490611c409084613e1e565b11611c655760008b8152600686016020526040902054611c609083613e1e565b611c67565b345b604080518d815260208101839052919250339186918f917fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c0910160405180910390a45b33600090815260088601602090815260408083208e845290915281208054839290611cd6908490613df0565b909155505060008b815260068601602052604081208054839290611cfb908490613df0565b909155505060008b81526006860160205260409020548211611da55760008b815260068601602052604081205460098701805491929091611d3d908490613df0565b9091555050600a8501805460018181018355600092835260208084209092018e90558d8352600788019091526040808320805460ff1916909217909155518c9186918f917fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00991a45b600a85015460011015611fe557828560090154611dc29190613e1e565b60098601556001546040516319b8152960e01b8152600481018e90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611e0b57600080fd5b505afa158015611e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e439190613da6565b15611e5c5760028901805460ff19166001179055611f65565b885460038a016000611e6f876001613df0565b8152602001908152602001600020819055506000896000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538e6040518263ffffffff1660e01b8152600401611eea91815260200190565b60206040518083038186803b158015611f0257600080fd5b505afa158015611f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3a9190613dc1565b600b82015560038101805460ff1916600117905560068054906000611f5e83613f0d565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848e8c600101548d6004016040518563ffffffff1660e01b8152600401611fb293929190613f9e565b6000604051808303818588803b158015611fcb57600080fd5b505af1158015611fdf573d6000803e3d6000fd5b50505050505b8034111561201357336108fc611ffb8334613e1e565b6040518115909202916000818181858888f150505050505b505050505050505050505050565b60008381526008602052604081205460078054839290811061204557612045613e08565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061207957612079613e08565b90600052602060002090600c0201600001848154811061209b5761209b613e08565b600091825260208220600154604051639b05c26160e01b815260048082018c905293909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b1580156120f357600080fd5b505afa158015612107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212b9190614056565b6003850154919350915060ff16801561214e5750818360020154148061214e5750805b156121615761271094505050505061216a565b60009450505050505b9392505050565b6007818154811061218157600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff90911692916121b490613f63565b80601f01602080910402602001604051908101604052809291908181526020018280546121e090613f63565b801561222d5780601f106122025761010080835404028352916020019161222d565b820191906000526020600020905b81548152906001019060200180831161221057829003601f168201915b5050505050905083565b60008481526008602052604090205460078054869290811061225b5761225b613e08565b600091825260209091206002600590920201015460ff161561228f5760405162461bcd60e51b815260040161083b90613ec2565b6001805460405163022684db60e41b8152600481018890526001600160a01b03909116906322684db09060240160206040518083038186803b1580156122d457600080fd5b505afa1580156122e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061230c9190614082565b600481111561231d5761231d613cd7565b1461237a5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b606482015260840161083b565b816123b75760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b604482015260640161083b565b6000858152600860205260408120546007805490919081106123db576123db613e08565b600091825260208220600590910201805490925082906123fd90600190613e1e565b8154811061240d5761240d613e08565b90600052602060002090600c0201905060005b8581101561259657338288888481811061243c5761243c613e08565b905060200201358154811061245357612453613e08565b60009182526020909120600490910201546001600160a01b0316146124ba5760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b6000828888848181106124cf576124cf613e08565b90506020020135815481106124e6576124e6613e08565b906000526020600020906004020160010154146125455760405162461bcd60e51b815260206004820152601c60248201527f416c726561647920636f6d6d6974746564207468697320766f74652e00000000604482015260640161083b565b848288888481811061255957612559613e08565b905060200201358154811061257057612570613e08565b60009182526020909120600160049092020101558061258e81613f0d565b915050612420565b50858590508160050160008282546125ae9190613df0565b909155505050505050505050565b60008060008060008060006007600860008c815260200190815260200160002054815481106125ed576125ed613e08565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061262157612621613e08565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b60008181526008602052604081205460078054839290811061269857612698613e08565b600091825260208220600590910201805490925082906126ba90600190613e1e565b815481106126ca576126ca613e08565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146127155760405162461bcd60e51b815260040161083b906140a3565b6000836001600160a01b0316838360405161273091906140e5565b60006040518083038185875af1925050503d806000811461276d576040519150601f19603f3d011682016040523d82523d6000602084013e612772565b606091505b50509050806127b75760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b604482015260640161083b565b50505050565b6000868152600860205260409020546007805488929081106127e1576127e1613e08565b600091825260209091206002600590920201015460ff16156128155760405162461bcd60e51b815260040161083b90613ec2565b60015460405163022684db60e41b8152600481018990526002916001600160a01b0316906322684db09060240160206040518083038186803b15801561285a57600080fd5b505afa15801561286e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128929190614082565b60048111156128a3576128a3613cd7565b146128fe5760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b606482015260840161083b565b846129405760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b604482015260640161083b565b60008781526008602052604081205460078054909190811061296457612964613e08565b9060005260206000209060050201905080600101548511156129bf5760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b604482015260640161083b565b805460009082906129d290600190613e1e565b815481106129e2576129e2613e08565b600091825260208220600154604051637b5377bd60e11b8152600481018e9052600c9390930290910193506001600160a01b03169063d578cbac90829063f6a6ef7a9060240160206040518083038186803b158015612a4057600080fd5b505afa158015612a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a789190613dc1565b6040518263ffffffff1660e01b8152600401612a9691815260200190565b60206040518083038186803b158015612aae57600080fd5b505afa158015612ac2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae69190613da6565b905060005b88811015612d8f5733838b8b84818110612b0757612b07613e08565b9050602002013581548110612b1e57612b1e613e08565b60009182526020909120600490910201546001600160a01b031614612b855760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b811580612bf95750878688604051602001612ba293929190614101565b60405160208183030381529060405280519060200120836000018b8b84818110612bce57612bce613e08565b9050602002013581548110612be557612be5613e08565b906000526020600020906004020160010154145b612c6d576040805162461bcd60e51b81526020600482015260248101919091527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20737562636f7572747320776974682068696464656e20766f7465732e606482015260840161083b565b828a8a83818110612c8057612c80613e08565b9050602002013581548110612c9757612c97613e08565b600091825260209091206003600490920201015460ff1615612cf05760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b604482015260640161083b565b87838b8b84818110612d0457612d04613e08565b9050602002013581548110612d1b57612d1b613e08565b60009182526020909120600260049092020101556001838b8b84818110612d4457612d44613e08565b9050602002013581548110612d5b57612d5b613e08565b60009182526020909120600490910201600301805460ff191691151591909117905580612d8781613f0d565b915050612aeb565b5088889050826004016000828254612da79190613df0565b90915550506000878152600283016020526040812080548a9290612dcc908490613df0565b90915550506001820154871415612dfc57600382015460ff1615612df75760038201805460ff191690555b612e76565b60018201546000908152600283016020526040808220548983529120541415612e3f57600382015460ff16612df75760038201805460ff19166001179055612e76565b60018201546000908152600283016020526040808220548983529120541115612e76576001820187905560038201805460ff191690555b86336001600160a01b03168b7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd88604051612eb1919061412e565b60405180910390a450505050505050505050565b6000546001600160a01b03163314612eef5760405162461bcd60e51b815260040161083b906140a3565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120546007805483928392918110612f3757612f37613e08565b60009182526020822060059091020180549092508290612f5990600190613e1e565b81548110612f6957612f69613e08565b60009182526020909120600c909102016001810154600390910154909660ff90911695509350505050565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c90612fd99087908790614141565b60405180910390a4505050565b60008060008060006007600860008a8152602001908152602001600020548154811061301457613014613e08565b600091825260208083208a845260036005909302019182019052604082205481549193508391811061304857613048613e08565b90600052602060002090600c0201600001878154811061306a5761306a613e08565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146130d65760405162461bcd60e51b815260040161083b90613e7e565b60078054600181018255600091909152600581027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68981018690557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688810190613161907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c018686613811565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b1580156131b357600080fd5b505afa1580156131c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131eb9190613dc1565b6131f59190613e1e565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a84526008909252822084905560068054919261325683613f0d565b91905055505050505050505050565b60008381526008602052604081205460078054839290811061328957613289613e08565b600091825260208083208784526003600590930201918201905260408220548154919350839181106132bd576132bd613e08565b90600052602060002090600c020160000184815481106132df576132df613e08565b600091825260209091206004909102016003015460ff169695505050505050565b6000546001600160a01b0316331461332a5760405162461bcd60e51b815260040161083b906140a3565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008060055460ff16600281111561336657613366613cd7565b14905090565b60008281526008602052604081205460078054839290811061339057613390613e08565b600091825260208083208684526003600590930201918201905260408220548154919350839181106133c4576133c4613e08565b600091825260208220600154604051639b05c26160e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561341d57600080fd5b505afa158015613431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134559190614056565b9150915082600401546000148061348357508015801561348357506000828152600284016020526040902054155b156134955760009450505050506134c6565b80156134aa5750506004015491506134c69050565b5060009081526002909101602052604090205491506134c69050565b92915050565b6000546001600160a01b031633146134f65760405162461bcd60e51b815260040161083b906140a3565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254604051630e39b00f60e11b81524360048201526000916001600160a01b031690631c73601e90602401602060405180830381600087803b15801561355e57600080fd5b505af1158015613572573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135969190613dc1565b905090565b600060405160005b60148110156135be5783811a81600c840101536001016135a3565b505192915050565b600154604051637b5377bd60e11b81526004810184905260009182916001600160a01b039091169063f6a6ef7a9060240160206040518083038186803b15801561360f57600080fd5b505afa158015613623573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136479190613dc1565b60018054604051637e37c78b60e11b8152600481018890529293506000926001600160a01b0390911691638a9bb02a91889190849063fc6f8f169060240160206040518083038186803b15801561369d57600080fd5b505afa1580156136b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136d59190613dc1565b6136df9190613e1e565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b15801561371b57600080fd5b505afa15801561372f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526137579190810190614170565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526bffffffffffffffffffffffff89166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b1580156137bc57600080fd5b505afa1580156137d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137f49190613f3f565b90925090506138038382613df0565b909110159695505050505050565b82805461381d90613f63565b90600052602060002090601f01602090048101928261383f5760008555613885565b82601f106138585782800160ff19823516178555613885565b82800160010185558215613885579182015b8281111561388557823582559160200191906001019061386a565b50613891929150613895565b5090565b5b808211156138915760008155600101613896565b6000602082840312156138bc57600080fd5b5035919050565b6001600160a01b03811681146138d857600080fd5b50565b600080600080608085870312156138f157600080fd5b843593506020850135613903816138c3565b93969395505050506040820135916060013590565b6000806040838503121561392b57600080fd5b50508035926020909101359150565b60008060006060848603121561394f57600080fd5b505081359360208301359350604090920135919050565b60005b83811015613981578181015183820152602001613969565b838111156127b75750506000910152565b600081518084526139aa816020860160208601613966565b601f01601f19169290920160200192915050565b83815282151560208201526060604082015260006139df6060830184613992565b95945050505050565b60008083601f8401126139fa57600080fd5b50813567ffffffffffffffff811115613a1257600080fd5b6020830191508360208260051b8501011115613a2d57600080fd5b9250929050565b60008060008060608587031215613a4a57600080fd5b84359350602085013567ffffffffffffffff811115613a6857600080fd5b613a74878288016139e8565b9598909750949560400135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613ac657613ac6613a87565b604052919050565b600067ffffffffffffffff831115613ae857613ae8613a87565b613afb601f8401601f1916602001613a9d565b9050828152838383011115613b0f57600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613b3b57600080fd5b8335613b46816138c3565b925060208401359150604084013567ffffffffffffffff811115613b6957600080fd5b8401601f81018613613b7a57600080fd5b613b8986823560208401613ace565b9150509250925092565b60008060008060008060a08789031215613bac57600080fd5b86359550602087013567ffffffffffffffff80821115613bcb57600080fd5b613bd78a838b016139e8565b909750955060408901359450606089013593506080890135915080821115613bfe57600080fd5b508701601f81018913613c1057600080fd5b613c1f89823560208401613ace565b9150509295509295509295565b600060208284031215613c3e57600080fd5b813561216a816138c3565b60008083601f840112613c5b57600080fd5b50813567ffffffffffffffff811115613c7357600080fd5b602083019150836020828501011115613a2d57600080fd5b600080600060408486031215613ca057600080fd5b83359250602084013567ffffffffffffffff811115613cbe57600080fd5b613cca86828701613c49565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613d0f57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613d2d57600080fd5b8535945060208601359350604086013567ffffffffffffffff811115613d5257600080fd5b613d5e88828901613c49565b96999598509660600135949350505050565b600060208284031215613d8257600080fd5b81516002811061216a57600080fd5b80518015158114613da157600080fd5b919050565b600060208284031215613db857600080fd5b61216a82613d91565b600060208284031215613dd357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613e0357613e03613dda565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613e3057613e30613dda565b500390565b6000816000190483118215151615613e4f57613e4f613dda565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613e7957613e79613e54565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600082613f0857613f08613e54565b500690565b6000600019821415613f2157613f21613dda565b5060010190565b600081613f3757613f37613dda565b506000190190565b60008060408385031215613f5257600080fd5b505080516020909101519092909150565b600181811c90821680613f7757607f821691505b60208210811415613f9857634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c915080831680613fcc57607f831692505b858310811415613fea57634e487b7160e01b85526022600452602485fd5b6060880183905260808801818015614009576001811461401a57614045565b60ff19861682528782019650614045565b60008b81526020902060005b8681101561403f57815484820152908501908901614026565b83019750505b50949b9a5050505050505050505050565b6000806040838503121561406957600080fd5b8251915061407960208401613d91565b90509250929050565b60006020828403121561409457600080fd5b81516005811061216a57600080fd5b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600082516140f7818460208701613966565b9190910192915050565b83815260008351614119816020850160208801613966565b60209201918201929092526040019392505050565b60208152600061216a6020830184613992565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008060008060008060c0878903121561418957600080fd5b8651955060208088015195506040880151945060608801519350608088015167ffffffffffffffff808211156141be57600080fd5b818a0191508a601f8301126141d257600080fd5b8151818111156141e4576141e4613a87565b8060051b91506141f5848301613a9d565b818152918301840191848101908d84111561420f57600080fd5b938501935b838510156142395784519250614229836138c3565b8282529385019390850190614214565b80975050505050505060a08701519050929550929550929556fea26469706673582212208e82a277937d9dbc9540fe7c121229d1eeefa292845a46fddcf1066d43881db064736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106102045760003560e01c8063796490f911610118578063ba66fde7116100a0578063d605787b1161006f578063d605787b14610638578063da3beb8c14610658578063e349ad3014610479578063e4c0aaf414610678578063f2f4eb261461069857600080fd5b8063ba66fde7146105cd578063be467604146105ed578063c41bda6114610603578063c86ed8921461062357600080fd5b8063a6a7f0eb116100e7578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b8063796490f9146104795780637c04034e1461048f5780638e426460146104af5780639b05c261146104cf57600080fd5b80633b3041471161019b5780635c92e2f61161016a5780635c92e2f6146103b65780635e4a627d146103d657806369f3f041146103ec5780636d4cd8ea14610439578063751accd01461045957600080fd5b80633b304147146103345780634b2f0ea0146103545780634fe264fb14610367578063564a565d1461038757600080fd5b80630c340a24116101d75780630c340a241461028f5780631200aabc146102c75780631c3db16d146102f4578063362c34791461031457600080fd5b8063023d44df1461020957806303432744146102325780630b274f2e146102485780630baa64d11461025f575b600080fd5b34801561021557600080fd5b5061021f60035481565b6040519081526020015b60405180910390f35b34801561023e57600080fd5b5061021f60065481565b34801561025457600080fd5b5061025d6106b8565b005b34801561026b57600080fd5b5061027f61027a3660046138aa565b610c8a565b6040519015158152602001610229565b34801561029b57600080fd5b506000546102af906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102d357600080fd5b5061021f6102e23660046138aa565b60086020526000908152604090205481565b34801561030057600080fd5b5061021f61030f3660046138aa565b610d01565b34801561032057600080fd5b5061021f61032f3660046138db565b610d8b565b34801561034057600080fd5b506102af61034f3660046138aa565b61116d565b61025d610362366004613918565b611787565b34801561037357600080fd5b5061021f61038236600461393a565b612021565b34801561039357600080fd5b506103a76103a23660046138aa565b612171565b604051610229939291906139be565b3480156103c257600080fd5b5061025d6103d1366004613a34565b612237565b3480156103e257600080fd5b5061021f60045481565b3480156103f857600080fd5b5061040c61040736600461393a565b6125bc565b604080519687529415156020870152938501929092526060840152608083015260a082015260c001610229565b34801561044557600080fd5b5061027f6104543660046138aa565b612674565b34801561046557600080fd5b5061025d610474366004613b26565b6126eb565b34801561048557600080fd5b5061021f61271081565b34801561049b57600080fd5b5061025d6104aa366004613b93565b6127bd565b3480156104bb57600080fd5b5061025d6104ca366004613c2c565b612ec5565b3480156104db57600080fd5b506104ef6104ea3660046138aa565b612f11565b60408051928352901515602083015201610229565b34801561051057600080fd5b5061025d61051f366004613c8b565b612f94565b34801561053057600080fd5b5061054461053f36600461393a565b612fe6565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610229565b34801561057c57600080fd5b5060055461058a9060ff1681565b6040516102299190613ced565b3480156105a357600080fd5b5061021f614e2081565b3480156105b957600080fd5b5061025d6105c8366004613d15565b6130ac565b3480156105d957600080fd5b5061027f6105e836600461393a565b613265565b3480156105f957600080fd5b5061021f61138881565b34801561060f57600080fd5b5061025d61061e366004613c2c565b613300565b34801561062f57600080fd5b5061027f61334c565b34801561064457600080fd5b506002546102af906001600160a01b031681565b34801561066457600080fd5b5061021f610673366004613918565b61336c565b34801561068457600080fd5b5061025d610693366004613c2c565b6134cc565b3480156106a457600080fd5b506001546102af906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106fd57600080fd5b505afa158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190613d70565b600181111561074657610746613cd7565b14806107d35750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190613da6565b1561085e57600060055460ff1660028111156107f1576107f1613cd7565b14156108445760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600580546000919060ff19166001835b0217905550610c49565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ad57600080fd5b505afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e59190613d70565b60018111156108f6576108f6613cd7565b1415610c4957600060055460ff16600281111561091557610915613cd7565b1415610ac45760006006541161096d5760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f727300000000604482015260640161083b565b600160009054906101000a90046001600160a01b03166001600160a01b031663fa4148806040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f39190613dc1565b6109fe906014613df0565b431015610a4d5760405162461bcd60e51b815260206004820152601e60248201527f546f6f20736f6f6e3a204c312066696e616c6974792072657175697265640000604482015260640161083b565b4360038190556002546040516303dce1a760e51b815260048101929092526001600160a01b031690637b9c34e090602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050600580546001935090915060ff19168280610854565b600160055460ff166002811115610add57610add613cd7565b1415610bcf5760025460035460405163ca4742f160e01b81526001600160a01b039092169163ca4742f191610b189160040190815260200190565b602060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613dc1565b6004819055610bbb5760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161083b565b600580546002919060ff1916600183610854565b600260055460ff166002811115610be857610be8613cd7565b1415610c495760065415610c3e5760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e67207068617365000000604482015260640161083b565b6005805460ff191690555b6005546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c809160ff90911690613ced565b60405180910390a1565b600081815260086020526040812054600780548392908110610cae57610cae613e08565b60009182526020822060059091020180549092508290610cd090600190613e1e565b81548110610ce057610ce0613e08565b60009182526020909120600c90910201805460059091015414949350505050565b600081815260086020526040812054600780548392908110610d2557610d25613e08565b60009182526020822060059091020180549092508290610d4790600190613e1e565b81548110610d5757610d57613e08565b60009182526020909120600c90910201600381015490915060ff16610d80578060010154610d83565b60005b949350505050565b6001546040516325bfe6d160e11b8152600481018690526000916001600160a01b031690634b7fcda29060240160206040518083038186803b158015610dd057600080fd5b505afa158015610de4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e089190613da6565b610e545760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e0000000000604482015260640161083b565b600085815260086020526040812054600780549091908110610e7857610e78613e08565b60009182526020808320878452600360059093020191820190526040822054815491935083918110610eac57610eac613e08565b600091825260208220600154604051631c3db16d60e01b8152600481018c9052600c9390930290910193506001600160a01b031690631c3db16d9060240160206040518083038186803b158015610f0257600080fd5b505afa158015610f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f3a9190613dc1565b600086815260078401602052604090205490915060ff16610f82576001600160a01b0387166000908152600883016020908152604080832088845290915290205493506110c8565b80851415610ff8576000858152600683016020526040902054610fa6576000610ff1565b600085815260068301602090815260408083205460098601546001600160a01b038c1685526008870184528285208a8652909352922054610fe79190613e35565b610ff19190613e6a565b93506110c8565b600081815260078301602052604090205460ff166110c85781600601600083600a0160018154811061102c5761102c613e08565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061106257611062613e08565b90600052602060002001548152602001908152602001600020546110869190613df0565b60098301546001600160a01b038916600090815260088501602090815260408083208a84529091529020546110bb9190613e35565b6110c59190613e6a565b93505b6001600160a01b038716600090815260088301602090815260408083208884529091528120558315611162576040516001600160a01b0388169085156108fc029086906000818181858888f1505060408051898152602081018990526001600160a01b038c1694508a93508c92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b505050949350505050565b6001546000906001600160a01b0316331461119a5760405162461bcd60e51b815260040161083b90613e7e565b6000828152600860205260409020546007805484929081106111be576111be613e08565b600091825260209091206002600590920201015460ff16156111f25760405162461bcd60e51b815260040161083b90613ec2565b600260055460ff16600281111561120b5761120b613cd7565b146112585760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e67207068617365000000000000604482015260640161083b565b60008381526008602052604081205460078054909190811061127c5761127c613e08565b6000918252602082206005909102018054909250829061129e90600190613e1e565b815481106112ae576112ae613e08565b600091825260208220600154604051637b5377bd60e11b8152600481018a9052600c9390930290910193506001600160a01b03169063f6a6ef7a9060240160206040518083038186803b15801561130457600080fd5b505afa158015611318573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061133c9190613dc1565b90506000611348613518565b60015460405163bd8193bb60e01b8152600481018590529192506000916001600160a01b039091169063bd8193bb9060240160206040518083038186803b15801561139257600080fd5b505afa1580156113a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ca9190613dc1565b60015460405163a9b713af60e01b8152600481018690529192506000916001600160a01b039091169063a9b713af9060240160206040518083038186803b15801561141457600080fd5b505afa158015611428573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144c9190613dc1565b600154604051630a48b58160e21b81526004810187905260006024820181905292935082916001600160a01b031690632922d6049060440160206040518083038186803b15801561149c57600080fd5b505afa1580156114b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d49190613dc1565b6114de9086613ef9565b90505b826114ec8386613e35565b6114f7906001613df0565b10156115e45760015b8481116115de576000816115148588613e35565b61151e9190613df0565b600154604051630a48b58160e21b8152600481018b9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561156f57600080fd5b505afa158015611583573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a79190613dc1565b90508084106115c1576115ba8185613e1e565b93506115c9565b5092506115de565b505080806115d690613f0d565b915050611500565b506114e1565b60015460405163de1a1e5960e01b815260048101889052602481018490526000916001600160a01b03169063de1a1e599060440160206040518083038186803b15801561163057600080fd5b505afa158015611644573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116689190613dc1565b90506116738161359b565b9a5061167f8c8c6135c6565b15611773578760000160405180608001604052808d6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505087600b01548860000180549050141561176e576006805490600061176883613f28565b91905055505b611778565b60009a505b50505050505050505050919050565b6000828152600860205260409020546007805484929081106117ab576117ab613e08565b600091825260209091206002600590920201015460ff16156117df5760405162461bcd60e51b815260040161083b90613ec2565b60008381526008602052604081205460078054909190811061180357611803613e08565b9060005260206000209060050201905080600101548311156118675760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e604482015260640161083b565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b1580156118af57600080fd5b505afa1580156118c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e79190613f3f565b915091508142101580156118fa57508042105b61193f5760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b604482015260640161083b565b604051631c3db16d60e01b81526004810187905260009086903090631c3db16d9060240160206040518083038186803b15801561197b57600080fd5b505afa15801561198f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b39190613dc1565b14156119c25750612710611a42565b6127106113886119d28585613e1e565b6119dc9190613e35565b6119e69190613e6a565b6119f08442613e1e565b10611a3d5760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f73657200604482015260640161083b565b50614e205b83546000908590611a5590600190613e1e565b81548110611a6557611a65613e08565b60009182526020822060018054604051637e37c78b60e11b8152600481018e9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611abf57600080fd5b505afa158015611ad3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611af79190613dc1565b611b019190613e1e565b600089815260078401602052604090205490915060ff1615611b655760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e0000000000604482015260640161083b565b600154604051632cf6413f60e11b8152600481018b90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611baa57600080fd5b505afa158015611bbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be29190613dc1565b90506000612710611bf38684613e35565b611bfd9190613e6a565b611c079083613df0565b60008b815260068601602052604081205491925090821115611caa5760008b81526006860160205260409020543490611c409084613e1e565b11611c655760008b8152600686016020526040902054611c609083613e1e565b611c67565b345b604080518d815260208101839052919250339186918f917fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c0910160405180910390a45b33600090815260088601602090815260408083208e845290915281208054839290611cd6908490613df0565b909155505060008b815260068601602052604081208054839290611cfb908490613df0565b909155505060008b81526006860160205260409020548211611da55760008b815260068601602052604081205460098701805491929091611d3d908490613df0565b9091555050600a8501805460018181018355600092835260208084209092018e90558d8352600788019091526040808320805460ff1916909217909155518c9186918f917fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00991a45b600a85015460011015611fe557828560090154611dc29190613e1e565b60098601556001546040516319b8152960e01b8152600481018e90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611e0b57600080fd5b505afa158015611e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e439190613da6565b15611e5c5760028901805460ff19166001179055611f65565b885460038a016000611e6f876001613df0565b8152602001908152602001600020819055506000896000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538e6040518263ffffffff1660e01b8152600401611eea91815260200190565b60206040518083038186803b158015611f0257600080fd5b505afa158015611f16573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f3a9190613dc1565b600b82015560038101805460ff1916600117905560068054906000611f5e83613f0d565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848e8c600101548d6004016040518563ffffffff1660e01b8152600401611fb293929190613f9e565b6000604051808303818588803b158015611fcb57600080fd5b505af1158015611fdf573d6000803e3d6000fd5b50505050505b8034111561201357336108fc611ffb8334613e1e565b6040518115909202916000818181858888f150505050505b505050505050505050505050565b60008381526008602052604081205460078054839290811061204557612045613e08565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061207957612079613e08565b90600052602060002090600c0201600001848154811061209b5761209b613e08565b600091825260208220600154604051639b05c26160e01b815260048082018c905293909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b1580156120f357600080fd5b505afa158015612107573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061212b9190614056565b6003850154919350915060ff16801561214e5750818360020154148061214e5750805b156121615761271094505050505061216a565b60009450505050505b9392505050565b6007818154811061218157600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff90911692916121b490613f63565b80601f01602080910402602001604051908101604052809291908181526020018280546121e090613f63565b801561222d5780601f106122025761010080835404028352916020019161222d565b820191906000526020600020905b81548152906001019060200180831161221057829003601f168201915b5050505050905083565b60008481526008602052604090205460078054869290811061225b5761225b613e08565b600091825260209091206002600590920201015460ff161561228f5760405162461bcd60e51b815260040161083b90613ec2565b6001805460405163022684db60e41b8152600481018890526001600160a01b03909116906322684db09060240160206040518083038186803b1580156122d457600080fd5b505afa1580156122e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061230c9190614082565b600481111561231d5761231d613cd7565b1461237a5760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b606482015260840161083b565b816123b75760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b604482015260640161083b565b6000858152600860205260408120546007805490919081106123db576123db613e08565b600091825260208220600590910201805490925082906123fd90600190613e1e565b8154811061240d5761240d613e08565b90600052602060002090600c0201905060005b8581101561259657338288888481811061243c5761243c613e08565b905060200201358154811061245357612453613e08565b60009182526020909120600490910201546001600160a01b0316146124ba5760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b6000828888848181106124cf576124cf613e08565b90506020020135815481106124e6576124e6613e08565b906000526020600020906004020160010154146125455760405162461bcd60e51b815260206004820152601c60248201527f416c726561647920636f6d6d6974746564207468697320766f74652e00000000604482015260640161083b565b848288888481811061255957612559613e08565b905060200201358154811061257057612570613e08565b60009182526020909120600160049092020101558061258e81613f0d565b915050612420565b50858590508160050160008282546125ae9190613df0565b909155505050505050505050565b60008060008060008060006007600860008c815260200190815260200160002054815481106125ed576125ed613e08565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061262157612621613e08565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b60008181526008602052604081205460078054839290811061269857612698613e08565b600091825260208220600590910201805490925082906126ba90600190613e1e565b815481106126ca576126ca613e08565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146127155760405162461bcd60e51b815260040161083b906140a3565b6000836001600160a01b0316838360405161273091906140e5565b60006040518083038185875af1925050503d806000811461276d576040519150601f19603f3d011682016040523d82523d6000602084013e612772565b606091505b50509050806127b75760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b604482015260640161083b565b50505050565b6000868152600860205260409020546007805488929081106127e1576127e1613e08565b600091825260209091206002600590920201015460ff16156128155760405162461bcd60e51b815260040161083b90613ec2565b60015460405163022684db60e41b8152600481018990526002916001600160a01b0316906322684db09060240160206040518083038186803b15801561285a57600080fd5b505afa15801561286e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128929190614082565b60048111156128a3576128a3613cd7565b146128fe5760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b606482015260840161083b565b846129405760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b604482015260640161083b565b60008781526008602052604081205460078054909190811061296457612964613e08565b9060005260206000209060050201905080600101548511156129bf5760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b604482015260640161083b565b805460009082906129d290600190613e1e565b815481106129e2576129e2613e08565b600091825260208220600154604051637b5377bd60e11b8152600481018e9052600c9390930290910193506001600160a01b03169063d578cbac90829063f6a6ef7a9060240160206040518083038186803b158015612a4057600080fd5b505afa158015612a54573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a789190613dc1565b6040518263ffffffff1660e01b8152600401612a9691815260200190565b60206040518083038186803b158015612aae57600080fd5b505afa158015612ac2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae69190613da6565b905060005b88811015612d8f5733838b8b84818110612b0757612b07613e08565b9050602002013581548110612b1e57612b1e613e08565b60009182526020909120600490910201546001600160a01b031614612b855760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b811580612bf95750878688604051602001612ba293929190614101565b60405160208183030381529060405280519060200120836000018b8b84818110612bce57612bce613e08565b9050602002013581548110612be557612be5613e08565b906000526020600020906004020160010154145b612c6d576040805162461bcd60e51b81526020600482015260248101919091527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20737562636f7572747320776974682068696464656e20766f7465732e606482015260840161083b565b828a8a83818110612c8057612c80613e08565b9050602002013581548110612c9757612c97613e08565b600091825260209091206003600490920201015460ff1615612cf05760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b604482015260640161083b565b87838b8b84818110612d0457612d04613e08565b9050602002013581548110612d1b57612d1b613e08565b60009182526020909120600260049092020101556001838b8b84818110612d4457612d44613e08565b9050602002013581548110612d5b57612d5b613e08565b60009182526020909120600490910201600301805460ff191691151591909117905580612d8781613f0d565b915050612aeb565b5088889050826004016000828254612da79190613df0565b90915550506000878152600283016020526040812080548a9290612dcc908490613df0565b90915550506001820154871415612dfc57600382015460ff1615612df75760038201805460ff191690555b612e76565b60018201546000908152600283016020526040808220548983529120541415612e3f57600382015460ff16612df75760038201805460ff19166001179055612e76565b60018201546000908152600283016020526040808220548983529120541115612e76576001820187905560038201805460ff191690555b86336001600160a01b03168b7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd88604051612eb1919061412e565b60405180910390a450505050505050505050565b6000546001600160a01b03163314612eef5760405162461bcd60e51b815260040161083b906140a3565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120546007805483928392918110612f3757612f37613e08565b60009182526020822060059091020180549092508290612f5990600190613e1e565b81548110612f6957612f69613e08565b60009182526020909120600c909102016001810154600390910154909660ff90911695509350505050565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c90612fd99087908790614141565b60405180910390a4505050565b60008060008060006007600860008a8152602001908152602001600020548154811061301457613014613e08565b600091825260208083208a845260036005909302019182019052604082205481549193508391811061304857613048613e08565b90600052602060002090600c0201600001878154811061306a5761306a613e08565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146130d65760405162461bcd60e51b815260040161083b90613e7e565b60078054600181018255600091909152600581027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68981018690557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688810190613161907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c018686613811565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b1580156131b357600080fd5b505afa1580156131c7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131eb9190613dc1565b6131f59190613e1e565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a84526008909252822084905560068054919261325683613f0d565b91905055505050505050505050565b60008381526008602052604081205460078054839290811061328957613289613e08565b600091825260208083208784526003600590930201918201905260408220548154919350839181106132bd576132bd613e08565b90600052602060002090600c020160000184815481106132df576132df613e08565b600091825260209091206004909102016003015460ff169695505050505050565b6000546001600160a01b0316331461332a5760405162461bcd60e51b815260040161083b906140a3565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008060055460ff16600281111561336657613366613cd7565b14905090565b60008281526008602052604081205460078054839290811061339057613390613e08565b600091825260208083208684526003600590930201918201905260408220548154919350839181106133c4576133c4613e08565b600091825260208220600154604051639b05c26160e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561341d57600080fd5b505afa158015613431573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134559190614056565b9150915082600401546000148061348357508015801561348357506000828152600284016020526040902054155b156134955760009450505050506134c6565b80156134aa5750506004015491506134c69050565b5060009081526002909101602052604090205491506134c69050565b92915050565b6000546001600160a01b031633146134f65760405162461bcd60e51b815260040161083b906140a3565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254604051630e39b00f60e11b81524360048201526000916001600160a01b031690631c73601e90602401602060405180830381600087803b15801561355e57600080fd5b505af1158015613572573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135969190613dc1565b905090565b600060405160005b60148110156135be5783811a81600c840101536001016135a3565b505192915050565b600154604051637b5377bd60e11b81526004810184905260009182916001600160a01b039091169063f6a6ef7a9060240160206040518083038186803b15801561360f57600080fd5b505afa158015613623573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136479190613dc1565b60018054604051637e37c78b60e11b8152600481018890529293506000926001600160a01b0390911691638a9bb02a91889190849063fc6f8f169060240160206040518083038186803b15801561369d57600080fd5b505afa1580156136b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136d59190613dc1565b6136df9190613e1e565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b15801561371b57600080fd5b505afa15801561372f573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526137579190810190614170565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526bffffffffffffffffffffffff89166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b1580156137bc57600080fd5b505afa1580156137d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137f49190613f3f565b90925090506138038382613df0565b909110159695505050505050565b82805461381d90613f63565b90600052602060002090601f01602090048101928261383f5760008555613885565b82601f106138585782800160ff19823516178555613885565b82800160010185558215613885579182015b8281111561388557823582559160200191906001019061386a565b50613891929150613895565b5090565b5b808211156138915760008155600101613896565b6000602082840312156138bc57600080fd5b5035919050565b6001600160a01b03811681146138d857600080fd5b50565b600080600080608085870312156138f157600080fd5b843593506020850135613903816138c3565b93969395505050506040820135916060013590565b6000806040838503121561392b57600080fd5b50508035926020909101359150565b60008060006060848603121561394f57600080fd5b505081359360208301359350604090920135919050565b60005b83811015613981578181015183820152602001613969565b838111156127b75750506000910152565b600081518084526139aa816020860160208601613966565b601f01601f19169290920160200192915050565b83815282151560208201526060604082015260006139df6060830184613992565b95945050505050565b60008083601f8401126139fa57600080fd5b50813567ffffffffffffffff811115613a1257600080fd5b6020830191508360208260051b8501011115613a2d57600080fd5b9250929050565b60008060008060608587031215613a4a57600080fd5b84359350602085013567ffffffffffffffff811115613a6857600080fd5b613a74878288016139e8565b9598909750949560400135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613ac657613ac6613a87565b604052919050565b600067ffffffffffffffff831115613ae857613ae8613a87565b613afb601f8401601f1916602001613a9d565b9050828152838383011115613b0f57600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613b3b57600080fd5b8335613b46816138c3565b925060208401359150604084013567ffffffffffffffff811115613b6957600080fd5b8401601f81018613613b7a57600080fd5b613b8986823560208401613ace565b9150509250925092565b60008060008060008060a08789031215613bac57600080fd5b86359550602087013567ffffffffffffffff80821115613bcb57600080fd5b613bd78a838b016139e8565b909750955060408901359450606089013593506080890135915080821115613bfe57600080fd5b508701601f81018913613c1057600080fd5b613c1f89823560208401613ace565b9150509295509295509295565b600060208284031215613c3e57600080fd5b813561216a816138c3565b60008083601f840112613c5b57600080fd5b50813567ffffffffffffffff811115613c7357600080fd5b602083019150836020828501011115613a2d57600080fd5b600080600060408486031215613ca057600080fd5b83359250602084013567ffffffffffffffff811115613cbe57600080fd5b613cca86828701613c49565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613d0f57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613d2d57600080fd5b8535945060208601359350604086013567ffffffffffffffff811115613d5257600080fd5b613d5e88828901613c49565b96999598509660600135949350505050565b600060208284031215613d8257600080fd5b81516002811061216a57600080fd5b80518015158114613da157600080fd5b919050565b600060208284031215613db857600080fd5b61216a82613d91565b600060208284031215613dd357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613e0357613e03613dda565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613e3057613e30613dda565b500390565b6000816000190483118215151615613e4f57613e4f613dda565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613e7957613e79613e54565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600082613f0857613f08613e54565b500690565b6000600019821415613f2157613f21613dda565b5060010190565b600081613f3757613f37613dda565b506000190190565b60008060408385031215613f5257600080fd5b505080516020909101519092909150565b600181811c90821680613f7757607f821691505b60208210811415613f9857634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c915080831680613fcc57607f831692505b858310811415613fea57634e487b7160e01b85526022600452602485fd5b6060880183905260808801818015614009576001811461401a57614045565b60ff19861682528782019650614045565b60008b81526020902060005b8681101561403f57815484820152908501908901614026565b83019750505b50949b9a5050505050505050505050565b6000806040838503121561406957600080fd5b8251915061407960208401613d91565b90509250929050565b60006020828403121561409457600080fd5b81516005811061216a57600080fd5b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600082516140f7818460208701613966565b9190910192915050565b83815260008351614119816020850160208801613966565b60209201918201929092526040019392505050565b60208152600061216a6020830184613992565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008060008060008060c0878903121561418957600080fd5b8651955060208088015195506040880151945060608801519350608088015167ffffffffffffffff808211156141be57600080fd5b818a0191508a601f8301126141d257600080fd5b8151818111156141e4576141e4613a87565b8060051b91506141f5848301613a9d565b818152918301840191848101908d84111561420f57600080fd5b938501935b838510156142395784519250614229836138c3565b8282529385019390850190614214565b80975050505050505060a08701519050929550929550929556fea26469706673582212208e82a277937d9dbc9540fe7c121229d1eeefa292845a46fddcf1066d43881db064736f6c63430008090033", + "numDeployments": 4, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreRoundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_choice\",\"type\":\"uint256\"}],\"name\":\"ChoiceFunded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_coreDisputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"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\":\"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\":\"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\":\"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\"}],\"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\"}],\"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\":\"getLastRoundResult\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"}],\"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\":\"rng\",\"outputs\":[{\"internalType\":\"contract RNG\",\"name\":\"\",\"type\":\"address\"}],\"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)\":{\"details\":\"Changes the `_rng` storage variable.\",\"params\":{\"_rng\":\"The new value for the `RNGenerator` storage variable.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_core\":\"The KlerosCore arbitrator.\",\"_governor\":\"The governor's address.\",\"_rng\":\"The random number generator.\"}},\"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\":{\"ruling\":\"The current ruling.\"}},\"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.\"}},\"getLastRoundResult(uint256)\":{\"details\":\"Returns the voting data from the most relevant round.\",\"params\":{\"_coreDisputeID\":\"The ID of the dispute in Kleros Core, not in the Dispute Kit.\"},\"returns\":{\"tied\":\"Whether it's a tie or not.\",\"winningChoice\":\"The winning choice of this round.\"}},\"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\":200},\"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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling);\\n\\n /** @dev Returns the voting data from the most relevant round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @return winningChoice The winning choice of this round.\\n * @return tied Whether it's a tie or not.\\n */\\n function getLastRoundResult(uint256 _coreDisputeID) external view returns (uint256 winningChoice, bool tied);\\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(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) 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 )\\n external\\n view\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n );\\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\":\"0x235f027aa27fa972c56d863cfbc33832c8100135cf32d6827294de138e97dd44\",\"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 subcourtID; // The ID of the subcourt 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[] subcourtIDs; // The IDs of subcourts 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 subcourt in the form `stakedTokens[subcourtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the subcourt in the form `lockedTokens[subcourtID]`.\\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 subcourtID; // The ID of the subcourt.\\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 subcourts.\\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 _subcourtID, 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 SubcourtCreated(\\n uint256 indexed _subcourtID,\\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 SubcourtModified(uint96 indexed _subcourtID, string _param);\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _subcourtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromSubcourtID,\\n uint96 _toSubcourtID\\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 SubcourtCreated.\\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 SubcourtCreated(\\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 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 * @param _supportedDisputeKits Indexes of dispute kits that this subcourt will support.\\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 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 subcourtID = 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(subcourtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(subcourtID);\\n emit SubcourtCreated(\\n subcourtID,\\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 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(\\n _subcourtID == GENERAL_COURT || courts[courts[_subcourtID].parent].minStake <= _minStake,\\n \\\"MinStake lower than parent court\\\"\\n );\\n for (uint256 i = 0; i < courts[_subcourtID].children.length; i++) {\\n require(courts[courts[_subcourtID].children[i]].minStake >= _minStake, \\\"MinStake lower than parent court\\\");\\n }\\n\\n courts[_subcourtID].minStake = _minStake;\\n emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeHiddenVotes(uint96 _subcourtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_subcourtID].hiddenVotes = _hiddenVotes;\\n emit SubcourtModified(_subcourtID, \\\"hiddenVotes\\\");\\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(uint96 _subcourtID, uint256[4] memory _timesPerPeriod)\\n external\\n onlyByGovernor\\n {\\n courts[_subcourtID].timesPerPeriod = _timesPerPeriod;\\n emit SubcourtModified(_subcourtID, \\\"timesPerPeriod\\\");\\n }\\n\\n /** @dev Adds/removes court's support for specified dispute kits.\\n * @param _subcourtID The ID of the subcourt.\\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 subcourt.\\n */\\n function enableDisputeKits(\\n uint96 _subcourtID,\\n uint256[] memory _disputeKitIDs,\\n bool _enable\\n ) external onlyByGovernor {\\n Court storage subcourt = courts[_subcourtID];\\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(_subcourtID, _disputeKitIDs[i], true);\\n } else {\\n require(\\n !(_subcourtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't disable Root DK in General\\\"\\n );\\n enableDisputeKit(_subcourtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\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, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _subcourtID, _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.subcourtID, 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 subcourt (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(uint256 _numberOfChoices, bytes memory _extraData)\\n external\\n payable\\n override\\n returns (uint256 disputeID)\\n {\\n require(msg.value >= arbitrationCost(_extraData), \\\"ETH too low for arbitration cost\\\");\\n\\n (uint96 subcourtID, , uint256 disputeKitID) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n require(courts[subcourtID].supportedDisputeKits[disputeKitID], \\\"DK unsupported by subcourt\\\");\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.subcourtID = subcourtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.subcourtID];\\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.subcourtID];\\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.subcourtID] += round.tokensAtStakePerJuror;\\n round.drawnJurors.push(drawnAddress);\\n emit Draw(drawnAddress, _disputeID, currentRound, i);\\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(\\n uint256 _disputeID,\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) 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 newSubcourtID = dispute.subcourtID;\\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[newDisputeKitID].jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n newSubcourtID = courts[newSubcourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newSubcourtID].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 newSubcourtID = courts[newSubcourtID].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[newSubcourtID].supportedDisputeKits[newDisputeKitID]) {\\n newSubcourtID = GENERAL_COURT;\\n }\\n\\n if (newSubcourtID != dispute.subcourtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.subcourtID, newSubcourtID);\\n }\\n }\\n\\n dispute.subcourtID = newSubcourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newSubcourtID];\\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(\\n uint256 _disputeID,\\n uint256 _round,\\n uint256 _iterations\\n ) 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.subcourtID] -= 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.subcourtID] >= courts[dispute.subcourtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.subcourtID] - penalty;\\n setStakeForAccount(account, dispute.subcourtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.subcourtID] != 0) {\\n setStakeForAccount(account, dispute.subcourtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n for (uint256 j = 0; j < jurors[account].subcourtIDs.length; j++) {\\n setStakeForAccount(account, jurors[account].subcourtIDs[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.subcourtID] -=\\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.subcourtID] == 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 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)\\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 subcourtID, uint256 minJurors, ) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[subcourtID].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.subcourtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n if (dispute.subcourtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent subcourt.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current subcourt.\\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.subcourtID].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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n return disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round)\\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 _subcourtID)\\n external\\n view\\n returns (uint256 staked, uint256 locked)\\n {\\n staked = jurors[_juror].stakedTokens[_subcourtID];\\n locked = jurors[_juror].lockedTokens[_subcourtID];\\n }\\n\\n function isSupported(uint96 _subcourtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_subcourtID].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 _subcourtID 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 _subcourtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_subcourtID];\\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(bytes32 _key, uint256 _nodeIndex)\\n public\\n view\\n returns (\\n uint256 K,\\n uint256 length,\\n bytes32 ID\\n )\\n {\\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.subcourtID];\\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 getLastRoundResult(uint256 _disputeID) external view returns (uint256 winningChoice, bool tied) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (winningChoice, tied) = disputeKitNodes[round.disputeKitID].disputeKit.getLastRoundResult(_disputeID);\\n }\\n\\n function getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function enableDisputeKit(\\n uint96 _subcourtID,\\n uint256 _disputeKitID,\\n bool _enable\\n ) internal {\\n courts[_subcourtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_subcourtID, _disputeKitID, _enable);\\n }\\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 * @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 _subcourtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_subcourtID == FORKING_COURT || _subcourtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_subcourtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_subcourtID].minStake || _stake < juror.lockedTokens[_subcourtID]) return false;\\n if (currentStake == 0 && juror.subcourtIDs.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 subcourtID: _subcourtID,\\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.subcourtIDs.push(_subcourtID);\\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[_subcourtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\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 }\\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[_subcourtID] - currentStake + _stake;\\n juror.stakedTokens[_subcourtID] = newTotalStake;\\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 == GENERAL_COURT) finished = true;\\n else currentSubcourtID = courts[currentSubcourtID].parent;\\n }\\n\\n emit StakeSet(_account, _subcourtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a subcourt 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 subcourt ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return subcourtID The subcourt ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\n function extraDataToSubcourtIDMinJurorsDisputeKit(bytes memory _extraData)\\n internal\\n view\\n returns (\\n uint96 subcourtID,\\n uint256 minJurors,\\n uint256 disputeKitID\\n )\\n {\\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 subcourtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (subcourtID == FORKING_COURT || subcourtID >= courts.length) {\\n subcourtID = 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 subcourtID = GENERAL_COURT;\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n /** @dev Packs an account and a subcourt ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _subcourtID The subcourt ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndSubcourtIDToStakePathID(address _account, uint96 _subcourtID)\\n internal\\n pure\\n returns (bytes32 stakePathID)\\n {\\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 /** @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(\\n address _from,\\n address _to,\\n uint256 _value\\n ) 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\":\"0xd8593fcedfc04eba288fded13f7ccdfe51224d65b75117bad4baee156037949f\",\"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 RNBlock; // The block number when the random number was requested.\\n uint256 public RN; // 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 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 */\\n constructor(\\n address _governor,\\n KlerosCore _core,\\n RNG _rng\\n ) BaseDisputeKit(_governor, _core) {\\n rng = _rng;\\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 */\\n function changeRandomNumberGenerator(RNG _rng) external onlyByGovernor {\\n rng = _rng;\\n // TODO: if current phase is generating, call rng.requestRN() for the next block\\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 }\\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 require(block.number >= core.freezeBlock() + 20, \\\"Too soon: L1 finality required\\\");\\n // TODO: RNG process is currently unfinished.\\n RNBlock = block.number;\\n rng.requestRN(block.number);\\n phase = Phase.generating;\\n } else if (phase == Phase.generating) {\\n RN = rng.getRN(RNBlock);\\n require(RN != 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(uint256 _coreDisputeID)\\n external\\n override\\n onlyByCore\\n notJumped(_coreDisputeID)\\n returns (address drawnAddress)\\n {\\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 subcourtID, , , , ) = core.disputes(_coreDisputeID);\\n bytes32 key = bytes32(uint256(subcourtID)); // Get the ID of the tree.\\n uint256 drawnNumber = getRandomNumber();\\n\\n (uint256 K, uint256 nodesLength, ) = core.getSortitionSumTree(key, 0);\\n uint256 treeIndex = 0;\\n uint256 currentDrawnNumber = drawnNumber % 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 }\\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 subcourtID, , , , ) = core.disputes(_coreDisputeID);\\n (, bool hiddenVotes, , , , ) = core.courts(subcourtID);\\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 subcourts 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 if (this.currentRuling(_coreDisputeID) == _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 /** @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 */\\n function currentRuling(uint256 _coreDisputeID) external view override returns (uint256 ruling) {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n ruling = round.tied ? 0 : round.winningChoice;\\n }\\n\\n function getLastRoundResult(uint256 _coreDisputeID)\\n external\\n view\\n override\\n returns (uint256 winningChoice, bool tied)\\n {\\n Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]];\\n Round storage lastRound = dispute.rounds[dispute.rounds.length - 1];\\n return (lastRound.winningChoice, lastRound.tied);\\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.getLastRoundResult(_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.getLastRoundResult(_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 )\\n external\\n view\\n override\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n )\\n {\\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 subcourtID, , , , ) = core.disputes(_coreDisputeID);\\n (uint256 lockedAmountPerJuror, , , , , ) = core.getRoundInfo(\\n _coreDisputeID,\\n core.getNumberOfRounds(_coreDisputeID) - 1\\n );\\n (uint256 stakedTokens, uint256 lockedTokens) = core.getJurorBalance(_juror, subcourtID);\\n return stakedTokens >= lockedTokens + lockedAmountPerJuror;\\n }\\n\\n /** @dev RNG function\\n * @return rn A random number.\\n */\\n function getRandomNumber() internal returns (uint256) {\\n return rng.getUncorrelatedRN(block.number);\\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\":\"0x9142ba7ec4cde26b876011bd9c782c75b906d1d9ab8465938ceeb3b3c2bd705f\",\"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\\n/**\\n * @authors: [@clesaege]\\n * @reviewers: [@remedcu]\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8;\\n\\n/**\\n * @title Random Number Generator Standard\\n * @author Cl\\u00e9ment Lesaege - \\n * @dev This is an abstract contract\\n */\\nabstract contract RNG {\\n /**\\n * @dev Contribute to the reward of a random number.\\n * @param _block Block the random number is linked to.\\n */\\n function contribute(uint256 _block) public payable virtual;\\n\\n /**\\n * @dev Request a random number.\\n * @param _block Block linked to the request.\\n */\\n function requestRN(uint256 _block) public payable {\\n contribute(_block);\\n }\\n\\n /**\\n * @dev Get the random number.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getRN(uint256 _block) public virtual returns (uint256 RN);\\n\\n /**\\n * @dev Get a uncorrelated random number. Act like getRN but give a different number for each sender.\\n * This is to prevent users from getting correlated numbers.\\n * @param _block Block the random number is linked to.\\n * @return RN Random Number. If the number is not ready or has not been required 0 instead.\\n */\\n function getUncorrelatedRN(uint256 _block) public returns (uint256 RN) {\\n uint256 baseRN = getRN(_block);\\n if (baseRN == 0) return 0;\\n else return uint256(keccak256(abi.encode(msg.sender, baseRN)));\\n }\\n}\\n\",\"keccak256\":\"0x854bcb147fe44383cba7a5fdbcb69b3c0a9a71435c80eb73c172222da472a855\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620043c0380380620043c0833981016040819052620000349162000090565b600080546001600160a01b039485166001600160a01b031991821617909155600180549385169382169390931790925560028054919093169116179055620000e4565b6001600160a01b03811681146200008d57600080fd5b50565b600080600060608486031215620000a657600080fd5b8351620000b38162000077565b6020850151909350620000c68162000077565b6040850151909250620000d98162000077565b809150509250925092565b6142cc80620000f46000396000f3fe6080604052600436106102045760003560e01c8063796490f911610118578063ba66fde7116100a0578063d605787b1161006f578063d605787b14610638578063da3beb8c14610658578063e349ad3014610479578063e4c0aaf414610678578063f2f4eb261461069857600080fd5b8063ba66fde7146105cd578063be467604146105ed578063c41bda6114610603578063c86ed8921461062357600080fd5b8063a6a7f0eb116100e7578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b8063796490f9146104795780637c04034e1461048f5780638e426460146104af5780639b05c261146104cf57600080fd5b80633b3041471161019b5780635c92e2f61161016a5780635c92e2f6146103b65780635e4a627d146103d657806369f3f041146103ec5780636d4cd8ea14610439578063751accd01461045957600080fd5b80633b304147146103345780634b2f0ea0146103545780634fe264fb14610367578063564a565d1461038757600080fd5b80630c340a24116101d75780630c340a241461028f5780631200aabc146102c75780631c3db16d146102f4578063362c34791461031457600080fd5b8063023d44df1461020957806303432744146102325780630b274f2e146102485780630baa64d11461025f575b600080fd5b34801561021557600080fd5b5061021f60035481565b6040519081526020015b60405180910390f35b34801561023e57600080fd5b5061021f60065481565b34801561025457600080fd5b5061025d6106b8565b005b34801561026b57600080fd5b5061027f61027a36600461380a565b610c8a565b6040519015158152602001610229565b34801561029b57600080fd5b506000546102af906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102d357600080fd5b5061021f6102e236600461380a565b60086020526000908152604090205481565b34801561030057600080fd5b5061021f61030f36600461380a565b610d01565b34801561032057600080fd5b5061021f61032f36600461383b565b610d8b565b34801561034057600080fd5b506102af61034f36600461380a565b611179565b61025d610362366004613878565b611731565b34801561037357600080fd5b5061021f61038236600461389a565b611fcb565b34801561039357600080fd5b506103a76103a236600461380a565b61211b565b6040516102299392919061391e565b3480156103c257600080fd5b5061025d6103d1366004613994565b6121e1565b3480156103e257600080fd5b5061021f60045481565b3480156103f857600080fd5b5061040c61040736600461389a565b6124ed565b604080519687529415156020870152938501929092526060840152608083015260a082015260c001610229565b34801561044557600080fd5b5061027f61045436600461380a565b6125a5565b34801561046557600080fd5b5061025d610474366004613a86565b61261c565b34801561048557600080fd5b5061021f61271081565b34801561049b57600080fd5b5061025d6104aa366004613af3565b6126ee565b3480156104bb57600080fd5b5061025d6104ca366004613b8c565b612e26565b3480156104db57600080fd5b506104ef6104ea36600461380a565b612e72565b60408051928352901515602083015201610229565b34801561051057600080fd5b5061025d61051f366004613beb565b612ef5565b34801561053057600080fd5b5061054461053f36600461389a565b612f47565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610229565b34801561057c57600080fd5b5060055461058a9060ff1681565b6040516102299190613c4d565b3480156105a357600080fd5b5061021f614e2081565b3480156105b957600080fd5b5061025d6105c8366004613c75565b61300d565b3480156105d957600080fd5b5061027f6105e836600461389a565b6131c6565b3480156105f957600080fd5b5061021f61138881565b34801561060f57600080fd5b5061025d61061e366004613b8c565b613261565b34801561062f57600080fd5b5061027f6132ad565b34801561064457600080fd5b506002546102af906001600160a01b031681565b34801561066457600080fd5b5061021f610673366004613878565b6132cd565b34801561068457600080fd5b5061025d610693366004613b8c565b61342d565b3480156106a457600080fd5b506001546102af906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106fd57600080fd5b505afa158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190613cd0565b600181111561074657610746613c37565b14806107d35750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190613d06565b1561085e57600060055460ff1660028111156107f1576107f1613c37565b14156108445760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600580546000919060ff19166001835b0217905550610c49565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ad57600080fd5b505afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e59190613cd0565b60018111156108f6576108f6613c37565b1415610c4957600060055460ff16600281111561091557610915613c37565b1415610ac45760006006541161096d5760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f727300000000604482015260640161083b565b600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f39190613d21565b6109fe906014613d50565b431015610a4d5760405162461bcd60e51b815260206004820152601e60248201527f546f6f20736f6f6e3a204c312066696e616c6974792072657175697265640000604482015260640161083b565b4360038190556002546040516303dce1a760e51b815260048101929092526001600160a01b031690637b9c34e090602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050600580546001935090915060ff19168280610854565b600160055460ff166002811115610add57610add613c37565b1415610bcf5760025460035460405163ca4742f160e01b81526001600160a01b039092169163ca4742f191610b189160040190815260200190565b602060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613d21565b6004819055610bbb5760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161083b565b600580546002919060ff1916600183610854565b600260055460ff166002811115610be857610be8613c37565b1415610c495760065415610c3e5760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e67207068617365000000604482015260640161083b565b6005805460ff191690555b6005546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c809160ff90911690613c4d565b60405180910390a1565b600081815260086020526040812054600780548392908110610cae57610cae613d68565b60009182526020822060059091020180549092508290610cd090600190613d7e565b81548110610ce057610ce0613d68565b60009182526020909120600c90910201805460059091015414949350505050565b600081815260086020526040812054600780548392908110610d2557610d25613d68565b60009182526020822060059091020180549092508290610d4790600190613d7e565b81548110610d5757610d57613d68565b60009182526020909120600c90910201600381015490915060ff16610d80578060010154610d83565b60005b949350505050565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610dd457600080fd5b505afa158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c9190613dac565b50935050505080610e5f5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e0000000000604482015260640161083b565b600086815260086020526040812054600780549091908110610e8357610e83613d68565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610eb757610eb7613d68565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160206040518083038186803b158015610f0d57600080fd5b505afa158015610f21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f459190613d21565b600087815260078401602052604090205490915060ff16610f8d576001600160a01b0388166000908152600883016020908152604080832089845290915290205494506110d3565b80861415611003576000868152600683016020526040902054610fb1576000610ffc565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b8652909352922054610ff29190613e13565b610ffc9190613e48565b94506110d3565b600081815260078301602052604090205460ff166110d35781600601600083600a0160018154811061103757611037613d68565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061106d5761106d613d68565b90600052602060002001548152602001908152602001600020546110919190613d50565b60098301546001600160a01b038a16600090815260088501602090815260408083208b84529091529020546110c69190613e13565b6110d09190613e48565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561116d576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146111a65760405162461bcd60e51b815260040161083b90613e5c565b6000828152600860205260409020546007805484929081106111ca576111ca613d68565b600091825260209091206002600590920201015460ff16156111fe5760405162461bcd60e51b815260040161083b90613ea0565b600260055460ff16600281111561121757611217613c37565b146112645760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e67207068617365000000000000604482015260640161083b565b60008381526008602052604081205460078054909190811061128857611288613d68565b600091825260208220600590910201805490925082906112aa90600190613d7e565b815481106112ba576112ba613d68565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561131057600080fd5b505afa158015611324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113489190613dac565b50929350506001600160601b038316915060009050611365613479565b60015460405163bfabfe8f60e01b81526004810185905260006024820181905292935082916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156113b557600080fd5b505afa1580156113c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ed9190613ed7565b50600154604051630a48b58160e21b81526004810188905260006024820181905293955091935082916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561144357600080fd5b505afa158015611457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147b9190613d21565b6114859086613f05565b90505b826114938386613e13565b61149e906001613d50565b101561158b5760015b848111611585576000816114bb8588613e13565b6114c59190613d50565b600154604051630a48b58160e21b8152600481018b9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561151657600080fd5b505afa15801561152a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154e9190613d21565b9050808410611568576115618185613d7e565b9350611570565b509250611585565b5050808061157d90613f19565b9150506114a7565b50611488565b60015460405163bfabfe8f60e01b815260048101889052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156115d757600080fd5b505afa1580156115eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160f9190613ed7565b9250505061161c816134fc565b9b506116288d8d613527565b1561171c578860000160405180608001604052808e6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505088600b015489600001805490501415611717576006805490600061171183613f34565b91905055505b611721565b60009b505b5050505050505050505050919050565b60008281526008602052604090205460078054849290811061175557611755613d68565b600091825260209091206002600590920201015460ff16156117895760405162461bcd60e51b815260040161083b90613ea0565b6000838152600860205260408120546007805490919081106117ad576117ad613d68565b9060005260206000209060050201905080600101548311156118115760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e604482015260640161083b565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118919190613f4b565b915091508142101580156118a457508042105b6118e95760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b604482015260640161083b565b604051631c3db16d60e01b81526004810187905260009086903090631c3db16d9060240160206040518083038186803b15801561192557600080fd5b505afa158015611939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195d9190613d21565b141561196c57506127106119ec565b61271061138861197c8585613d7e565b6119869190613e13565b6119909190613e48565b61199a8442613d7e565b106119e75760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f73657200604482015260640161083b565b50614e205b835460009085906119ff90600190613d7e565b81548110611a0f57611a0f613d68565b60009182526020822060018054604051637e37c78b60e11b8152600481018e9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611a6957600080fd5b505afa158015611a7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa19190613d21565b611aab9190613d7e565b600089815260078401602052604090205490915060ff1615611b0f5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e0000000000604482015260640161083b565b600154604051632cf6413f60e11b8152600481018b90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611b5457600080fd5b505afa158015611b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8c9190613d21565b90506000612710611b9d8684613e13565b611ba79190613e48565b611bb19083613d50565b60008b815260068601602052604081205491925090821115611c545760008b81526006860160205260409020543490611bea9084613d7e565b11611c0f5760008b8152600686016020526040902054611c0a9083613d7e565b611c11565b345b604080518d815260208101839052919250339186918f917fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c0910160405180910390a45b33600090815260088601602090815260408083208e845290915281208054839290611c80908490613d50565b909155505060008b815260068601602052604081208054839290611ca5908490613d50565b909155505060008b81526006860160205260409020548211611d4f5760008b815260068601602052604081205460098701805491929091611ce7908490613d50565b9091555050600a8501805460018181018355600092835260208084209092018e90558d8352600788019091526040808320805460ff1916909217909155518c9186918f917fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00991a45b600a85015460011015611f8f57828560090154611d6c9190613d7e565b60098601556001546040516319b8152960e01b8152600481018e90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611db557600080fd5b505afa158015611dc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ded9190613d06565b15611e065760028901805460ff19166001179055611f0f565b885460038a016000611e19876001613d50565b8152602001908152602001600020819055506000896000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538e6040518263ffffffff1660e01b8152600401611e9491815260200190565b60206040518083038186803b158015611eac57600080fd5b505afa158015611ec0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee49190613d21565b600b82015560038101805460ff1916600117905560068054906000611f0883613f19565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848e8c600101548d6004016040518563ffffffff1660e01b8152600401611f5c93929190613faa565b6000604051808303818588803b158015611f7557600080fd5b505af1158015611f89573d6000803e3d6000fd5b50505050505b80341115611fbd57336108fc611fa58334613d7e565b6040518115909202916000818181858888f150505050505b505050505050505050505050565b600083815260086020526040812054600780548392908110611fef57611fef613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061202357612023613d68565b90600052602060002090600c0201600001848154811061204557612045613d68565b600091825260208220600154604051639b05c26160e01b815260048082018c905293909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561209d57600080fd5b505afa1580156120b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d59190614062565b6003850154919350915060ff1680156120f8575081836002015414806120f85750805b1561210b57612710945050505050612114565b60009450505050505b9392505050565b6007818154811061212b57600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161215e90613f6f565b80601f016020809104026020016040519081016040528092919081815260200182805461218a90613f6f565b80156121d75780601f106121ac576101008083540402835291602001916121d7565b820191906000526020600020905b8154815290600101906020018083116121ba57829003601f168201915b5050505050905083565b60008481526008602052604090205460078054869290811061220557612205613d68565b600091825260209091206002600590920201015460ff16156122395760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561227e57600080fd5b505afa158015612292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b69190613dac565b50909350600192506122c6915050565b8160048111156122d8576122d8613c37565b146123355760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b606482015260840161083b565b826123725760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b604482015260640161083b565b60008681526008602052604081205460078054909190811061239657612396613d68565b600091825260208220600590910201805490925082906123b890600190613d7e565b815481106123c8576123c8613d68565b90600052602060002090600c0201905060005b868110156124c65733828989848181106123f7576123f7613d68565b905060200201358154811061240e5761240e613d68565b60009182526020909120600490910201546001600160a01b0316146124755760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b858289898481811061248957612489613d68565b90506020020135815481106124a0576124a0613d68565b6000918252602090912060016004909202010155806124be81613f19565b9150506123db565b50868690508160050160008282546124de9190613d50565b90915550505050505050505050565b60008060008060008060006007600860008c8152602001908152602001600020548154811061251e5761251e613d68565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061255257612552613d68565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b6000818152600860205260408120546007805483929081106125c9576125c9613d68565b600091825260208220600590910201805490925082906125eb90600190613d7e565b815481106125fb576125fb613d68565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146126465760405162461bcd60e51b815260040161083b9061408e565b6000836001600160a01b0316838360405161266191906140d0565b60006040518083038185875af1925050503d806000811461269e576040519150601f19603f3d011682016040523d82523d6000602084013e6126a3565b606091505b50509050806126e85760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b604482015260640161083b565b50505050565b60008681526008602052604090205460078054889290811061271257612712613d68565b600091825260209091206002600590920201015460ff16156127465760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561278b57600080fd5b505afa15801561279f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c39190613dac565b50909350600292506127d3915050565b8160048111156127e5576127e5613c37565b146128405760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b606482015260840161083b565b856128825760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b604482015260640161083b565b6000888152600860205260408120546007805490919081106128a6576128a6613d68565b9060005260206000209060050201905080600101548611156129015760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b604482015260640161083b565b8054600090829061291490600190613d7e565b8154811061292457612924613d68565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561297a57600080fd5b505afa15801561298e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b29190613dac565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612a0857600080fd5b505afa158015612a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4091906140ec565b5050505091505060005b8a811015612cee5733848d8d84818110612a6657612a66613d68565b9050602002013581548110612a7d57612a7d613d68565b60009182526020909120600490910201546001600160a01b031614612ae45760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b811580612b58575089888a604051602001612b0193929190614144565b60405160208183030381529060405280519060200120846000018d8d84818110612b2d57612b2d613d68565b9050602002013581548110612b4457612b44613d68565b906000526020600020906004020160010154145b612bcc576040805162461bcd60e51b81526020600482015260248101919091527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20737562636f7572747320776974682068696464656e20766f7465732e606482015260840161083b565b838c8c83818110612bdf57612bdf613d68565b9050602002013581548110612bf657612bf6613d68565b600091825260209091206003600490920201015460ff1615612c4f5760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b604482015260640161083b565b89848d8d84818110612c6357612c63613d68565b9050602002013581548110612c7a57612c7a613d68565b60009182526020909120600260049092020101556001848d8d84818110612ca357612ca3613d68565b9050602002013581548110612cba57612cba613d68565b60009182526020909120600490910201600301805460ff191691151591909117905580612ce681613f19565b915050612a4a565b508a8a9050836004016000828254612d069190613d50565b90915550506000898152600284016020526040812080548c9290612d2b908490613d50565b90915550506001830154891415612d5b57600383015460ff1615612d565760038301805460ff191690555b612dd5565b60018301546000908152600284016020526040808220548b83529120541415612d9e57600383015460ff16612d565760038301805460ff19166001179055612dd5565b60018301546000908152600284016020526040808220548b83529120541115612dd5576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a604051612e109190614171565b60405180910390a4505050505050505050505050565b6000546001600160a01b03163314612e505760405162461bcd60e51b815260040161083b9061408e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120546007805483928392918110612e9857612e98613d68565b60009182526020822060059091020180549092508290612eba90600190613d7e565b81548110612eca57612eca613d68565b60009182526020909120600c909102016001810154600390910154909660ff90911695509350505050565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c90612f3a9087908790614184565b60405180910390a4505050565b60008060008060006007600860008a81526020019081526020016000205481548110612f7557612f75613d68565b600091825260208083208a8452600360059093020191820190526040822054815491935083918110612fa957612fa9613d68565b90600052602060002090600c02016000018781548110612fcb57612fcb613d68565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146130375760405162461bcd60e51b815260040161083b90613e5c565b60078054600181018255600091909152600581027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68981018690557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101906130c2907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c018686613771565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561311457600080fd5b505afa158015613128573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061314c9190613d21565b6131569190613d7e565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600890925282208490556006805491926131b783613f19565b91905055505050505050505050565b6000838152600860205260408120546007805483929081106131ea576131ea613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061321e5761321e613d68565b90600052602060002090600c0201600001848154811061324057613240613d68565b600091825260209091206004909102016003015460ff169695505050505050565b6000546001600160a01b0316331461328b5760405162461bcd60e51b815260040161083b9061408e565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008060055460ff1660028111156132c7576132c7613c37565b14905090565b6000828152600860205260408120546007805483929081106132f1576132f1613d68565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061332557613325613d68565b600091825260208220600154604051639b05c26160e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561337e57600080fd5b505afa158015613392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b69190614062565b915091508260040154600014806133e45750801580156133e457506000828152600284016020526040902054155b156133f6576000945050505050613427565b801561340b5750506004015491506134279050565b5060009081526002909101602052604090205491506134279050565b92915050565b6000546001600160a01b031633146134575760405162461bcd60e51b815260040161083b9061408e565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254604051630e39b00f60e11b81524360048201526000916001600160a01b031690631c73601e90602401602060405180830381600087803b1580156134bf57600080fd5b505af11580156134d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f79190613d21565b905090565b600060405160005b601481101561351f5783811a81600c84010153600101613504565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b15801561357057600080fd5b505afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190613dac565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561360257600080fd5b505afa158015613616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363a9190613d21565b6136449190613d7e565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b15801561368057600080fd5b505afa158015613694573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136bc91908101906141b3565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561371c57600080fd5b505afa158015613730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137549190613f4b565b90925090506137638382613d50565b909110159695505050505050565b82805461377d90613f6f565b90600052602060002090601f01602090048101928261379f57600085556137e5565b82601f106137b85782800160ff198235161785556137e5565b828001600101855582156137e5579182015b828111156137e55782358255916020019190600101906137ca565b506137f19291506137f5565b5090565b5b808211156137f157600081556001016137f6565b60006020828403121561381c57600080fd5b5035919050565b6001600160a01b038116811461383857600080fd5b50565b6000806000806080858703121561385157600080fd5b84359350602085013561386381613823565b93969395505050506040820135916060013590565b6000806040838503121561388b57600080fd5b50508035926020909101359150565b6000806000606084860312156138af57600080fd5b505081359360208301359350604090920135919050565b60005b838110156138e15781810151838201526020016138c9565b838111156126e85750506000910152565b6000815180845261390a8160208601602086016138c6565b601f01601f19169290920160200192915050565b838152821515602082015260606040820152600061393f60608301846138f2565b95945050505050565b60008083601f84011261395a57600080fd5b50813567ffffffffffffffff81111561397257600080fd5b6020830191508360208260051b850101111561398d57600080fd5b9250929050565b600080600080606085870312156139aa57600080fd5b84359350602085013567ffffffffffffffff8111156139c857600080fd5b6139d487828801613948565b9598909750949560400135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613a2657613a266139e7565b604052919050565b600067ffffffffffffffff831115613a4857613a486139e7565b613a5b601f8401601f19166020016139fd565b9050828152838383011115613a6f57600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613a9b57600080fd5b8335613aa681613823565b925060208401359150604084013567ffffffffffffffff811115613ac957600080fd5b8401601f81018613613ada57600080fd5b613ae986823560208401613a2e565b9150509250925092565b60008060008060008060a08789031215613b0c57600080fd5b86359550602087013567ffffffffffffffff80821115613b2b57600080fd5b613b378a838b01613948565b909750955060408901359450606089013593506080890135915080821115613b5e57600080fd5b508701601f81018913613b7057600080fd5b613b7f89823560208401613a2e565b9150509295509295509295565b600060208284031215613b9e57600080fd5b813561211481613823565b60008083601f840112613bbb57600080fd5b50813567ffffffffffffffff811115613bd357600080fd5b60208301915083602082850101111561398d57600080fd5b600080600060408486031215613c0057600080fd5b83359250602084013567ffffffffffffffff811115613c1e57600080fd5b613c2a86828701613ba9565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613c6f57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613c8d57600080fd5b8535945060208601359350604086013567ffffffffffffffff811115613cb257600080fd5b613cbe88828901613ba9565b96999598509660600135949350505050565b600060208284031215613ce257600080fd5b81516002811061211457600080fd5b80518015158114613d0157600080fd5b919050565b600060208284031215613d1857600080fd5b61211482613cf1565b600060208284031215613d3357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613d6357613d63613d3a565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613d9057613d90613d3a565b500390565b80516001600160601b0381168114613d0157600080fd5b600080600080600060a08688031215613dc457600080fd5b613dcd86613d95565b94506020860151613ddd81613823565b604087015190945060058110613df257600080fd5b9250613e0060608701613cf1565b9150608086015190509295509295909350565b6000816000190483118215151615613e2d57613e2d613d3a565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613e5757613e57613e32565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600080600060608486031215613eec57600080fd5b8351925060208401519150604084015190509250925092565b600082613f1457613f14613e32565b500690565b6000600019821415613f2d57613f2d613d3a565b5060010190565b600081613f4357613f43613d3a565b506000190190565b60008060408385031215613f5e57600080fd5b505080516020909101519092909150565b600181811c90821680613f8357607f821691505b60208210811415613fa457634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c915080831680613fd857607f831692505b858310811415613ff657634e487b7160e01b85526022600452602485fd5b6060880183905260808801818015614015576001811461402657614051565b60ff19861682528782019650614051565b60008b81526020902060005b8681101561404b57815484820152908501908901614032565b83019750505b50949b9a5050505050505050505050565b6000806040838503121561407557600080fd5b8251915061408560208401613cf1565b90509250929050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600082516140e28184602087016138c6565b9190910192915050565b60008060008060008060c0878903121561410557600080fd5b61410e87613d95565b955061411c60208801613cf1565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b8381526000835161415c8160208501602088016138c6565b60209201918201929092526040019392505050565b60208152600061211460208301846138f2565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008060008060008060c087890312156141cc57600080fd5b8651955060208088015195506040880151945060608801519350608088015167ffffffffffffffff8082111561420157600080fd5b818a0191508a601f83011261421557600080fd5b815181811115614227576142276139e7565b8060051b91506142388483016139fd565b818152918301840191848101908d84111561425257600080fd5b938501935b8385101561427c578451925061426c83613823565b8282529385019390850190614257565b80975050505050505060a08701519050929550929550929556fea264697066735822122093e1025e8596baad92b8acbc1dfd801832f0c4845d9b926d2b306bac5cf1c9ee64736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106102045760003560e01c8063796490f911610118578063ba66fde7116100a0578063d605787b1161006f578063d605787b14610638578063da3beb8c14610658578063e349ad3014610479578063e4c0aaf414610678578063f2f4eb261461069857600080fd5b8063ba66fde7146105cd578063be467604146105ed578063c41bda6114610603578063c86ed8921461062357600080fd5b8063a6a7f0eb116100e7578063a6a7f0eb14610504578063a7cc08fe14610524578063b1c9fe6e14610570578063b34bfaa814610597578063b6ede540146105ad57600080fd5b8063796490f9146104795780637c04034e1461048f5780638e426460146104af5780639b05c261146104cf57600080fd5b80633b3041471161019b5780635c92e2f61161016a5780635c92e2f6146103b65780635e4a627d146103d657806369f3f041146103ec5780636d4cd8ea14610439578063751accd01461045957600080fd5b80633b304147146103345780634b2f0ea0146103545780634fe264fb14610367578063564a565d1461038757600080fd5b80630c340a24116101d75780630c340a241461028f5780631200aabc146102c75780631c3db16d146102f4578063362c34791461031457600080fd5b8063023d44df1461020957806303432744146102325780630b274f2e146102485780630baa64d11461025f575b600080fd5b34801561021557600080fd5b5061021f60035481565b6040519081526020015b60405180910390f35b34801561023e57600080fd5b5061021f60065481565b34801561025457600080fd5b5061025d6106b8565b005b34801561026b57600080fd5b5061027f61027a36600461380a565b610c8a565b6040519015158152602001610229565b34801561029b57600080fd5b506000546102af906001600160a01b031681565b6040516001600160a01b039091168152602001610229565b3480156102d357600080fd5b5061021f6102e236600461380a565b60086020526000908152604090205481565b34801561030057600080fd5b5061021f61030f36600461380a565b610d01565b34801561032057600080fd5b5061021f61032f36600461383b565b610d8b565b34801561034057600080fd5b506102af61034f36600461380a565b611179565b61025d610362366004613878565b611731565b34801561037357600080fd5b5061021f61038236600461389a565b611fcb565b34801561039357600080fd5b506103a76103a236600461380a565b61211b565b6040516102299392919061391e565b3480156103c257600080fd5b5061025d6103d1366004613994565b6121e1565b3480156103e257600080fd5b5061021f60045481565b3480156103f857600080fd5b5061040c61040736600461389a565b6124ed565b604080519687529415156020870152938501929092526060840152608083015260a082015260c001610229565b34801561044557600080fd5b5061027f61045436600461380a565b6125a5565b34801561046557600080fd5b5061025d610474366004613a86565b61261c565b34801561048557600080fd5b5061021f61271081565b34801561049b57600080fd5b5061025d6104aa366004613af3565b6126ee565b3480156104bb57600080fd5b5061025d6104ca366004613b8c565b612e26565b3480156104db57600080fd5b506104ef6104ea36600461380a565b612e72565b60408051928352901515602083015201610229565b34801561051057600080fd5b5061025d61051f366004613beb565b612ef5565b34801561053057600080fd5b5061054461053f36600461389a565b612f47565b604080516001600160a01b03909516855260208501939093529183015215156060820152608001610229565b34801561057c57600080fd5b5060055461058a9060ff1681565b6040516102299190613c4d565b3480156105a357600080fd5b5061021f614e2081565b3480156105b957600080fd5b5061025d6105c8366004613c75565b61300d565b3480156105d957600080fd5b5061027f6105e836600461389a565b6131c6565b3480156105f957600080fd5b5061021f61138881565b34801561060f57600080fd5b5061025d61061e366004613b8c565b613261565b34801561062f57600080fd5b5061027f6132ad565b34801561064457600080fd5b506002546102af906001600160a01b031681565b34801561066457600080fd5b5061021f610673366004613878565b6132cd565b34801561068457600080fd5b5061025d610693366004613b8c565b61342d565b3480156106a457600080fd5b506001546102af906001600160a01b031681565b600154604080516358e4ff3760e11b815290516000926001600160a01b03169163b1c9fe6e916004808301926020929190829003018186803b1580156106fd57600080fd5b505afa158015610711573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107359190613cd0565b600181111561074657610746613c37565b14806107d35750600160009054906101000a90046001600160a01b03166001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561079b57600080fd5b505afa1580156107af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d39190613d06565b1561085e57600060055460ff1660028111156107f1576107f1613c37565b14156108445760405162461bcd60e51b815260206004820152601a60248201527f416c726561647920696e205265736f6c76696e6720706861736500000000000060448201526064015b60405180910390fd5b600580546000919060ff19166001835b0217905550610c49565b60018060009054906101000a90046001600160a01b03166001600160a01b031663b1c9fe6e6040518163ffffffff1660e01b815260040160206040518083038186803b1580156108ad57600080fd5b505afa1580156108c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e59190613cd0565b60018111156108f6576108f6613c37565b1415610c4957600060055460ff16600281111561091557610915613c37565b1415610ac45760006006541161096d5760405162461bcd60e51b815260206004820152601c60248201527f416c6c207468652064697370757465732068617665206a75726f727300000000604482015260640161083b565b600160009054906101000a90046001600160a01b03166001600160a01b0316633a1578606040518163ffffffff1660e01b815260040160206040518083038186803b1580156109bb57600080fd5b505afa1580156109cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109f39190613d21565b6109fe906014613d50565b431015610a4d5760405162461bcd60e51b815260206004820152601e60248201527f546f6f20736f6f6e3a204c312066696e616c6974792072657175697265640000604482015260640161083b565b4360038190556002546040516303dce1a760e51b815260048101929092526001600160a01b031690637b9c34e090602401600060405180830381600087803b158015610a9857600080fd5b505af1158015610aac573d6000803e3d6000fd5b5050600580546001935090915060ff19168280610854565b600160055460ff166002811115610add57610add613c37565b1415610bcf5760025460035460405163ca4742f160e01b81526001600160a01b039092169163ca4742f191610b189160040190815260200190565b602060405180830381600087803b158015610b3257600080fd5b505af1158015610b46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b6a9190613d21565b6004819055610bbb5760405162461bcd60e51b815260206004820152601e60248201527f52616e646f6d206e756d626572206973206e6f74207265616479207965740000604482015260640161083b565b600580546002919060ff1916600183610854565b600260055460ff166002811115610be857610be8613c37565b1415610c495760065415610c3e5760405162461bcd60e51b815260206004820152601d60248201527f4e6f7420726561647920666f72205265736f6c76696e67207068617365000000604482015260640161083b565b6005805460ff191690555b6005546040517fdeeacb313775e12b099f27fe481aa82204a1806233e7125cc8a9f719e5ddfdc591610c809160ff90911690613c4d565b60405180910390a1565b600081815260086020526040812054600780548392908110610cae57610cae613d68565b60009182526020822060059091020180549092508290610cd090600190613d7e565b81548110610ce057610ce0613d68565b60009182526020909120600c90910201805460059091015414949350505050565b600081815260086020526040812054600780548392908110610d2557610d25613d68565b60009182526020822060059091020180549092508290610d4790600190613d7e565b81548110610d5757610d57613d68565b60009182526020909120600c90910201600381015490915060ff16610d80578060010154610d83565b60005b949350505050565b60015460405163564a565d60e01b81526004810186905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b158015610dd457600080fd5b505afa158015610de8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0c9190613dac565b50935050505080610e5f5760405162461bcd60e51b815260206004820152601b60248201527f446973707574652073686f756c64206265207265736f6c7665642e0000000000604482015260640161083b565b600086815260086020526040812054600780549091908110610e8357610e83613d68565b60009182526020808320888452600360059093020191820190526040822054815491935083918110610eb757610eb7613d68565b600091825260208220600154604051631c3db16d60e01b8152600481018d9052600c9390930290910193506001600160a01b031690631c3db16d9060240160206040518083038186803b158015610f0d57600080fd5b505afa158015610f21573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f459190613d21565b600087815260078401602052604090205490915060ff16610f8d576001600160a01b0388166000908152600883016020908152604080832089845290915290205494506110d3565b80861415611003576000868152600683016020526040902054610fb1576000610ffc565b600086815260068301602090815260408083205460098601546001600160a01b038d1685526008870184528285208b8652909352922054610ff29190613e13565b610ffc9190613e48565b94506110d3565b600081815260078301602052604090205460ff166110d35781600601600083600a0160018154811061103757611037613d68565b906000526020600020015481526020019081526020016000205482600601600084600a0160008154811061106d5761106d613d68565b90600052602060002001548152602001908152602001600020546110919190613d50565b60098301546001600160a01b038a16600090815260088501602090815260408083208b84529091529020546110c69190613e13565b6110d09190613e48565b94505b6001600160a01b03881660009081526008830160209081526040808320898452909152812055841561116d576040516001600160a01b0389169086156108fc029087906000818181858888f15050604080518a8152602081018a90526001600160a01b038d1694508b93508d92507f54b3cab3cb5c4aca3209db1151caff092e878011202e43a36782d4ebe0b963ae910160405180910390a45b50505050949350505050565b6001546000906001600160a01b031633146111a65760405162461bcd60e51b815260040161083b90613e5c565b6000828152600860205260409020546007805484929081106111ca576111ca613d68565b600091825260209091206002600590920201015460ff16156111fe5760405162461bcd60e51b815260040161083b90613ea0565b600260055460ff16600281111561121757611217613c37565b146112645760405162461bcd60e51b815260206004820152601a60248201527f53686f756c6420626520696e2064726177696e67207068617365000000000000604482015260640161083b565b60008381526008602052604081205460078054909190811061128857611288613d68565b600091825260208220600590910201805490925082906112aa90600190613d7e565b815481106112ba576112ba613d68565b60009182526020822060015460405163564a565d60e01b8152600481018a9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561131057600080fd5b505afa158015611324573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113489190613dac565b50929350506001600160601b038316915060009050611365613479565b60015460405163bfabfe8f60e01b81526004810185905260006024820181905292935082916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156113b557600080fd5b505afa1580156113c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ed9190613ed7565b50600154604051630a48b58160e21b81526004810188905260006024820181905293955091935082916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561144357600080fd5b505afa158015611457573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147b9190613d21565b6114859086613f05565b90505b826114938386613e13565b61149e906001613d50565b101561158b5760015b848111611585576000816114bb8588613e13565b6114c59190613d50565b600154604051630a48b58160e21b8152600481018b9052602481018390529192506000916001600160a01b0390911690632922d6049060440160206040518083038186803b15801561151657600080fd5b505afa15801561152a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061154e9190613d21565b9050808410611568576115618185613d7e565b9350611570565b509250611585565b5050808061157d90613f19565b9150506114a7565b50611488565b60015460405163bfabfe8f60e01b815260048101889052602481018490526000916001600160a01b03169063bfabfe8f9060440160606040518083038186803b1580156115d757600080fd5b505afa1580156115eb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160f9190613ed7565b9250505061161c816134fc565b9b506116288d8d613527565b1561171c578860000160405180608001604052808e6001600160a01b031681526020016000801b81526020016000815260200160001515815250908060018154018082558091505060019003906000526020600020906004020160009091909190915060008201518160000160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550602082015181600101556040820151816002015560608201518160030160006101000a81548160ff021916908315150217905550505088600b015489600001805490501415611717576006805490600061171183613f34565b91905055505b611721565b60009b505b5050505050505050505050919050565b60008281526008602052604090205460078054849290811061175557611755613d68565b600091825260209091206002600590920201015460ff16156117895760405162461bcd60e51b815260040161083b90613ea0565b6000838152600860205260408120546007805490919081106117ad576117ad613d68565b9060005260206000209060050201905080600101548311156118115760405162461bcd60e51b815260206004820181905260248201527f5468657265206973206e6f20737563682072756c696e6720746f2066756e642e604482015260640161083b565b60015460405163afe15cfb60e01b81526004810186905260009182916001600160a01b039091169063afe15cfb90602401604080518083038186803b15801561185957600080fd5b505afa15801561186d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118919190613f4b565b915091508142101580156118a457508042105b6118e95760405162461bcd60e51b815260206004820152601660248201527520b83832b0b6103832b934b7b21034b99037bb32b91760511b604482015260640161083b565b604051631c3db16d60e01b81526004810187905260009086903090631c3db16d9060240160206040518083038186803b15801561192557600080fd5b505afa158015611939573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061195d9190613d21565b141561196c57506127106119ec565b61271061138861197c8585613d7e565b6119869190613e13565b6119909190613e48565b61199a8442613d7e565b106119e75760405162461bcd60e51b815260206004820152601f60248201527f41707065616c20706572696f64206973206f76657220666f72206c6f73657200604482015260640161083b565b50614e205b835460009085906119ff90600190613d7e565b81548110611a0f57611a0f613d68565b60009182526020822060018054604051637e37c78b60e11b8152600481018e9052600c949094029092019450916001600160a01b039091169063fc6f8f169060240160206040518083038186803b158015611a6957600080fd5b505afa158015611a7d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa19190613d21565b611aab9190613d7e565b600089815260078401602052604090205490915060ff1615611b0f5760405162461bcd60e51b815260206004820152601b60248201527f41707065616c2066656520697320616c726561647920706169642e0000000000604482015260640161083b565b600154604051632cf6413f60e11b8152600481018b90526000916001600160a01b0316906359ec827e9060240160206040518083038186803b158015611b5457600080fd5b505afa158015611b68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b8c9190613d21565b90506000612710611b9d8684613e13565b611ba79190613e48565b611bb19083613d50565b60008b815260068601602052604081205491925090821115611c545760008b81526006860160205260409020543490611bea9084613d7e565b11611c0f5760008b8152600686016020526040902054611c0a9083613d7e565b611c11565b345b604080518d815260208101839052919250339186918f917fcae597f39a3ad75c2e10d46b031f023c5c2babcd58ca0491b122acda3968d4c0910160405180910390a45b33600090815260088601602090815260408083208e845290915281208054839290611c80908490613d50565b909155505060008b815260068601602052604081208054839290611ca5908490613d50565b909155505060008b81526006860160205260409020548211611d4f5760008b815260068601602052604081205460098701805491929091611ce7908490613d50565b9091555050600a8501805460018181018355600092835260208084209092018e90558d8352600788019091526040808320805460ff1916909217909155518c9186918f917fed764996238e4c1c873ae3af7ae2f00f1f6f4f10b9ac7d4bbea4a764c5dea00991a45b600a85015460011015611f8f57828560090154611d6c9190613d7e565b60098601556001546040516319b8152960e01b8152600481018e90526001600160a01b03909116906319b815299060240160206040518083038186803b158015611db557600080fd5b505afa158015611dc9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ded9190613d06565b15611e065760028901805460ff19166001179055611f0f565b885460038a016000611e19876001613d50565b8152602001908152602001600020819055506000896000016001816001815401808255809150500390600052602060002090600c02019050600160009054906101000a90046001600160a01b03166001600160a01b031663c71f42538e6040518263ffffffff1660e01b8152600401611e9491815260200190565b60206040518083038186803b158015611eac57600080fd5b505afa158015611ec0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ee49190613d21565b600b82015560038101805460ff1916600117905560068054906000611f0883613f19565b9190505550505b600160009054906101000a90046001600160a01b03166001600160a01b031663c3569902848e8c600101548d6004016040518563ffffffff1660e01b8152600401611f5c93929190613faa565b6000604051808303818588803b158015611f7557600080fd5b505af1158015611f89573d6000803e3d6000fd5b50505050505b80341115611fbd57336108fc611fa58334613d7e565b6040518115909202916000818181858888f150505050505b505050505050505050505050565b600083815260086020526040812054600780548392908110611fef57611fef613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061202357612023613d68565b90600052602060002090600c0201600001848154811061204557612045613d68565b600091825260208220600154604051639b05c26160e01b815260048082018c905293909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561209d57600080fd5b505afa1580156120b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120d59190614062565b6003850154919350915060ff1680156120f8575081836002015414806120f85750805b1561210b57612710945050505050612114565b60009450505050505b9392505050565b6007818154811061212b57600080fd5b600091825260209091206005909102016001810154600282015460048301805492945060ff909116929161215e90613f6f565b80601f016020809104026020016040519081016040528092919081815260200182805461218a90613f6f565b80156121d75780601f106121ac576101008083540402835291602001916121d7565b820191906000526020600020905b8154815290600101906020018083116121ba57829003601f168201915b5050505050905083565b60008481526008602052604090205460078054869290811061220557612205613d68565b600091825260209091206002600590920201015460ff16156122395760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018790526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561227e57600080fd5b505afa158015612292573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122b69190613dac565b50909350600192506122c6915050565b8160048111156122d8576122d8613c37565b146123355760405162461bcd60e51b815260206004820152602760248201527f54686520646973707574652073686f756c6420626520696e20436f6d6d6974206044820152663832b934b7b21760c91b606482015260840161083b565b826123725760405162461bcd60e51b815260206004820152600d60248201526c22b6b83a3c9031b7b6b6b4ba1760991b604482015260640161083b565b60008681526008602052604081205460078054909190811061239657612396613d68565b600091825260208220600590910201805490925082906123b890600190613d7e565b815481106123c8576123c8613d68565b90600052602060002090600c0201905060005b868110156124c65733828989848181106123f7576123f7613d68565b905060200201358154811061240e5761240e613d68565b60009182526020909120600490910201546001600160a01b0316146124755760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b858289898481811061248957612489613d68565b90506020020135815481106124a0576124a0613d68565b6000918252602090912060016004909202010155806124be81613f19565b9150506123db565b50868690508160050160008282546124de9190613d50565b90915550505050505050505050565b60008060008060008060006007600860008c8152602001908152602001600020548154811061251e5761251e613d68565b600091825260208083208c845260036005909302019182019052604082205481549193508391811061255257612552613d68565b600091825260208083206001600c909302019182015460038301546004840154600585015485549f87526002909501909352604090942054909f60ff9094169e50909c50909a9950975095505050505050565b6000818152600860205260408120546007805483929081106125c9576125c9613d68565b600091825260208220600590910201805490925082906125eb90600190613d7e565b815481106125fb576125fb613d68565b60009182526020909120600c90910201805460049091015414949350505050565b6000546001600160a01b031633146126465760405162461bcd60e51b815260040161083b9061408e565b6000836001600160a01b0316838360405161266191906140d0565b60006040518083038185875af1925050503d806000811461269e576040519150601f19603f3d011682016040523d82523d6000602084013e6126a3565b606091505b50509050806126e85760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b604482015260640161083b565b50505050565b60008681526008602052604090205460078054889290811061271257612712613d68565b600091825260209091206002600590920201015460ff16156127465760405162461bcd60e51b815260040161083b90613ea0565b60015460405163564a565d60e01b8152600481018990526000916001600160a01b03169063564a565d9060240160a06040518083038186803b15801561278b57600080fd5b505afa15801561279f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c39190613dac565b50909350600292506127d3915050565b8160048111156127e5576127e5613c37565b146128405760405162461bcd60e51b815260206004820152602560248201527f54686520646973707574652073686f756c6420626520696e20566f74652070656044820152643934b7b21760d91b606482015260840161083b565b856128825760405162461bcd60e51b8152602060048201526012602482015271139bc81d9bdd195251081c1c9bdd9a59195960721b604482015260640161083b565b6000888152600860205260408120546007805490919081106128a6576128a6613d68565b9060005260206000209060050201905080600101548611156129015760405162461bcd60e51b815260206004820152601460248201527343686f696365206f7574206f6620626f756e647360601b604482015260640161083b565b8054600090829061291490600190613d7e565b8154811061292457612924613d68565b60009182526020822060015460405163564a565d60e01b8152600481018f9052600c9390930290910193506001600160a01b03169063564a565d9060240160a06040518083038186803b15801561297a57600080fd5b505afa15801561298e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129b29190613dac565b5050600154604051630fad06e960e11b81526001600160601b03851660048201529394506000936001600160a01b039091169250631f5a0dd2915060240160c06040518083038186803b158015612a0857600080fd5b505afa158015612a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a4091906140ec565b5050505091505060005b8a811015612cee5733848d8d84818110612a6657612a66613d68565b9050602002013581548110612a7d57612a7d613d68565b60009182526020909120600490910201546001600160a01b031614612ae45760405162461bcd60e51b815260206004820152601f60248201527f5468652063616c6c65722068617320746f206f776e2074686520766f74652e00604482015260640161083b565b811580612b58575089888a604051602001612b0193929190614144565b60405160208183030381529060405280519060200120846000018d8d84818110612b2d57612b2d613d68565b9050602002013581548110612b4457612b44613d68565b906000526020600020906004020160010154145b612bcc576040805162461bcd60e51b81526020600482015260248101919091527f54686520636f6d6d6974206d757374206d61746368207468652063686f69636560448201527f20696e20737562636f7572747320776974682068696464656e20766f7465732e606482015260840161083b565b838c8c83818110612bdf57612bdf613d68565b9050602002013581548110612bf657612bf6613d68565b600091825260209091206003600490920201015460ff1615612c4f5760405162461bcd60e51b81526020600482015260126024820152712b37ba329030b63932b0b23c9031b0b9ba1760711b604482015260640161083b565b89848d8d84818110612c6357612c63613d68565b9050602002013581548110612c7a57612c7a613d68565b60009182526020909120600260049092020101556001848d8d84818110612ca357612ca3613d68565b9050602002013581548110612cba57612cba613d68565b60009182526020909120600490910201600301805460ff191691151591909117905580612ce681613f19565b915050612a4a565b508a8a9050836004016000828254612d069190613d50565b90915550506000898152600284016020526040812080548c9290612d2b908490613d50565b90915550506001830154891415612d5b57600383015460ff1615612d565760038301805460ff191690555b612dd5565b60018301546000908152600284016020526040808220548b83529120541415612d9e57600383015460ff16612d565760038301805460ff19166001179055612dd5565b60018301546000908152600284016020526040808220548b83529120541115612dd5576001830189905560038301805460ff191690555b88336001600160a01b03168d7fbf654140f91f2e524d875f097947702b44380492730dd1653f5482c0b33e49cd8a604051612e109190614171565b60405180910390a4505050505050505050505050565b6000546001600160a01b03163314612e505760405162461bcd60e51b815260040161083b9061408e565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000818152600860205260408120546007805483928392918110612e9857612e98613d68565b60009182526020822060059091020180549092508290612eba90600190613d7e565b81548110612eca57612eca613d68565b60009182526020909120600c909102016001810154600390910154909660ff90911695509350505050565b600154604051339185916001600160a01b03909116907fdccf2f8b2cc26eafcd61905cba744cff4b81d14740725f6376390dc6298a6a3c90612f3a9087908790614184565b60405180910390a4505050565b60008060008060006007600860008a81526020019081526020016000205481548110612f7557612f75613d68565b600091825260208083208a8452600360059093020191820190526040822054815491935083918110612fa957612fa9613d68565b90600052602060002090600c02016000018781548110612fcb57612fcb613d68565b600091825260209091206004909102018054600182015460028301546003909301546001600160a01b039092169c909b5091995060ff16975095505050505050565b6001546001600160a01b031633146130375760405162461bcd60e51b815260040161083b90613e5c565b60078054600181018255600091909152600581027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68981018690557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6888101906130c2907fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68c018686613771565b50805460018054604051637e37c78b60e11b8152600481018b9052600385019260009290916001600160a01b039091169063fc6f8f169060240160206040518083038186803b15801561311457600080fd5b505afa158015613128573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061314c9190613d21565b6131569190613d7e565b81526020808201929092526040908101600090812093909355835460018181018655858552838520600b600c9093020191820188905560038201805460ff191690911790558a8452600890925282208490556006805491926131b783613f19565b91905055505050505050505050565b6000838152600860205260408120546007805483929081106131ea576131ea613d68565b6000918252602080832087845260036005909302019182019052604082205481549193508391811061321e5761321e613d68565b90600052602060002090600c0201600001848154811061324057613240613d68565b600091825260209091206004909102016003015460ff169695505050505050565b6000546001600160a01b0316331461328b5760405162461bcd60e51b815260040161083b9061408e565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b60008060055460ff1660028111156132c7576132c7613c37565b14905090565b6000828152600860205260408120546007805483929081106132f1576132f1613d68565b6000918252602080832086845260036005909302019182019052604082205481549193508391811061332557613325613d68565b600091825260208220600154604051639b05c26160e01b8152600481018a9052600c93909302909101935082916001600160a01b0390911690639b05c26190602401604080518083038186803b15801561337e57600080fd5b505afa158015613392573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133b69190614062565b915091508260040154600014806133e45750801580156133e457506000828152600284016020526040902054155b156133f6576000945050505050613427565b801561340b5750506004015491506134279050565b5060009081526002909101602052604090205491506134279050565b92915050565b6000546001600160a01b031633146134575760405162461bcd60e51b815260040161083b9061408e565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b600254604051630e39b00f60e11b81524360048201526000916001600160a01b031690631c73601e90602401602060405180830381600087803b1580156134bf57600080fd5b505af11580156134d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134f79190613d21565b905090565b600060405160005b601481101561351f5783811a81600c84010153600101613504565b505192915050565b60015460405163564a565d60e01b81526004810184905260009182916001600160a01b039091169063564a565d9060240160a06040518083038186803b15801561357057600080fd5b505afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190613dac565b505060018054604051637e37c78b60e11b8152600481018a90529495506000946001600160a01b039091169350638a9bb02a9250889190849063fc6f8f169060240160206040518083038186803b15801561360257600080fd5b505afa158015613616573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363a9190613d21565b6136449190613d7e565b6040516001600160e01b031960e085901b1681526004810192909252602482015260440160006040518083038186803b15801561368057600080fd5b505afa158015613694573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136bc91908101906141b3565b5050600154604051631a383be960e31b81526001600160a01b038a811660048301526001600160601b0389166024830152959650600095869550909116925063d1c1df489150604401604080518083038186803b15801561371c57600080fd5b505afa158015613730573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137549190613f4b565b90925090506137638382613d50565b909110159695505050505050565b82805461377d90613f6f565b90600052602060002090601f01602090048101928261379f57600085556137e5565b82601f106137b85782800160ff198235161785556137e5565b828001600101855582156137e5579182015b828111156137e55782358255916020019190600101906137ca565b506137f19291506137f5565b5090565b5b808211156137f157600081556001016137f6565b60006020828403121561381c57600080fd5b5035919050565b6001600160a01b038116811461383857600080fd5b50565b6000806000806080858703121561385157600080fd5b84359350602085013561386381613823565b93969395505050506040820135916060013590565b6000806040838503121561388b57600080fd5b50508035926020909101359150565b6000806000606084860312156138af57600080fd5b505081359360208301359350604090920135919050565b60005b838110156138e15781810151838201526020016138c9565b838111156126e85750506000910152565b6000815180845261390a8160208601602086016138c6565b601f01601f19169290920160200192915050565b838152821515602082015260606040820152600061393f60608301846138f2565b95945050505050565b60008083601f84011261395a57600080fd5b50813567ffffffffffffffff81111561397257600080fd5b6020830191508360208260051b850101111561398d57600080fd5b9250929050565b600080600080606085870312156139aa57600080fd5b84359350602085013567ffffffffffffffff8111156139c857600080fd5b6139d487828801613948565b9598909750949560400135949350505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613a2657613a266139e7565b604052919050565b600067ffffffffffffffff831115613a4857613a486139e7565b613a5b601f8401601f19166020016139fd565b9050828152838383011115613a6f57600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613a9b57600080fd5b8335613aa681613823565b925060208401359150604084013567ffffffffffffffff811115613ac957600080fd5b8401601f81018613613ada57600080fd5b613ae986823560208401613a2e565b9150509250925092565b60008060008060008060a08789031215613b0c57600080fd5b86359550602087013567ffffffffffffffff80821115613b2b57600080fd5b613b378a838b01613948565b909750955060408901359450606089013593506080890135915080821115613b5e57600080fd5b508701601f81018913613b7057600080fd5b613b7f89823560208401613a2e565b9150509295509295509295565b600060208284031215613b9e57600080fd5b813561211481613823565b60008083601f840112613bbb57600080fd5b50813567ffffffffffffffff811115613bd357600080fd5b60208301915083602082850101111561398d57600080fd5b600080600060408486031215613c0057600080fd5b83359250602084013567ffffffffffffffff811115613c1e57600080fd5b613c2a86828701613ba9565b9497909650939450505050565b634e487b7160e01b600052602160045260246000fd5b6020810160038310613c6f57634e487b7160e01b600052602160045260246000fd5b91905290565b600080600080600060808688031215613c8d57600080fd5b8535945060208601359350604086013567ffffffffffffffff811115613cb257600080fd5b613cbe88828901613ba9565b96999598509660600135949350505050565b600060208284031215613ce257600080fd5b81516002811061211457600080fd5b80518015158114613d0157600080fd5b919050565b600060208284031215613d1857600080fd5b61211482613cf1565b600060208284031215613d3357600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115613d6357613d63613d3a565b500190565b634e487b7160e01b600052603260045260246000fd5b600082821015613d9057613d90613d3a565b500390565b80516001600160601b0381168114613d0157600080fd5b600080600080600060a08688031215613dc457600080fd5b613dcd86613d95565b94506020860151613ddd81613823565b604087015190945060058110613df257600080fd5b9250613e0060608701613cf1565b9150608086015190509295509295909350565b6000816000190483118215151615613e2d57613e2d613d3a565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613e5757613e57613e32565b500490565b60208082526024908201527f416363657373206e6f7420616c6c6f7765643a204b6c65726f73436f7265206f60408201526337363c9760e11b606082015260800190565b6020808252601e908201527f44697370757465206a756d70656420746f206120706172656e7420444b210000604082015260600190565b600080600060608486031215613eec57600080fd5b8351925060208401519150604084015190509250925092565b600082613f1457613f14613e32565b500690565b6000600019821415613f2d57613f2d613d3a565b5060010190565b600081613f4357613f43613d3a565b506000190190565b60008060408385031215613f5e57600080fd5b505080516020909101519092909150565b600181811c90821680613f8357607f821691505b60208210811415613fa457634e487b7160e01b600052602260045260246000fd5b50919050565b838152600060208481840152606060408401526000845481600182811c915080831680613fd857607f831692505b858310811415613ff657634e487b7160e01b85526022600452602485fd5b6060880183905260808801818015614015576001811461402657614051565b60ff19861682528782019650614051565b60008b81526020902060005b8681101561404b57815484820152908501908901614032565b83019750505b50949b9a5050505050505050505050565b6000806040838503121561407557600080fd5b8251915061408560208401613cf1565b90509250929050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600082516140e28184602087016138c6565b9190910192915050565b60008060008060008060c0878903121561410557600080fd5b61410e87613d95565b955061411c60208801613cf1565b945060408701519350606087015192506080870151915060a087015190509295509295509295565b8381526000835161415c8160208501602088016138c6565b60209201918201929092526040019392505050565b60208152600061211460208301846138f2565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b60008060008060008060c087890312156141cc57600080fd5b8651955060208088015195506040880151945060608801519350608088015167ffffffffffffffff8082111561420157600080fd5b818a0191508a601f83011261421557600080fd5b815181811115614227576142276139e7565b8060051b91506142388483016139fd565b818152918301840191848101908d84111561425257600080fd5b938501935b8385101561427c578451925061426c83613823565b8282529385019390850190614257565b80975050505050505060a08701519050929550929550929556fea264697066735822122093e1025e8596baad92b8acbc1dfd801832f0c4845d9b926d2b306bac5cf1c9ee64736f6c63430008090033", "devdoc": { "kind": "dev", "methods": { @@ -952,7 +952,7 @@ } }, "castCommit(uint256,uint256[],bytes32)": { - "details": "Sets the caller's commit for the specified votes. `O(n)` where `n` is the number of votes.", + "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.", @@ -1128,7 +1128,7 @@ "storageLayout": { "storage": [ { - "astId": 6466, + "astId": 6201, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "governor", "offset": 0, @@ -1136,23 +1136,23 @@ "type": "t_address" }, { - "astId": 6469, + "astId": 6204, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "core", "offset": 0, "slot": "1", - "type": "t_contract(KlerosCore)5902" + "type": "t_contract(KlerosCore)5813" }, { - "astId": 6643, + "astId": 6378, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "rng", "offset": 0, "slot": "2", - "type": "t_contract(RNG)16884" + "type": "t_contract(RNG)24354" }, { - "astId": 6645, + "astId": 6380, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "RNBlock", "offset": 0, @@ -1160,7 +1160,7 @@ "type": "t_uint256" }, { - "astId": 6647, + "astId": 6382, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "RN", "offset": 0, @@ -1168,15 +1168,15 @@ "type": "t_uint256" }, { - "astId": 6650, + "astId": 6385, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "phase", "offset": 0, "slot": "5", - "type": "t_enum(Phase)6566" + "type": "t_enum(Phase)6301" }, { - "astId": 6652, + "astId": 6387, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "disputesWithoutJurors", "offset": 0, @@ -1184,15 +1184,15 @@ "type": "t_uint256" }, { - "astId": 6656, + "astId": 6391, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "disputes", "offset": 0, "slot": "7", - "type": "t_array(t_struct(Dispute)6581_storage)dyn_storage" + "type": "t_array(t_struct(Dispute)6316_storage)dyn_storage" }, { - "astId": 6660, + "astId": 6395, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "coreDisputeIDToLocal", "offset": 0, @@ -1206,20 +1206,20 @@ "label": "address", "numberOfBytes": "20" }, - "t_array(t_struct(Dispute)6581_storage)dyn_storage": { - "base": "t_struct(Dispute)6581_storage", + "t_array(t_struct(Dispute)6316_storage)dyn_storage": { + "base": "t_struct(Dispute)6316_storage", "encoding": "dynamic_array", "label": "struct DisputeKitClassic.Dispute[]", "numberOfBytes": "32" }, - "t_array(t_struct(Round)6619_storage)dyn_storage": { - "base": "t_struct(Round)6619_storage", + "t_array(t_struct(Round)6354_storage)dyn_storage": { + "base": "t_struct(Round)6354_storage", "encoding": "dynamic_array", "label": "struct DisputeKitClassic.Round[]", "numberOfBytes": "32" }, - "t_array(t_struct(Vote)6628_storage)dyn_storage": { - "base": "t_struct(Vote)6628_storage", + "t_array(t_struct(Vote)6363_storage)dyn_storage": { + "base": "t_struct(Vote)6363_storage", "encoding": "dynamic_array", "label": "struct DisputeKitClassic.Vote[]", "numberOfBytes": "32" @@ -1245,17 +1245,17 @@ "label": "bytes", "numberOfBytes": "32" }, - "t_contract(KlerosCore)5902": { + "t_contract(KlerosCore)5813": { "encoding": "inplace", "label": "contract KlerosCore", "numberOfBytes": "20" }, - "t_contract(RNG)16884": { + "t_contract(RNG)24354": { "encoding": "inplace", "label": "contract RNG", "numberOfBytes": "20" }, - "t_enum(Phase)6566": { + "t_enum(Phase)6301": { "encoding": "inplace", "label": "enum DisputeKitClassic.Phase", "numberOfBytes": "1" @@ -1281,20 +1281,20 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(Dispute)6581_storage": { + "t_struct(Dispute)6316_storage": { "encoding": "inplace", "label": "struct DisputeKitClassic.Dispute", "members": [ { - "astId": 6570, + "astId": 6305, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "rounds", "offset": 0, "slot": "0", - "type": "t_array(t_struct(Round)6619_storage)dyn_storage" + "type": "t_array(t_struct(Round)6354_storage)dyn_storage" }, { - "astId": 6572, + "astId": 6307, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "numberOfChoices", "offset": 0, @@ -1302,7 +1302,7 @@ "type": "t_uint256" }, { - "astId": 6574, + "astId": 6309, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "jumped", "offset": 0, @@ -1310,7 +1310,7 @@ "type": "t_bool" }, { - "astId": 6578, + "astId": 6313, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "coreRoundIDToLocal", "offset": 0, @@ -1318,7 +1318,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 6580, + "astId": 6315, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "extraData", "offset": 0, @@ -1328,20 +1328,20 @@ ], "numberOfBytes": "160" }, - "t_struct(Round)6619_storage": { + "t_struct(Round)6354_storage": { "encoding": "inplace", "label": "struct DisputeKitClassic.Round", "members": [ { - "astId": 6585, + "astId": 6320, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "votes", "offset": 0, "slot": "0", - "type": "t_array(t_struct(Vote)6628_storage)dyn_storage" + "type": "t_array(t_struct(Vote)6363_storage)dyn_storage" }, { - "astId": 6587, + "astId": 6322, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "winningChoice", "offset": 0, @@ -1349,7 +1349,7 @@ "type": "t_uint256" }, { - "astId": 6591, + "astId": 6326, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "counts", "offset": 0, @@ -1357,7 +1357,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 6593, + "astId": 6328, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "tied", "offset": 0, @@ -1365,7 +1365,7 @@ "type": "t_bool" }, { - "astId": 6595, + "astId": 6330, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "totalVoted", "offset": 0, @@ -1373,7 +1373,7 @@ "type": "t_uint256" }, { - "astId": 6597, + "astId": 6332, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "totalCommitted", "offset": 0, @@ -1381,7 +1381,7 @@ "type": "t_uint256" }, { - "astId": 6601, + "astId": 6336, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "paidFees", "offset": 0, @@ -1389,7 +1389,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 6605, + "astId": 6340, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "hasPaid", "offset": 0, @@ -1397,7 +1397,7 @@ "type": "t_mapping(t_uint256,t_bool)" }, { - "astId": 6611, + "astId": 6346, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "contributions", "offset": 0, @@ -1405,7 +1405,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" }, { - "astId": 6613, + "astId": 6348, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "feeRewards", "offset": 0, @@ -1413,7 +1413,7 @@ "type": "t_uint256" }, { - "astId": 6616, + "astId": 6351, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "fundedChoices", "offset": 0, @@ -1421,7 +1421,7 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 6618, + "astId": 6353, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "nbVotes", "offset": 0, @@ -1431,12 +1431,12 @@ ], "numberOfBytes": "384" }, - "t_struct(Vote)6628_storage": { + "t_struct(Vote)6363_storage": { "encoding": "inplace", "label": "struct DisputeKitClassic.Vote", "members": [ { - "astId": 6621, + "astId": 6356, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "account", "offset": 0, @@ -1444,7 +1444,7 @@ "type": "t_address" }, { - "astId": 6623, + "astId": 6358, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "commit", "offset": 0, @@ -1452,7 +1452,7 @@ "type": "t_bytes32" }, { - "astId": 6625, + "astId": 6360, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "choice", "offset": 0, @@ -1460,7 +1460,7 @@ "type": "t_uint256" }, { - "astId": 6627, + "astId": 6362, "contract": "src/arbitration/dispute-kits/DisputeKitClassic.sol:DisputeKitClassic", "label": "voted", "offset": 0, diff --git a/contracts/deployments/arbitrumRinkeby/DisputeResolver.json b/contracts/deployments/arbitrumRinkeby/DisputeResolver.json index 83a709b96..1d3132981 100644 --- a/contracts/deployments/arbitrumRinkeby/DisputeResolver.json +++ b/contracts/deployments/arbitrumRinkeby/DisputeResolver.json @@ -1,5 +1,5 @@ { - "address": "0x9cE885713c7459d571593e2793cd2b258B018995", + "address": "0x67e8191F61466c57A17542A52F9f39f336A242fD", "abi": [ { "inputs": [ @@ -232,27 +232,27 @@ "type": "function" } ], - "transactionHash": "0xe3ceec8f446dda903b92017af4520659d306df9a444a68659fa22b62fa34d44e", + "transactionHash": "0x4977676e3acf42d9facce36154e29d11a7c440f124ae177103df32e5dd3c309f", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x9cE885713c7459d571593e2793cd2b258B018995", - "transactionIndex": 0, - "gasUsed": "8621995", + "contractAddress": "0x67e8191F61466c57A17542A52F9f39f336A242fD", + "transactionIndex": 1, + "gasUsed": "569678", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6a0b389b5ed3d548b791b55f99a512edde05825bc12d507e4e65714c4765698e", - "transactionHash": "0xe3ceec8f446dda903b92017af4520659d306df9a444a68659fa22b62fa34d44e", + "blockHash": "0xe9c016d57f8ffbefa4d05bc27ddcc2d5b62e2512bdb5a296725c154333231f24", + "transactionHash": "0x4977676e3acf42d9facce36154e29d11a7c440f124ae177103df32e5dd3c309f", "logs": [], - "blockNumber": 13351478, - "cumulativeGasUsed": "3819135", + "blockNumber": 14452901, + "cumulativeGasUsed": "569678", "status": 1, "byzantium": true }, "args": [ - "0x140Cae40BD7eEF075e15c30CF84d1EAa0F4932b8" + "0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F" ], - "numDeployments": 1, - "solcInputHash": "d464953816050410147003aa7264a227", + "numDeployments": 2, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", "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\":200},\"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": "0x60a060405234801561001057600080fd5b506040516109f23803806109f283398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b60805161095361009f6000396000818160bc0152818161017c0152818161044c01526105f501526109536000f3fe60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636cc6cde1146100aa578063c21ae061146100f6578063e2c7981b14610131575b600080fd5b34801561005b57600080fd5b5061006f61006a3660046106e4565b610144565b005b34801561007d57600080fd5b5061009161008c366004610706565b610309565b6040516100a1949392919061071f565b60405180910390f35b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a1565b34801561010257600080fd5b50610123610111366004610706565b60016020526000908152604090205481565b6040519081526020016100a1565b61012361013f3660046107d7565b6103d7565b600082815260016020526040812054815490919081908390811061016a5761016a61084b565b906000526020600020906004020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b03161461020e5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600301548311156102545760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610205565b600181015460ff16156102b55760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610205565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000818154811061031957600080fd5b906000526020600020906004020160009150905080600001805461033c90610861565b80601f016020809104026020016040519081016040528092919081815260200182805461036890610861565b80156103b55780601f1061038a576101008083540402835291602001916103b5565b820191906000526020600020905b81548152906001019060200180831161039857829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b6000600182116104355760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b6064820152608401610205565b60405163c13517e160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c13517e19034906104879086908b908b906004016108c5565b6020604051808303818588803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104d991906108e8565b600080546040805160a06020601f8c018190040282018101909252608081018a8152949550919382918b908b90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381528190208251805193946004029091019261055d928492019061064b565b506020828101516001838101805460ff191692151592909217909155604080850151600285015560609094015160039093019290925560008581529190528190208290555181907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906105d39088908890610901565b60405180910390a2604080518281526020810183905283916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a35095945050505050565b82805461065790610861565b90600052602060002090601f01602090048101928261067957600085556106bf565b82601f1061069257805160ff19168380011785556106bf565b828001600101855582156106bf579182015b828111156106bf5782518255916020019190600101906106a4565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b600080604083850312156106f757600080fd5b50508035926020909101359150565b60006020828403121561071857600080fd5b5035919050565b608081526000855180608084015260005b8181101561074d57602081890181015160a0868401015201610730565b8181111561075f57600060a083860101525b50601f01601f1916820160a001905061077c602083018615159052565b60408201939093526060015292915050565b60008083601f8401126107a057600080fd5b50813567ffffffffffffffff8111156107b857600080fd5b6020830191508360208285010111156107d057600080fd5b9250929050565b6000806000806000606086880312156107ef57600080fd5b853567ffffffffffffffff8082111561080757600080fd5b61081389838a0161078e565b9097509550602088013591508082111561082c57600080fd5b506108398882890161078e565b96999598509660400135949350505050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061087557607f821691505b6020821081141561089657634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108df60408301848661089c565b95945050505050565b6000602082840312156108fa57600080fd5b5051919050565b60208152600061091560208301848661089c565b94935050505056fea264697066735822122083e2e679a36b979e1db21c9f528914d8fe5b8d06e366e622a0688990fa7ee10d64736f6c63430008090033", "deployedBytecode": "0x60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636cc6cde1146100aa578063c21ae061146100f6578063e2c7981b14610131575b600080fd5b34801561005b57600080fd5b5061006f61006a3660046106e4565b610144565b005b34801561007d57600080fd5b5061009161008c366004610706565b610309565b6040516100a1949392919061071f565b60405180910390f35b3480156100b657600080fd5b506100de7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a1565b34801561010257600080fd5b50610123610111366004610706565b60016020526000908152604090205481565b6040519081526020016100a1565b61012361013f3660046107d7565b6103d7565b600082815260016020526040812054815490919081908390811061016a5761016a61084b565b906000526020600020906004020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b03161461020e5760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b80600301548311156102545760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b6044820152606401610205565b600181015460ff16156102b55760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b6064820152608401610205565b6001818101805460ff1916909117905560028101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6000818154811061031957600080fd5b906000526020600020906004020160009150905080600001805461033c90610861565b80601f016020809104026020016040519081016040528092919081815260200182805461036890610861565b80156103b55780601f1061038a576101008083540402835291602001916103b5565b820191906000526020600020905b81548152906001019060200180831161039857829003601f168201915b5050505060018301546002840154600390940154929360ff9091169290915084565b6000600182116104355760405162461bcd60e51b8152602060048201526024808201527f53686f756c64206265206174206c6561737420322072756c696e67206f70746960448201526337b7399760e11b6064820152608401610205565b60405163c13517e160e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c13517e19034906104879086908b908b906004016108c5565b6020604051808303818588803b1580156104a057600080fd5b505af11580156104b4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104d991906108e8565b600080546040805160a06020601f8c018190040282018101909252608081018a8152949550919382918b908b90819085018382808284376000920182905250938552505050602080830182905260408301829052606090920187905283546001810185559381528190208251805193946004029091019261055d928492019061064b565b506020828101516001838101805460ff191692151592909217909155604080850151600285015560609094015160039093019290925560008581529190528190208290555181907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906105d39088908890610901565b60405180910390a2604080518281526020810183905283916001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a35095945050505050565b82805461065790610861565b90600052602060002090601f01602090048101928261067957600085556106bf565b82601f1061069257805160ff19168380011785556106bf565b828001600101855582156106bf579182015b828111156106bf5782518255916020019190600101906106a4565b506106cb9291506106cf565b5090565b5b808211156106cb57600081556001016106d0565b600080604083850312156106f757600080fd5b50508035926020909101359150565b60006020828403121561071857600080fd5b5035919050565b608081526000855180608084015260005b8181101561074d57602081890181015160a0868401015201610730565b8181111561075f57600060a083860101525b50601f01601f1916820160a001905061077c602083018615159052565b60408201939093526060015292915050565b60008083601f8401126107a057600080fd5b50813567ffffffffffffffff8111156107b857600080fd5b6020830191508360208285010111156107d057600080fd5b9250929050565b6000806000806000606086880312156107ef57600080fd5b853567ffffffffffffffff8082111561080757600080fd5b61081389838a0161078e565b9097509550602088013591508082111561082c57600080fd5b506108398882890161078e565b96999598509660400135949350505050565b634e487b7160e01b600052603260045260246000fd5b600181811c9082168061087557607f821691505b6020821081141561089657634e487b7160e01b600052602260045260246000fd5b50919050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b8381526040602082015260006108df60408301848661089c565b95945050505050565b6000602082840312156108fa57600080fd5b5051919050565b60208152600061091560208301848661089c565b94935050505056fea264697066735822122083e2e679a36b979e1db21c9f528914d8fe5b8d06e366e622a0688990fa7ee10d64736f6c63430008090033", @@ -295,15 +295,15 @@ "storageLayout": { "storage": [ { - "astId": 6304, + "astId": 6039, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "disputes", "offset": 0, "slot": "0", - "type": "t_array(t_struct(DisputeStruct)6297_storage)dyn_storage" + "type": "t_array(t_struct(DisputeStruct)6032_storage)dyn_storage" }, { - "astId": 6308, + "astId": 6043, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "externalIDtoLocalID", "offset": 0, @@ -312,8 +312,8 @@ } ], "types": { - "t_array(t_struct(DisputeStruct)6297_storage)dyn_storage": { - "base": "t_struct(DisputeStruct)6297_storage", + "t_array(t_struct(DisputeStruct)6032_storage)dyn_storage": { + "base": "t_struct(DisputeStruct)6032_storage", "encoding": "dynamic_array", "label": "struct DisputeResolver.DisputeStruct[]", "numberOfBytes": "32" @@ -335,12 +335,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(DisputeStruct)6297_storage": { + "t_struct(DisputeStruct)6032_storage": { "encoding": "inplace", "label": "struct DisputeResolver.DisputeStruct", "members": [ { - "astId": 6290, + "astId": 6025, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "arbitratorExtraData", "offset": 0, @@ -348,7 +348,7 @@ "type": "t_bytes_storage" }, { - "astId": 6292, + "astId": 6027, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "isRuled", "offset": 0, @@ -356,7 +356,7 @@ "type": "t_bool" }, { - "astId": 6294, + "astId": 6029, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "ruling", "offset": 0, @@ -364,7 +364,7 @@ "type": "t_uint256" }, { - "astId": 6296, + "astId": 6031, "contract": "src/arbitration/arbitrables/DisputeResolver.sol:DisputeResolver", "label": "numberOfRulingOptions", "offset": 0, diff --git a/contracts/deployments/arbitrumRinkeby/FastBridgeSender.json b/contracts/deployments/arbitrumRinkeby/FastBridgeSender.json index ac27b4dc6..1ea95a2bf 100644 --- a/contracts/deployments/arbitrumRinkeby/FastBridgeSender.json +++ b/contracts/deployments/arbitrumRinkeby/FastBridgeSender.json @@ -1,16 +1,16 @@ { - "address": "0x0b9e03455Fed83f209Fa7ce596c93ba6aBAd1f46", + "address": "0xf8A4a85e7153374A1b9BDA763a84252eC286843b", "abi": [ { "inputs": [ { - "internalType": "contract ISafeBridge", - "name": "_safebridge", - "type": "address" + "internalType": "uint256", + "name": "_epochPeriod", + "type": "uint256" }, { - "internalType": "contract IFastBridgeReceiver", - "name": "_fastBridgeReceiver", + "internalType": "address", + "name": "_safeBridgeReceiver", "type": "address" } ], @@ -20,34 +20,78 @@ { "anonymous": false, "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "batchID", + "type": "uint256" + }, { "indexed": false, - "internalType": "address", - "name": "target", - "type": "address" + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" }, { "indexed": false, "internalType": "bytes32", - "name": "messageHash", + "name": "batchMerkleRoot", "type": "bytes32" - }, + } + ], + "name": "BatchOutgoing", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ { "indexed": false, "internalType": "bytes", - "name": "message", + "name": "fastMessage", "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "fastMessageHash", + "type": "bytes32" + } + ], + "name": "MessageReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "canonicalBridgeMessageID", + "type": "bytes32" } ], - "name": "OutgoingMessage", + "name": "SentSafe", "type": "event" }, { "inputs": [], - "name": "fastBridgeReceiver", + "name": "ARB_SYS", "outputs": [ { - "internalType": "contract IFastBridgeReceiver", + "internalType": "contract IArbSys", "name": "", "type": "address" } @@ -55,14 +99,33 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "batch", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], - "name": "fastSender", + "name": "batchSize", "outputs": [ { - "internalType": "address", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" } ], "stateMutability": "view", @@ -70,12 +133,25 @@ }, { "inputs": [], - "name": "safebridge", + "name": "currentBatchID", "outputs": [ { - "internalType": "contract ISafeBridge", + "internalType": "uint256", "name": "", - "type": "address" + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" } ], "stateMutability": "view", @@ -83,18 +159,39 @@ }, { "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "fastOutbox", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "safeBridgeReceiver", + "outputs": [ { "internalType": "address", - "name": "_receiver", + "name": "", "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" } ], - "name": "sendFast", + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sendBatch", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -112,63 +209,71 @@ "type": "bytes" } ], - "name": "sendSafe", + "name": "sendFast", "outputs": [], - "stateMutability": "payable", + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "address", - "name": "_fastSender", - "type": "address" + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" } ], - "name": "setFastSender", + "name": "sendSafeFallback", "outputs": [], - "stateMutability": "nonpayable", + "stateMutability": "payable", "type": "function" } ], - "transactionHash": "0x8be78ae0b525d0fa74956c8fa9dfd82e73b37e0c742ebee0a8452cfa2e4d0bc8", + "transactionHash": "0x59f583b49d1c78f4e92fddb037bc1328daaa2cc42592ab433c0b8cc0fbb402ee", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x0b9e03455Fed83f209Fa7ce596c93ba6aBAd1f46", - "transactionIndex": 0, - "gasUsed": "3163802", + "contractAddress": "0xf8A4a85e7153374A1b9BDA763a84252eC286843b", + "transactionIndex": 1, + "gasUsed": "613659", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x1429a648bb019eca3b938c71d358c90d9eec53ce40e277623848fbcbd69fcad7", - "transactionHash": "0x8be78ae0b525d0fa74956c8fa9dfd82e73b37e0c742ebee0a8452cfa2e4d0bc8", + "blockHash": "0xf0e1b24ea3aca3632a942411279db860e7dbbd3f5ffd65ca7224e4d68878d190", + "transactionHash": "0x59f583b49d1c78f4e92fddb037bc1328daaa2cc42592ab433c0b8cc0fbb402ee", "logs": [], - "blockNumber": 9610369, - "cumulativeGasUsed": "122282", + "blockNumber": 14453120, + "cumulativeGasUsed": "613659", "status": 1, "byzantium": true }, "args": [ - "0x1406bC99873d16Cde3491F809f1Af9442cb5A338", - "0xD78DCddE2C5a2Bd4BB246Bc7dB6994b95f7c442C" + 86400, + "0x545C731e84c0034d58e57E476A3b7C3929d070CC" ], "numDeployments": 1, - "solcInputHash": "0a1ec2a631b00a23a4a92b2eaceb36a5", - "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract ISafeBridge\",\"name\":\"_safebridge\",\"type\":\"address\"},{\"internalType\":\"contract IFastBridgeReceiver\",\"name\":\"_fastBridgeReceiver\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"target\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"message\",\"type\":\"bytes\"}],\"name\":\"OutgoingMessage\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"fastBridgeReceiver\",\"outputs\":[{\"internalType\":\"contract IFastBridgeReceiver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"fastSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"safebridge\",\"outputs\":[{\"internalType\":\"contract ISafeBridge\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"sendFast\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"sendSafe\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_fastSender\",\"type\":\"address\"}],\"name\":\"setFastSender\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"sendFast(address,bytes)\":{\"params\":{\"_calldata\":\"The receiving domain encoded message data.\",\"_receiver\":\"The L1 contract address who will receive the calldata\"}},\"sendSafe(address,bytes)\":{\"params\":{\"_calldata\":\"The receiving domain encoded message data.\",\"_receiver\":\"The L1 contract address who will receive the calldata\"}}},\"version\":1},\"userdoc\":{\"events\":{\"OutgoingMessage(address,bytes32,bytes)\":{\"notice\":\"The bridgers need to watch for these events and relay the messageHash on the FastBridgeReceiver.\"}},\"kind\":\"user\",\"methods\":{\"sendFast(address,bytes)\":{\"notice\":\"Sends an arbitrary message from one domain to another via the fast bridge mechanism\"},\"sendSafe(address,bytes)\":{\"notice\":\"Sends an arbitrary message from one domain to another via the safe bridge mechanism, which relies on the chain's native bridge. It is unnecessary during normal operations but essential only in case of challenge. It may require some ETH (or whichever native token) to pay for the bridging cost, depending on the underlying safe bridge.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/bridge/FastBridgeSender.sol\":\"FastBridgeSender\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/bridge/FastBridgeSender.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/ISafeBridge.sol\\\";\\nimport \\\"./interfaces/IFastBridgeSender.sol\\\";\\nimport \\\"./interfaces/IFastBridgeReceiver.sol\\\";\\n\\ncontract FastBridgeSender is IFastBridgeSender {\\n ISafeBridge public safebridge;\\n IFastBridgeReceiver public fastBridgeReceiver;\\n address public fastSender;\\n\\n /**\\n * The bridgers need to watch for these events and\\n * relay the messageHash on the FastBridgeReceiver.\\n */\\n event OutgoingMessage(address target, bytes32 messageHash, bytes message);\\n\\n constructor(ISafeBridge _safebridge, IFastBridgeReceiver _fastBridgeReceiver) {\\n safebridge = _safebridge;\\n fastBridgeReceiver = _fastBridgeReceiver;\\n }\\n\\n function setFastSender(address _fastSender) external {\\n require(fastSender == address(0));\\n fastSender = _fastSender;\\n }\\n\\n /**\\n * Sends an arbitrary message from one domain to another\\n * via the fast bridge mechanism\\n *\\n * @param _receiver The L1 contract address who will receive the calldata\\n * @param _calldata The receiving domain encoded message data.\\n */\\n function sendFast(address _receiver, bytes memory _calldata) external {\\n require(msg.sender == fastSender, \\\"Access not allowed: Fast Sender only.\\\");\\n\\n // Encode the receiver address with the function signature + arguments i.e calldata\\n bytes memory encodedData = abi.encode(_receiver, _calldata);\\n\\n emit OutgoingMessage(_receiver, keccak256(encodedData), encodedData);\\n }\\n\\n /**\\n * Sends an arbitrary message from one domain to another\\n * via the safe bridge mechanism, which relies on the chain's native bridge.\\n *\\n * It is unnecessary during normal operations but essential only in case of challenge.\\n *\\n * It may require some ETH (or whichever native token) to pay for the bridging cost,\\n * depending on the underlying safe bridge.\\n *\\n * @param _receiver The L1 contract address who will receive the calldata\\n * @param _calldata The receiving domain encoded message data.\\n */\\n function sendSafe(address _receiver, bytes memory _calldata) external payable {\\n // The safe bridge sends the encoded data to the FastBridgeReceiver\\n // in order for the FastBridgeReceiver to resolve any potential\\n // challenges and then forwards the message to the actual\\n // intended recipient encoded in `data`\\n // TODO: For this encodedData needs to be wrapped into an\\n // IFastBridgeReceiver function.\\n // TODO: add access checks for this on the FastBridgeReceiver.\\n // TODO: how much ETH should be provided for bridging? add an ISafeBridge.bridgingCost()\\n bytes memory encodedData = abi.encode(_receiver, _calldata);\\n safebridge.sendSafe{value: msg.value}(address(fastBridgeReceiver), encodedData);\\n }\\n}\\n\",\"keccak256\":\"0x38b58a84e65e83b015c2ff77333129656a759b803118870db9e2bc0a0453c3eb\",\"license\":\"MIT\"},\"src/bridge/interfaces/IFastBridgeReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IFastBridgeReceiver {\\n function claim(bytes32 _messageHash) external payable;\\n\\n function verifyAndRelay(bytes32 _messageHash, bytes memory _calldata) external;\\n\\n function withdrawClaimDeposit(bytes32 _messageHash) external;\\n\\n function claimDeposit() external view returns (uint256 amount);\\n}\\n\",\"keccak256\":\"0x1d7f6a6ed2c2b88f51833cba6091c57a43af2915a265395ad11aad08b1f7285d\",\"license\":\"MIT\"},\"src/bridge/interfaces/IFastBridgeSender.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IFastBridgeSender {\\n /**\\n * Sends an arbitrary message from one domain to another\\n * via the fast bridge mechanism\\n *\\n * TODO: probably needs some access control either on the sender side\\n * or the receiver side\\n *\\n * @param _receiver The L1 contract address who will receive the calldata\\n * @param _calldata The receiving domain encoded message data.\\n */\\n function sendFast(address _receiver, bytes memory _calldata) external;\\n}\\n\",\"keccak256\":\"0xcbf3e9b5e153940b73ab5f09469eaf2fb24a1effac83c3786b27f785c325ff2e\",\"license\":\"MIT\"},\"src/bridge/interfaces/ISafeBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface ISafeBridge {\\n /**\\n * Sends an arbitrary message from one domain to another.\\n *\\n * @param _receiver The L1 contract address who will receive the calldata\\n * @param _calldata The L2 encoded message data.\\n * @return Unique id to track the message request/transaction.\\n */\\n function sendSafe(address _receiver, bytes memory _calldata) external payable returns (uint256);\\n}\\n\",\"keccak256\":\"0x2e7ab23dc7721f51f3d115ea3a06c590869e8671ed824987756ab4bb224845d1\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516105b23803806105b283398101604081905261002f91610078565b600080546001600160a01b039384166001600160a01b031991821617909155600180549290931691161790556100b2565b6001600160a01b038116811461007557600080fd5b50565b6000806040838503121561008b57600080fd5b825161009681610060565b60208401519092506100a781610060565b809150509250929050565b6104f1806100c16000396000f3fe6080604052600436106100555760003560e01c80630d85ec7e1461005a57806346c2cfee146100965780638f516b0d146100b857806398ec20ec146100d8578063be44ae1c146100f8578063d96a36ca1461010b575b600080fd5b34801561006657600080fd5b5060005461007a906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b3480156100a257600080fd5b506100b66100b13660046102ff565b61012b565b005b3480156100c457600080fd5b5060025461007a906001600160a01b031681565b3480156100e457600080fd5b506100b66100f3366004610337565b610163565b6100b6610106366004610337565b61023c565b34801561011757600080fd5b5060015461007a906001600160a01b031681565b6002546001600160a01b03161561014157600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146101cf5760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a20466173742053656e6465722060448201526437b7363c9760d91b606482015260840160405180910390fd5b600082826040516020016101e4929190610446565b60405160208183030381529060405290507f885ffc934437efa035b94d89742209ddef30dac81f0aadbb92d520cd54dc2d398382805190602001208360405161022f93929190610472565b60405180910390a1505050565b60008282604051602001610251929190610446565b60408051601f1981840301815290829052600054600154632f912b8760e21b84529193506001600160a01b039081169263be44ae1c92349261029a929116908690600401610446565b60206040518083038185885af11580156102b8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906102dd91906104a2565b50505050565b80356001600160a01b03811681146102fa57600080fd5b919050565b60006020828403121561031157600080fd5b61031a826102e3565b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561034a57600080fd5b610353836102e3565b9150602083013567ffffffffffffffff8082111561037057600080fd5b818501915085601f83011261038457600080fd5b81358181111561039657610396610321565b604051601f8201601f19908116603f011681019083821181831017156103be576103be610321565b816040528281528860208487010111156103d757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000815180845260005b8181101561041f57602081850181015186830182015201610403565b81811115610431576000602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038316815260406020820181905260009061046a908301846103f9565b949350505050565b60018060a01b038416815282602082015260606040820152600061049960608301846103f9565b95945050505050565b6000602082840312156104b457600080fd5b505191905056fea264697066735822122027798849f47017ea415e2d49b22f4ac53ed207353ed98ef0272d1f23362730d864736f6c634300080a0033", - "deployedBytecode": "0x6080604052600436106100555760003560e01c80630d85ec7e1461005a57806346c2cfee146100965780638f516b0d146100b857806398ec20ec146100d8578063be44ae1c146100f8578063d96a36ca1461010b575b600080fd5b34801561006657600080fd5b5060005461007a906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b3480156100a257600080fd5b506100b66100b13660046102ff565b61012b565b005b3480156100c457600080fd5b5060025461007a906001600160a01b031681565b3480156100e457600080fd5b506100b66100f3366004610337565b610163565b6100b6610106366004610337565b61023c565b34801561011757600080fd5b5060015461007a906001600160a01b031681565b6002546001600160a01b03161561014157600080fd5b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6002546001600160a01b031633146101cf5760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a20466173742053656e6465722060448201526437b7363c9760d91b606482015260840160405180910390fd5b600082826040516020016101e4929190610446565b60405160208183030381529060405290507f885ffc934437efa035b94d89742209ddef30dac81f0aadbb92d520cd54dc2d398382805190602001208360405161022f93929190610472565b60405180910390a1505050565b60008282604051602001610251929190610446565b60408051601f1981840301815290829052600054600154632f912b8760e21b84529193506001600160a01b039081169263be44ae1c92349261029a929116908690600401610446565b60206040518083038185885af11580156102b8573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906102dd91906104a2565b50505050565b80356001600160a01b03811681146102fa57600080fd5b919050565b60006020828403121561031157600080fd5b61031a826102e3565b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561034a57600080fd5b610353836102e3565b9150602083013567ffffffffffffffff8082111561037057600080fd5b818501915085601f83011261038457600080fd5b81358181111561039657610396610321565b604051601f8201601f19908116603f011681019083821181831017156103be576103be610321565b816040528281528860208487010111156103d757600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b6000815180845260005b8181101561041f57602081850181015186830182015201610403565b81811115610431576000602083870101525b50601f01601f19169290920160200192915050565b6001600160a01b038316815260406020820181905260009061046a908301846103f9565b949350505050565b60018060a01b038416815282602082015260606040820152600061049960608301846103f9565b95945050505050565b6000602082840312156104b457600080fd5b505191905056fea264697066735822122027798849f47017ea415e2d49b22f4ac53ed207353ed98ef0272d1f23362730d864736f6c634300080a0033", + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epochPeriod\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_safeBridgeReceiver\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"batchID\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"batchSize\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"batchMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"BatchOutgoing\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes\",\"name\":\"fastMessage\",\"type\":\"bytes\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"fastMessageHash\",\"type\":\"bytes32\"}],\"name\":\"MessageReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"canonicalBridgeMessageID\",\"type\":\"bytes32\"}],\"name\":\"SentSafe\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"ARB_SYS\",\"outputs\":[{\"internalType\":\"contract IArbSys\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"batch\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"batchSize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentBatchID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"epochPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"fastOutbox\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"safeBridgeReceiver\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"sendBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"sendFast\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"sendSafeFallback\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_epochPeriod\":\"The duration between epochs.\",\"_safeBridgeReceiver\":\"The the Safe Bridge Router on Ethereum to the receiving chain.\"}},\"sendFast(address,bytes)\":{\"details\":\"Sends an arbitrary message to Ethereum using the Fast Bridge.\",\"params\":{\"_calldata\":\"The receiving domain encoded message data / function arguments.\",\"_receiver\":\"The address of the contract on Ethereum which receives the calldata.\"}},\"sendSafeFallback(uint256)\":{\"details\":\"Sends the merkle root state for _epoch to Ethereum using the Safe Bridge, which relies on Arbitrum's canonical bridge. It is unnecessary during normal operations but essential only in case of challenge.\",\"params\":{\"_epoch\":\"The blocknumber of the batch\"}}},\"version\":1},\"userdoc\":{\"events\":{\"BatchOutgoing(uint256,uint256,uint256,bytes32)\":{\"notice\":\"The bridgers need to watch for these events and relay the batchMerkleRoot on the FastBridgeReceiver.\"}},\"kind\":\"user\",\"methods\":{\"sendBatch()\":{\"notice\":\"Sends a batch of arbitrary message from one domain to another via the fast bridge mechanism.\"}},\"notice\":\"Fast Bridge Sender Counterpart of `FastBridgeReceiver`\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/bridge/FastBridgeSender.sol\":\"FastBridgeSender\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/bridge/FastBridgeSender.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 \\\"./interfaces/IFastBridgeSender.sol\\\";\\nimport \\\"./interfaces/ISafeBridgeSender.sol\\\";\\nimport \\\"./interfaces/ISafeBridgeReceiver.sol\\\";\\nimport \\\"./canonical/arbitrum/IArbSys.sol\\\"; // Arbitrum sender specific\\n\\n/**\\n * Fast Bridge Sender\\n * Counterpart of `FastBridgeReceiver`\\n */\\ncontract FastBridgeSender is IFastBridgeSender, ISafeBridgeSender {\\n // **************************************** //\\n // * * //\\n // * Arbitrum Sender Specific * //\\n // * * //\\n // **************************************** //\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n IArbSys public constant ARB_SYS = IArbSys(address(100));\\n\\n /**\\n * @dev Sends the merkle root state for _epoch to Ethereum using the Safe Bridge, which relies on Arbitrum's canonical bridge. It is unnecessary during normal operations but essential only in case of challenge.\\n * @param _epoch The blocknumber of the batch\\n */\\n function sendSafeFallback(uint256 _epoch) external payable override {\\n require(_epoch <= currentBatchID, \\\"Invalid epoch.\\\");\\n bytes32 batchMerkleRoot = fastOutbox[_epoch];\\n\\n // Safe Bridge message envelope\\n bytes4 methodSelector = ISafeBridgeReceiver.verifySafeBatch.selector;\\n bytes memory safeMessageData = abi.encodeWithSelector(methodSelector, _epoch, batchMerkleRoot);\\n\\n bytes32 ticketID = _sendSafe(safeBridgeReceiver, safeMessageData);\\n emit SentSafe(_epoch, ticketID);\\n }\\n\\n function _sendSafe(address _receiver, bytes memory _calldata) internal override returns (bytes32) {\\n uint256 ticketID = ARB_SYS.sendTxToL1(_receiver, _calldata);\\n\\n return bytes32(ticketID);\\n }\\n\\n /**\\n * @dev Constructor.\\n * @param _epochPeriod The duration between epochs.\\n * @param _safeBridgeReceiver The the Safe Bridge Router on Ethereum to the receiving chain.\\n */\\n constructor(uint256 _epochPeriod, address _safeBridgeReceiver) {\\n epochPeriod = _epochPeriod;\\n safeBridgeReceiver = _safeBridgeReceiver;\\n unchecked {\\n currentBatchID = block.timestamp / _epochPeriod - 1;\\n }\\n }\\n\\n // ************************************** //\\n // * * //\\n // * General Sender * //\\n // * * //\\n // ************************************** //\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public immutable epochPeriod; // Epochs mark the period between potential batches of messages.\\n uint256 public currentBatchID;\\n mapping(uint256 => bytes32) public fastOutbox; // epoch count => merkle root of batched messages\\n address public immutable safeBridgeReceiver;\\n\\n // merkle tree representation of a batch of messages\\n // supports 2^64 messages.\\n bytes32[64] public batch;\\n uint256 public batchSize;\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Sends an arbitrary message to Ethereum using the Fast Bridge.\\n * @param _receiver The address of the contract on Ethereum which receives the calldata.\\n * @param _calldata The receiving domain encoded message data / function arguments.\\n */\\n function sendFast(address _receiver, bytes memory _calldata) external override {\\n (bytes32 fastMessageHash, bytes memory fastMessage) = _encode(_receiver, _calldata);\\n emit MessageReceived(fastMessage, fastMessageHash);\\n appendMessage(fastMessageHash); // add message to merkle tree\\n }\\n\\n /**\\n * Sends a batch of arbitrary message from one domain to another via the fast bridge mechanism.\\n */\\n function sendBatch() external override {\\n uint256 epoch = block.timestamp / epochPeriod;\\n require(fastOutbox[epoch] == 0, \\\"Batch already sent for the current epoch.\\\");\\n require(batchSize > 0, \\\"No messages to send.\\\");\\n\\n // set merkle root in outbox\\n bytes32 batchMerkleRoot = getMerkleRoot();\\n fastOutbox[epoch] = batchMerkleRoot;\\n emit BatchOutgoing(currentBatchID, batchSize, epoch, batchMerkleRoot);\\n\\n // reset\\n batchSize = 0;\\n currentBatchID = epoch;\\n }\\n\\n // ************************ //\\n // * Internal * //\\n // ************************ //\\n\\n function _encode(address _receiver, bytes memory _calldata)\\n internal\\n view\\n returns (bytes32 fastMessageHash, bytes memory fastMessage)\\n {\\n // Encode the receiver address with the function signature + arguments i.e calldata\\n bytes32 sender = bytes32(bytes20(msg.sender));\\n bytes32 receiver = bytes32(bytes20(_receiver));\\n uint256 nonce = batchSize;\\n // add sender and receiver with proper function selector formatting\\n // [length][receiver: 1 slot padded][offset][function selector: 4 bytes no padding][msg.sender: 1 slot padded][function arguments: 1 slot padded]\\n assembly {\\n fastMessage := mload(0x40) // free memory pointer\\n let lengthCalldata := mload(_calldata) // calldata length\\n let lengthFastMesssageCalldata := add(lengthCalldata, 0x20) // add msg.sender\\n let lengthEncodedMessage := add(lengthFastMesssageCalldata, 0x80) // 1 offsets, receiver, and lengthFastMesssageCalldata\\n mstore(fastMessage, lengthEncodedMessage) // bytes length\\n mstore(add(fastMessage, 0x20), nonce) // nonce\\n mstore(add(fastMessage, 0x4c), receiver) // receiver\\n mstore(add(fastMessage, 0x60), 0x60) // offset\\n mstore(add(fastMessage, 0x80), lengthFastMesssageCalldata) // fast message length\\n mstore(\\n add(fastMessage, 0xa0),\\n and(mload(add(_calldata, 0x20)), 0xFFFFFFFF00000000000000000000000000000000000000000000000000000000)\\n ) // function selector\\n mstore(add(fastMessage, 0xb0), sender) // sender\\n\\n let _cursor := add(fastMessage, 0xc4) // begin copying arguments of function call\\n let _cursorCalldata := add(_calldata, 0x24) // beginning of arguments\\n\\n // copy all arguments\\n for {\\n let j := 0x00\\n } lt(j, lengthCalldata) {\\n j := add(j, 0x20)\\n } {\\n mstore(_cursor, mload(add(_cursorCalldata, j)))\\n _cursor := add(_cursor, 0x20)\\n }\\n // update free pointer\\n mstore(0x40, _cursor)\\n }\\n // Compute the hash over the message header (batchSize as nonce) and body (fastMessage).\\n fastMessageHash = sha256(fastMessage);\\n }\\n\\n // ********************************* //\\n // * Merkle Tree * //\\n // ********************************* //\\n\\n /**\\n * @dev Append data into merkle tree.\\n * `O(log(n))` where `n` is the number of leaves.\\n * Note: Although each insertion is O(log(n)), complexity of n insertions is O(n).\\n * Note: Inlined from `merkle/MerkleTree.sol` for performance.\\n * @param leaf The leaf (already hashed) to insert in the merkle tree.\\n */\\n function appendMessage(bytes32 leaf) internal {\\n unchecked {\\n // Differentiate leaves from interior nodes with different\\n // hash functions to prevent 2nd order pre-image attack.\\n // https://flawed.net.nz/2018/02/21/attacking-merkle-trees-with-a-second-preimage-attack/\\n uint256 size = batchSize + 1;\\n batchSize = size;\\n uint256 hashBitField = (size ^ (size - 1)) & size;\\n uint256 height;\\n while ((hashBitField & 1) == 0) {\\n bytes32 node = batch[height];\\n if (node > leaf)\\n assembly {\\n // efficient hash\\n mstore(0x00, leaf)\\n mstore(0x20, node)\\n leaf := keccak256(0x00, 0x40)\\n }\\n else\\n assembly {\\n // efficient hash\\n mstore(0x00, node)\\n mstore(0x20, leaf)\\n leaf := keccak256(0x00, 0x40)\\n }\\n hashBitField /= 2;\\n height++;\\n }\\n batch[height] = leaf;\\n }\\n }\\n\\n /**\\n * @dev Gets the current merkle root.\\n * `O(log(n))` where `n` is the number of leaves.\\n * Note: Inlined from `merkle/MerkleTree.sol` for performance.\\n */\\n function getMerkleRoot() internal view returns (bytes32) {\\n unchecked {\\n bytes32 node;\\n uint256 size = batchSize;\\n uint256 height = 0;\\n bool isFirstHash = true;\\n while (size > 0) {\\n if ((size & 1) == 1) {\\n // avoid redundant calculation\\n if (isFirstHash) {\\n node = batch[height];\\n isFirstHash = false;\\n } else {\\n bytes32 hash = batch[height];\\n // efficient hash\\n if (hash > node)\\n assembly {\\n mstore(0x00, node)\\n mstore(0x20, hash)\\n node := keccak256(0x00, 0x40)\\n }\\n else\\n assembly {\\n mstore(0x00, hash)\\n mstore(0x20, node)\\n node := keccak256(0x00, 0x40)\\n }\\n }\\n }\\n size /= 2;\\n height++;\\n }\\n return node;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x60171ae581cde479f353cbd135fcfd9436f326e0a73fedfb98af8f6e693b665d\",\"license\":\"MIT\"},\"src/bridge/canonical/arbitrum/IArbSys.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\npragma solidity >=0.7.0;\\n\\n/**\\n * @title Precompiled contract that exists in every Arbitrum chain at address(100), 0x0000000000000000000000000000000000000064. Exposes a variety of system-level functionality.\\n */\\ninterface IArbSys {\\n /**\\n * @notice Get internal version number identifying an ArbOS build\\n * @return version number as int\\n */\\n function arbOSVersion() external pure returns (uint256);\\n\\n /**\\n * @notice Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0)\\n * @return block number as int\\n */\\n function arbBlockNumber() external view returns (uint256);\\n\\n /**\\n * @notice Send given amount of Eth to dest from sender.\\n * This is a convenience function, which is equivalent to calling sendTxToL1 with empty calldataForL1.\\n * @param destination recipient address on L1\\n * @return unique identifier for this L2-to-L1 transaction.\\n */\\n function withdrawEth(address destination) external payable returns (uint256);\\n\\n /**\\n * @notice Send a transaction to L1\\n * @param destination recipient address on L1\\n * @param calldataForL1 (optional) calldata for L1 contract call\\n * @return a unique identifier for this L2-to-L1 transaction.\\n */\\n function sendTxToL1(address destination, bytes calldata calldataForL1) external payable returns (uint256);\\n\\n /**\\n * @notice get the number of transactions issued by the given external account or the account sequence number of the given contract\\n * @param account target account\\n * @return the number of transactions issued by the given external account or the account sequence number of the given contract\\n */\\n function getTransactionCount(address account) external view returns (uint256);\\n\\n /**\\n * @notice get the value of target L2 storage slot\\n * This function is only callable from address 0 to prevent contracts from being able to call it\\n * @param account target account\\n * @param index target index of storage slot\\n * @return stotage value for the given account at the given index\\n */\\n function getStorageAt(address account, uint256 index) external view returns (uint256);\\n\\n /**\\n * @notice check if current call is coming from l1\\n * @return true if the caller of this was called directly from L1\\n */\\n function isTopLevelCall() external view returns (bool);\\n\\n event EthWithdrawal(address indexed destAddr, uint256 amount);\\n\\n event L2ToL1Transaction(\\n address caller,\\n address indexed destination,\\n uint256 indexed uniqueId,\\n uint256 indexed batchNumber,\\n uint256 indexInBatch,\\n uint256 arbBlockNum,\\n uint256 ethBlockNum,\\n uint256 timestamp,\\n uint256 callvalue,\\n bytes data\\n );\\n}\\n\",\"keccak256\":\"0x2abbc6cf12d56c18cf4339b34747f6adea78f17a82e1813923a05d9aa7597ef3\",\"license\":\"Apache-2.0\"},\"src/bridge/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\"},\"src/bridge/interfaces/ISafeBridgeReceiver.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\\nabstract contract ISafeBridgeReceiver {\\n /**\\n * Note: Access restricted to the Safe Bridge.\\n * @dev Resolves any challenge of the optimistic claim for '_epoch'.\\n * @param _epoch The epoch associated with the _batchmerkleRoot.\\n * @param _batchMerkleRoot The true batch merkle root for the epoch sent by the safe bridge.\\n */\\n function verifySafeBatch(uint256 _epoch, bytes32 _batchMerkleRoot) external virtual;\\n\\n function isSentBySafeBridge() internal view virtual returns (bool);\\n\\n modifier onlyFromSafeBridge() {\\n require(isSentBySafeBridge(), \\\"Safe Bridge only.\\\");\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xc4bee04423c73bf37e7d975fccab05767ba0e738cc753d293438c2d1ace9f804\",\"license\":\"MIT\"},\"src/bridge/interfaces/ISafeBridgeSender.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\\nabstract contract ISafeBridgeSender {\\n /**\\n * Sends an arbitrary message from one domain to another.\\n *\\n * @param _receiver The contract address which will receive the calldata on the receiving chain.\\n * @param _calldata The encoded message data to send.\\n * @return Unique id to track the message request/transaction.\\n */\\n function _sendSafe(address _receiver, bytes memory _calldata) internal virtual returns (bytes32);\\n}\\n\",\"keccak256\":\"0xe17476e515afdd9496b00ab122162c5700d3c6fdda947f70027d5bf6f4645c93\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b50604051610a97380380610a9783398101604081905261002f9161005f565b60808290526001600160a01b03811660a05260018242816100525761005261009c565b0403600055506100b29050565b6000806040838503121561007257600080fd5b825160208401519092506001600160a01b038116811461009157600080fd5b809150509250929050565b634e487b7160e01b600052601260045260246000fd5b60805160a0516109b36100e46000396000818160db015261046701526000818161018b015261027801526109b36000f3fe6080604052600436106100915760003560e01c8063b5b7a18411610059578063b5b7a18414610179578063bd0805eb146101ad578063bd8e62d6146101c3578063d8c05a3a146101d8578063f4daaba1146101eb57600080fd5b80630eaa75fe1461009657806364fccb52146100c95780637834f14e1461011557806398ec20ec14610142578063a093961b14610164575b600080fd5b3480156100a257600080fd5b506100b66100b1366004610773565b610201565b6040519081526020015b60405180910390f35b3480156100d557600080fd5b506100fd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c0565b34801561012157600080fd5b506100b6610130366004610773565b60016020526000908152604090205481565b34801561014e57600080fd5b5061016261015d3660046107a2565b610218565b005b34801561017057600080fd5b50610162610271565b34801561018557600080fd5b506100b67f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b957600080fd5b506100b660005481565b3480156101cf57600080fd5b506100fd606481565b6101626101e6366004610773565b6103cc565b3480156101f757600080fd5b506100b660425481565b6002816040811061021157600080fd5b0154905081565b60008061022584846104cf565b915091507f184cd819d58dedfbb6e4281fbfc51de811c74320929a718c5e27f367f55dd892818360405161025a9291906108ca565b60405180910390a161026b826105be565b50505050565b600061029d7f0000000000000000000000000000000000000000000000000000000000000000426108ec565b600081815260016020526040902054909150156103135760405162461bcd60e51b815260206004820152602960248201527f426174636820616c72656164792073656e7420666f7220746865206375727265604482015268373a1032b837b1b41760b91b60648201526084015b60405180910390fd5b60006042541161035c5760405162461bcd60e51b815260206004820152601460248201527327379036b2b9b9b0b3b2b9903a379039b2b7321760611b604482015260640161030a565b6000610366610649565b600083815260016020908152604080832084905591546042548351908152918201869052918101839052919250907ff67fa0a4947381c1657490b7a5e74d1da3cd790f5ee5a6fd0020306eff024fee9060600160405180910390a2506000604281905555565b60005481111561040f5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21032b837b1b41760911b604482015260640161030a565b600081815260016020908152604080832054815160248101869052604480820183905283518083039091018152606490910190925291810180516001600160e01b0316632dff2f8d60e11b908117909152919261048c7f0000000000000000000000000000000000000000000000000000000000000000836106ee565b9050847f98f86a6cdb328955823a542be2edbbc788c9cc7052e74f9f20d0ab3988a6ade7826040516104c091815260200190565b60405180910390a25050505050565b604254604051825160a0808201835260208084018590526bffffffffffffffffffffffff19606088811b8216604c87018190528187018290528386016080880152928801516001600160e01b031916938601939093523390921b90911660b08401819052600094909260c4850160248801875b8381101561055c5781810151835260209283019201610542565b505060408190526002915061057290869061090e565b602060405180830381855afa15801561058f573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906105b2919061092a565b94505050509250929050565b6042805460018101918290558118811660005b6001821661062d576000600282604081106105ee576105ee610943565b015490508481111561060e5784600052806020526040600020945061061e565b8060005284602052604060002094505b600283049250506001016105d1565b836002826040811061064157610641610943565b015550505050565b60425460009081908160015b82156106e55782600116600114156106d457801561068d576002826040811061068057610680610943565b01549350600090506106d4565b6000600283604081106106a2576106a2610943565b01549050848111156106c2578460005280602052604060002094506106d2565b8060005284602052604060002094505b505b600283049250600190910190610655565b50919392505050565b6040516349460b4d60e11b8152600090819060649063928c169a906107199087908790600401610959565b602060405180830381600087803b15801561073357600080fd5b505af1158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b919061092a565b949350505050565b60006020828403121561078557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156107b557600080fd5b82356001600160a01b03811681146107cc57600080fd5b9150602083013567ffffffffffffffff808211156107e957600080fd5b818501915085601f8301126107fd57600080fd5b81358181111561080f5761080f61078c565b604051601f8201601f19908116603f011681019083821181831017156108375761083761078c565b8160405282815288602084870101111561085057600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b8381101561088d578181015183820152602001610875565b8381111561026b5750506000910152565b600081518084526108b6816020860160208601610872565b601f01601f19169290920160200192915050565b6040815260006108dd604083018561089e565b90508260208301529392505050565b60008261090957634e487b7160e01b600052601260045260246000fd5b500490565b60008251610920818460208701610872565b9190910192915050565b60006020828403121561093c57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038316815260406020820181905260009061076b9083018461089e56fea2646970667358221220a064a367a3509d6f4e9973c64002d2bc4aea35cdd742e6560be6c6b5bdf75cc464736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100915760003560e01c8063b5b7a18411610059578063b5b7a18414610179578063bd0805eb146101ad578063bd8e62d6146101c3578063d8c05a3a146101d8578063f4daaba1146101eb57600080fd5b80630eaa75fe1461009657806364fccb52146100c95780637834f14e1461011557806398ec20ec14610142578063a093961b14610164575b600080fd5b3480156100a257600080fd5b506100b66100b1366004610773565b610201565b6040519081526020015b60405180910390f35b3480156100d557600080fd5b506100fd7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100c0565b34801561012157600080fd5b506100b6610130366004610773565b60016020526000908152604090205481565b34801561014e57600080fd5b5061016261015d3660046107a2565b610218565b005b34801561017057600080fd5b50610162610271565b34801561018557600080fd5b506100b67f000000000000000000000000000000000000000000000000000000000000000081565b3480156101b957600080fd5b506100b660005481565b3480156101cf57600080fd5b506100fd606481565b6101626101e6366004610773565b6103cc565b3480156101f757600080fd5b506100b660425481565b6002816040811061021157600080fd5b0154905081565b60008061022584846104cf565b915091507f184cd819d58dedfbb6e4281fbfc51de811c74320929a718c5e27f367f55dd892818360405161025a9291906108ca565b60405180910390a161026b826105be565b50505050565b600061029d7f0000000000000000000000000000000000000000000000000000000000000000426108ec565b600081815260016020526040902054909150156103135760405162461bcd60e51b815260206004820152602960248201527f426174636820616c72656164792073656e7420666f7220746865206375727265604482015268373a1032b837b1b41760b91b60648201526084015b60405180910390fd5b60006042541161035c5760405162461bcd60e51b815260206004820152601460248201527327379036b2b9b9b0b3b2b9903a379039b2b7321760611b604482015260640161030a565b6000610366610649565b600083815260016020908152604080832084905591546042548351908152918201869052918101839052919250907ff67fa0a4947381c1657490b7a5e74d1da3cd790f5ee5a6fd0020306eff024fee9060600160405180910390a2506000604281905555565b60005481111561040f5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21032b837b1b41760911b604482015260640161030a565b600081815260016020908152604080832054815160248101869052604480820183905283518083039091018152606490910190925291810180516001600160e01b0316632dff2f8d60e11b908117909152919261048c7f0000000000000000000000000000000000000000000000000000000000000000836106ee565b9050847f98f86a6cdb328955823a542be2edbbc788c9cc7052e74f9f20d0ab3988a6ade7826040516104c091815260200190565b60405180910390a25050505050565b604254604051825160a0808201835260208084018590526bffffffffffffffffffffffff19606088811b8216604c87018190528187018290528386016080880152928801516001600160e01b031916938601939093523390921b90911660b08401819052600094909260c4850160248801875b8381101561055c5781810151835260209283019201610542565b505060408190526002915061057290869061090e565b602060405180830381855afa15801561058f573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906105b2919061092a565b94505050509250929050565b6042805460018101918290558118811660005b6001821661062d576000600282604081106105ee576105ee610943565b015490508481111561060e5784600052806020526040600020945061061e565b8060005284602052604060002094505b600283049250506001016105d1565b836002826040811061064157610641610943565b015550505050565b60425460009081908160015b82156106e55782600116600114156106d457801561068d576002826040811061068057610680610943565b01549350600090506106d4565b6000600283604081106106a2576106a2610943565b01549050848111156106c2578460005280602052604060002094506106d2565b8060005284602052604060002094505b505b600283049250600190910190610655565b50919392505050565b6040516349460b4d60e11b8152600090819060649063928c169a906107199087908790600401610959565b602060405180830381600087803b15801561073357600080fd5b505af1158015610747573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076b919061092a565b949350505050565b60006020828403121561078557600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b600080604083850312156107b557600080fd5b82356001600160a01b03811681146107cc57600080fd5b9150602083013567ffffffffffffffff808211156107e957600080fd5b818501915085601f8301126107fd57600080fd5b81358181111561080f5761080f61078c565b604051601f8201601f19908116603f011681019083821181831017156108375761083761078c565b8160405282815288602084870101111561085057600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60005b8381101561088d578181015183820152602001610875565b8381111561026b5750506000910152565b600081518084526108b6816020860160208601610872565b601f01601f19169290920160200192915050565b6040815260006108dd604083018561089e565b90508260208301529392505050565b60008261090957634e487b7160e01b600052601260045260246000fd5b500490565b60008251610920818460208701610872565b9190910192915050565b60006020828403121561093c57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b038316815260406020820181905260009061076b9083018461089e56fea2646970667358221220a064a367a3509d6f4e9973c64002d2bc4aea35cdd742e6560be6c6b5bdf75cc464736f6c63430008090033", "devdoc": { "kind": "dev", "methods": { + "constructor": { + "details": "Constructor.", + "params": { + "_epochPeriod": "The duration between epochs.", + "_safeBridgeReceiver": "The the Safe Bridge Router on Ethereum to the receiving chain." + } + }, "sendFast(address,bytes)": { + "details": "Sends an arbitrary message to Ethereum using the Fast Bridge.", "params": { - "_calldata": "The receiving domain encoded message data.", - "_receiver": "The L1 contract address who will receive the calldata" + "_calldata": "The receiving domain encoded message data / function arguments.", + "_receiver": "The address of the contract on Ethereum which receives the calldata." } }, - "sendSafe(address,bytes)": { + "sendSafeFallback(uint256)": { + "details": "Sends the merkle root state for _epoch to Ethereum using the Safe Bridge, which relies on Arbitrum's canonical bridge. It is unnecessary during normal operations but essential only in case of challenge.", "params": { - "_calldata": "The receiving domain encoded message data.", - "_receiver": "The L1 contract address who will receive the calldata" + "_epoch": "The blocknumber of the batch" } } }, @@ -176,63 +281,77 @@ }, "userdoc": { "events": { - "OutgoingMessage(address,bytes32,bytes)": { - "notice": "The bridgers need to watch for these events and relay the messageHash on the FastBridgeReceiver." + "BatchOutgoing(uint256,uint256,uint256,bytes32)": { + "notice": "The bridgers need to watch for these events and relay the batchMerkleRoot on the FastBridgeReceiver." } }, "kind": "user", "methods": { - "sendFast(address,bytes)": { - "notice": "Sends an arbitrary message from one domain to another via the fast bridge mechanism" - }, - "sendSafe(address,bytes)": { - "notice": "Sends an arbitrary message from one domain to another via the safe bridge mechanism, which relies on the chain's native bridge. It is unnecessary during normal operations but essential only in case of challenge. It may require some ETH (or whichever native token) to pay for the bridging cost, depending on the underlying safe bridge." + "sendBatch()": { + "notice": "Sends a batch of arbitrary message from one domain to another via the fast bridge mechanism." } }, + "notice": "Fast Bridge Sender Counterpart of `FastBridgeReceiver`", "version": 1 }, "storageLayout": { "storage": [ { - "astId": 8249, + "astId": 13144, "contract": "src/bridge/FastBridgeSender.sol:FastBridgeSender", - "label": "safebridge", + "label": "currentBatchID", "offset": 0, "slot": "0", - "type": "t_contract(ISafeBridge)8507" + "type": "t_uint256" }, { - "astId": 8252, + "astId": 13148, "contract": "src/bridge/FastBridgeSender.sol:FastBridgeSender", - "label": "fastBridgeReceiver", + "label": "fastOutbox", "offset": 0, "slot": "1", - "type": "t_contract(IFastBridgeReceiver)8483" + "type": "t_mapping(t_uint256,t_bytes32)" }, { - "astId": 8254, + "astId": 13154, "contract": "src/bridge/FastBridgeSender.sol:FastBridgeSender", - "label": "fastSender", + "label": "batch", "offset": 0, "slot": "2", - "type": "t_address" + "type": "t_array(t_bytes32)64_storage" + }, + { + "astId": 13156, + "contract": "src/bridge/FastBridgeSender.sol:FastBridgeSender", + "label": "batchSize", + "offset": 0, + "slot": "66", + "type": "t_uint256" } ], "types": { - "t_address": { + "t_array(t_bytes32)64_storage": { + "base": "t_bytes32", "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" + "label": "bytes32[64]", + "numberOfBytes": "2048" }, - "t_contract(IFastBridgeReceiver)8483": { + "t_bytes32": { "encoding": "inplace", - "label": "contract IFastBridgeReceiver", - "numberOfBytes": "20" + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" }, - "t_contract(ISafeBridge)8507": { + "t_uint256": { "encoding": "inplace", - "label": "contract ISafeBridge", - "numberOfBytes": "20" + "label": "uint256", + "numberOfBytes": "32" } } } diff --git a/contracts/deployments/arbitrumRinkeby/HomeGateway.json b/contracts/deployments/arbitrumRinkeby/HomeGateway.json deleted file mode 100644 index 242d1299e..000000000 --- a/contracts/deployments/arbitrumRinkeby/HomeGateway.json +++ /dev/null @@ -1,548 +0,0 @@ -{ - "address": "0x2Aa1f82d363f79c1E7a4CcF955Fb7E4306b9B260", - "abi": [ - { - "inputs": [ - { - "internalType": "contract IArbitrator", - "name": "_arbitrator", - "type": "address" - }, - { - "internalType": "contract IFastBridgeSender", - "name": "_fastbridge", - "type": "address" - }, - { - "internalType": "address", - "name": "_foreignGateway", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_foreignChainID", - "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": "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": [], - "name": "chainID", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "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": "fastbridge", - "outputs": [ - { - "internalType": "contract IFastBridgeSender", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "foreignChainID", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "foreignGateway", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_originalChainID", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_originalBlockHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "_originalDisputeID", - "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": "0x232a8e30be09383002c2ff5e333dd848156b2ab9aa32769e8a1954ab9dbe060d", - "receipt": { - "to": null, - "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x2Aa1f82d363f79c1E7a4CcF955Fb7E4306b9B260", - "transactionIndex": 0, - "gasUsed": "5322942", - "logsBloom": "0x00000000000000000000000000000000000000000000000002000004000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000020008000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x9b028bb1ddc37bf4d0ce1d531d614eeeaae56664bb37aeafa83d0e8eb771c3c1", - "transactionHash": "0x232a8e30be09383002c2ff5e333dd848156b2ab9aa32769e8a1954ab9dbe060d", - "logs": [ - { - "transactionIndex": 0, - "blockNumber": 9610376, - "transactionHash": "0x232a8e30be09383002c2ff5e333dd848156b2ab9aa32769e8a1954ab9dbe060d", - "address": "0x2Aa1f82d363f79c1E7a4CcF955Fb7E4306b9B260", - "topics": [ - "0x61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d", - "0x0000000000000000000000000000000000000000000000000000000000000000" - ], - "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000064252494447450000000000000000000000000000000000000000000000000000", - "logIndex": 0, - "blockHash": "0x9b028bb1ddc37bf4d0ce1d531d614eeeaae56664bb37aeafa83d0e8eb771c3c1" - } - ], - "blockNumber": 9610376, - "cumulativeGasUsed": "289162", - "status": 1, - "byzantium": true - }, - "args": [ - "0xd08452AEE7ab5bE3BF6733BA0d3F0CFdaf060Aa2", - "0x0b9e03455Fed83f209Fa7ce596c93ba6aBAd1f46", - "0xf02733d9e5CbfE67B54F165b0277E1995106D526", - 4 - ], - "numDeployments": 1, - "solcInputHash": "0a1ec2a631b00a23a4a92b2eaceb36a5", - "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"internalType\":\"contract IFastBridgeSender\",\"name\":\"_fastbridge\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_foreignGateway\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_foreignChainID\",\"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\":\"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\":[],\"name\":\"chainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"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\":\"fastbridge\",\"outputs\":[{\"internalType\":\"contract IFastBridgeSender\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"foreignChainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"foreignGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_originalChainID\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_originalBlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_originalDisputeID\",\"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\":{\"relayCreateDispute(uint256,bytes32,uint256,uint256,bytes,address)\":{\"details\":\"Provide the same parameters as on the originalChain while creating a dispute. Providing incorrect parameters will create a different hash than on the originalChain and will not affect the actual dispute/arbitrable's ruling.\",\"params\":{\"_arbitrable\":\"arbitrable\",\"_choices\":\"number of ruling choices\",\"_extraData\":\"extraData\",\"_originalBlockHash\":\"originalBlockHash\",\"_originalChainID\":\"originalChainId\",\"_originalDisputeID\":\"originalDisputeID\"}},\"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\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/gateway/HomeGateway.sol\":\"HomeGateway\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"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/bridge/interfaces/IFastBridgeSender.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IFastBridgeSender {\\n /**\\n * Sends an arbitrary message from one domain to another\\n * via the fast bridge mechanism\\n *\\n * TODO: probably needs some access control either on the sender side\\n * or the receiver side\\n *\\n * @param _receiver The L1 contract address who will receive the calldata\\n * @param _calldata The receiving domain encoded message data.\\n */\\n function sendFast(address _receiver, bytes memory _calldata) external;\\n}\\n\",\"keccak256\":\"0xcbf3e9b5e153940b73ab5f09469eaf2fb24a1effac83c3786b27f785c325ff2e\",\"license\":\"MIT\"},\"src/evidence/IEvidence.sol\":{\"content\":\"pragma 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\":\"0xbd6a3d07e2e192f521340f62965aae59e0ece36cf4ae6918d461725e6a51b70c\"},\"src/evidence/IMetaEvidence.sol\":{\"content\":\"pragma 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\":\"0x18ad77e96ca1592f7833c4d3a93a8a7de55bff137d357d66040f99ac13bf1f88\"},\"src/gateway/HomeGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrator.sol\\\";\\nimport \\\"../bridge/interfaces/IFastBridgeSender.sol\\\";\\n\\nimport \\\"./interfaces/IForeignGateway.sol\\\";\\nimport \\\"./interfaces/IHomeGateway.sol\\\";\\n\\ncontract HomeGateway is IHomeGateway {\\n mapping(uint256 => bytes32) public disputeIDtoHash;\\n mapping(bytes32 => uint256) public disputeHashtoID;\\n\\n IArbitrator public arbitrator;\\n IFastBridgeSender public fastbridge;\\n address public foreignGateway;\\n uint256 public chainID;\\n uint256 public foreignChainID;\\n\\n struct RelayedData {\\n uint256 arbitrationCost;\\n address relayer;\\n }\\n mapping(bytes32 => RelayedData) public disputeHashtoRelayedData;\\n\\n constructor(\\n IArbitrator _arbitrator,\\n IFastBridgeSender _fastbridge,\\n address _foreignGateway,\\n uint256 _foreignChainID\\n ) {\\n arbitrator = _arbitrator;\\n fastbridge = _fastbridge;\\n foreignGateway = _foreignGateway;\\n foreignChainID = _foreignChainID;\\n\\n assembly {\\n sstore(chainID.slot, chainid())\\n }\\n\\n emit MetaEvidence(0, \\\"BRIDGE\\\");\\n }\\n\\n /**\\n * @dev Provide the same parameters as on the originalChain while creating a\\n * dispute. Providing incorrect parameters will create a different hash\\n * than on the originalChain and will not affect the actual dispute/arbitrable's\\n * ruling.\\n *\\n * @param _originalChainID originalChainId\\n * @param _originalBlockHash originalBlockHash\\n * @param _originalDisputeID originalDisputeID\\n * @param _choices number of ruling choices\\n * @param _extraData extraData\\n * @param _arbitrable arbitrable\\n */\\n function relayCreateDispute(\\n uint256 _originalChainID,\\n bytes32 _originalBlockHash,\\n uint256 _originalDisputeID,\\n uint256 _choices,\\n bytes calldata _extraData,\\n address _arbitrable\\n ) external payable {\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n _originalChainID,\\n _originalBlockHash,\\n \\\"createDispute\\\",\\n _originalDisputeID,\\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 function rule(uint256 _disputeID, uint256 _ruling) external {\\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 fastbridge.sendFast(foreignGateway, data);\\n }\\n\\n function disputeHashToHomeID(bytes32 _disputeHash) external view returns (uint256) {\\n return disputeHashtoID[_disputeHash];\\n }\\n}\\n\",\"keccak256\":\"0x838f448abaf4f9c8812ca0e4ffcd2acc1f475ef585b2287b61b0dec162dee775\",\"license\":\"MIT\"},\"src/gateway/interfaces/IForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../arbitration/IArbitrator.sol\\\";\\n\\ninterface IForeignGateway is IArbitrator {\\n function chainID() external view returns (uint256);\\n\\n /**\\n * Relay the rule call from the home gateway to the arbitrable.\\n */\\n function relayRule(\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _forwarder\\n ) external;\\n\\n function withdrawFees(bytes32 _disputeHash) external;\\n\\n // For cross-chain Evidence standard\\n\\n function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256);\\n\\n function homeChainID() external view returns (uint256);\\n\\n function homeGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0x9142bf9265b4399468f833c69e2f72896103e63f643ca186c9000424c2aa100a\",\"license\":\"MIT\"},\"src/gateway/interfaces/IHomeGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../arbitration/IArbitrable.sol\\\";\\nimport \\\"../../evidence/IMetaEvidence.sol\\\";\\n\\ninterface IHomeGateway is IArbitrable, IMetaEvidence {\\n function chainID() external view returns (uint256);\\n\\n function relayCreateDispute(\\n uint256 _originalChainID,\\n bytes32 _originalBlockHash,\\n uint256 _originalDisputeID,\\n uint256 _choices,\\n bytes calldata _extraData,\\n address _arbitrable\\n ) external payable;\\n\\n // For cross-chain Evidence standard\\n\\n function disputeHashToHomeID(bytes32 _disputeHash) external view returns (uint256);\\n\\n function foreignChainID() external view returns (uint256);\\n\\n function foreignGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd962398e6e91839bfc95c9bbe9d17c1e7b8c057e6e8cb3acd8fb836feb01614c\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506040516109df3803806109df83398101604081905261002f916100ea565b600280546001600160a01b038087166001600160a01b0319928316179092556003805486841690831617905560048054928516929091169190911790556006819055466005556040516000907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906100c19060208082526006908201526542524944474560d01b604082015260600190565b60405180910390a25050505061013d565b6001600160a01b03811681146100e757600080fd5b50565b6000806000806080858703121561010057600080fd5b845161010b816100d2565b602086015190945061011c816100d2565b604086015190935061012d816100d2565b6060959095015193969295505050565b6108938061014c6000396000f3fe60806040526004361061009c5760003560e01c8063adc879e911610064578063adc879e914610157578063ba4bc7631461016d578063c95c09511461019a578063cddbfa14146101c7578063d1d559c514610221578063fc4ba3a21461024157600080fd5b8063311a6c56146100a15780633b103f53146100c35780636cc6cde1146100d65780638d7c7daa146101135780639688240314610133575b600080fd5b3480156100ad57600080fd5b506100c16100bc366004610616565b61026e565b005b6100c16100d1366004610654565b6103ac565b3480156100e257600080fd5b506002546100f6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561011f57600080fd5b506004546100f6906001600160a01b031681565b34801561013f57600080fd5b5061014960065481565b60405190815260200161010a565b34801561016357600080fd5b5061014960055481565b34801561017957600080fd5b506101496101883660046106fe565b60006020819052908152604090205481565b3480156101a657600080fd5b506101496101b53660046106fe565b60016020526000908152604090205481565b3480156101d357600080fd5b506102046101e23660046106fe565b600760205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b0390911660208301520161010a565b34801561022d57600080fd5b506003546100f6906001600160a01b031681565b34801561024d57600080fd5b5061014961025c3660046106fe565b60009081526001602052604090205490565b6002546001600160a01b031633146102bf5760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b60448201526064015b60405180910390fd5b60008281526020818152604080832054808452600783529281902081518083018352815481526001909101546001600160a01b039081168285018190528351602481018790526044810188905260648082019290925284518082039092018252608401845293840180516001600160e01b0316633496987960e01b90811790915260035460048054955163263b083b60e21b8152949692959294918416936398ec20ec9361037293911691869101610717565b600060405180830381600087803b15801561038c57600080fd5b505af11580156103a0573d6000803e3d6000fd5b50505050505050505050565b6000878787878787876040516020016103cb979695949392919061077c565b60408051601f1981840301815291815281516020928301206000818152600790935291206001810154919250906001600160a01b03161561044e5760405162461bcd60e51b815260206004820152601760248201527f4469737075746520616c72656164792072656c6179656400000000000000000060448201526064016102b6565b60025460405163f7434ea960e01b81526001600160a01b039091169063f7434ea9906104809088908890600401610805565b602060405180830381865afa15801561049d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c19190610821565b8082553410156105135760405162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f756768206172626974726174696f6e20636f7374207061696460448201526064016102b6565b60025460405163c13517e160e01b81526000916001600160a01b03169063c13517e190349061054a908b908b908b9060040161083a565b60206040518083038185885af1158015610568573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061058d9190610821565b6000818152602081815260408083208790558683526001808352818420859055860180546001600160a01b0319163317905560025481518481529283019390935292935083926001600160a01b03909216917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350505050505050505050565b6000806040838503121561062957600080fd5b50508035926020909101359150565b80356001600160a01b038116811461064f57600080fd5b919050565b600080600080600080600060c0888a03121561066f57600080fd5b87359650602088013595506040880135945060608801359350608088013567ffffffffffffffff808211156106a357600080fd5b818a0191508a601f8301126106b757600080fd5b8135818111156106c657600080fd5b8b60208285010111156106d857600080fd5b6020830195508094505050506106f060a08901610638565b905092959891949750929550565b60006020828403121561071057600080fd5b5035919050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561075357858101830151858201606001528201610737565b81811115610765576000606083870101525b50601f01601f191692909201606001949350505050565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006108196020830184866107dc565b949350505050565b60006020828403121561083357600080fd5b5051919050565b8381526040602082015260006108546040830184866107dc565b9594505050505056fea26469706673582212209b353cefef6d96cad6be13b5e743211703f8a1ea1168c9a258240cf76493f69964736f6c634300080a0033", - "deployedBytecode": "0x60806040526004361061009c5760003560e01c8063adc879e911610064578063adc879e914610157578063ba4bc7631461016d578063c95c09511461019a578063cddbfa14146101c7578063d1d559c514610221578063fc4ba3a21461024157600080fd5b8063311a6c56146100a15780633b103f53146100c35780636cc6cde1146100d65780638d7c7daa146101135780639688240314610133575b600080fd5b3480156100ad57600080fd5b506100c16100bc366004610616565b61026e565b005b6100c16100d1366004610654565b6103ac565b3480156100e257600080fd5b506002546100f6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561011f57600080fd5b506004546100f6906001600160a01b031681565b34801561013f57600080fd5b5061014960065481565b60405190815260200161010a565b34801561016357600080fd5b5061014960055481565b34801561017957600080fd5b506101496101883660046106fe565b60006020819052908152604090205481565b3480156101a657600080fd5b506101496101b53660046106fe565b60016020526000908152604090205481565b3480156101d357600080fd5b506102046101e23660046106fe565b600760205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b0390911660208301520161010a565b34801561022d57600080fd5b506003546100f6906001600160a01b031681565b34801561024d57600080fd5b5061014961025c3660046106fe565b60009081526001602052604090205490565b6002546001600160a01b031633146102bf5760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b60448201526064015b60405180910390fd5b60008281526020818152604080832054808452600783529281902081518083018352815481526001909101546001600160a01b039081168285018190528351602481018790526044810188905260648082019290925284518082039092018252608401845293840180516001600160e01b0316633496987960e01b90811790915260035460048054955163263b083b60e21b8152949692959294918416936398ec20ec9361037293911691869101610717565b600060405180830381600087803b15801561038c57600080fd5b505af11580156103a0573d6000803e3d6000fd5b50505050505050505050565b6000878787878787876040516020016103cb979695949392919061077c565b60408051601f1981840301815291815281516020928301206000818152600790935291206001810154919250906001600160a01b03161561044e5760405162461bcd60e51b815260206004820152601760248201527f4469737075746520616c72656164792072656c6179656400000000000000000060448201526064016102b6565b60025460405163f7434ea960e01b81526001600160a01b039091169063f7434ea9906104809088908890600401610805565b602060405180830381865afa15801561049d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104c19190610821565b8082553410156105135760405162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f756768206172626974726174696f6e20636f7374207061696460448201526064016102b6565b60025460405163c13517e160e01b81526000916001600160a01b03169063c13517e190349061054a908b908b908b9060040161083a565b60206040518083038185885af1158015610568573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061058d9190610821565b6000818152602081815260408083208790558683526001808352818420859055860180546001600160a01b0319163317905560025481518481529283019390935292935083926001600160a01b03909216917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350505050505050505050565b6000806040838503121561062957600080fd5b50508035926020909101359150565b80356001600160a01b038116811461064f57600080fd5b919050565b600080600080600080600060c0888a03121561066f57600080fd5b87359650602088013595506040880135945060608801359350608088013567ffffffffffffffff808211156106a357600080fd5b818a0191508a601f8301126106b757600080fd5b8135818111156106c657600080fd5b8b60208285010111156106d857600080fd5b6020830195508094505050506106f060a08901610638565b905092959891949750929550565b60006020828403121561071057600080fd5b5035919050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561075357858101830151858201606001528201610737565b81811115610765576000606083870101525b50601f01601f191692909201606001949350505050565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006108196020830184866107dc565b949350505050565b60006020828403121561083357600080fd5b5051919050565b8381526040602082015260006108546040830184866107dc565b9594505050505056fea26469706673582212209b353cefef6d96cad6be13b5e743211703f8a1ea1168c9a258240cf76493f69964736f6c634300080a0033", - "devdoc": { - "kind": "dev", - "methods": { - "relayCreateDispute(uint256,bytes32,uint256,uint256,bytes,address)": { - "details": "Provide the same parameters as on the originalChain while creating a dispute. Providing incorrect parameters will create a different hash than on the originalChain and will not affect the actual dispute/arbitrable's ruling.", - "params": { - "_arbitrable": "arbitrable", - "_choices": "number of ruling choices", - "_extraData": "extraData", - "_originalBlockHash": "originalBlockHash", - "_originalChainID": "originalChainId", - "_originalDisputeID": "originalDisputeID" - } - }, - "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": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 11052, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "disputeIDtoHash", - "offset": 0, - "slot": "0", - "type": "t_mapping(t_uint256,t_bytes32)" - }, - { - "astId": 11056, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "disputeHashtoID", - "offset": 0, - "slot": "1", - "type": "t_mapping(t_bytes32,t_uint256)" - }, - { - "astId": 11059, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "arbitrator", - "offset": 0, - "slot": "2", - "type": "t_contract(IArbitrator)1911" - }, - { - "astId": 11062, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "fastbridge", - "offset": 0, - "slot": "3", - "type": "t_contract(IFastBridgeSender)8494" - }, - { - "astId": 11064, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "foreignGateway", - "offset": 0, - "slot": "4", - "type": "t_address" - }, - { - "astId": 11066, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "chainID", - "offset": 0, - "slot": "5", - "type": "t_uint256" - }, - { - "astId": 11068, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "foreignChainID", - "offset": 0, - "slot": "6", - "type": "t_uint256" - }, - { - "astId": 11078, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "disputeHashtoRelayedData", - "offset": 0, - "slot": "7", - "type": "t_mapping(t_bytes32,t_struct(RelayedData)11073_storage)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(IArbitrator)1911": { - "encoding": "inplace", - "label": "contract IArbitrator", - "numberOfBytes": "20" - }, - "t_contract(IFastBridgeSender)8494": { - "encoding": "inplace", - "label": "contract IFastBridgeSender", - "numberOfBytes": "20" - }, - "t_mapping(t_bytes32,t_struct(RelayedData)11073_storage)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => struct HomeGateway.RelayedData)", - "numberOfBytes": "32", - "value": "t_struct(RelayedData)11073_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)11073_storage": { - "encoding": "inplace", - "label": "struct HomeGateway.RelayedData", - "members": [ - { - "astId": 11070, - "contract": "src/gateway/HomeGateway.sol:HomeGateway", - "label": "arbitrationCost", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 11072, - "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/arbitrumRinkeby/HomeGatewayToEthereum.json b/contracts/deployments/arbitrumRinkeby/HomeGatewayToEthereum.json new file mode 100644 index 000000000..0fcbc14ec --- /dev/null +++ b/contracts/deployments/arbitrumRinkeby/HomeGatewayToEthereum.json @@ -0,0 +1,553 @@ +{ + "address": "0x4e894c2B60214beC53B60D09F39544518296C07B", + "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": "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": "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": "_originalChainID", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_originalBlockHash", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_originalDisputeID", + "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": "0xe42584ddaf841bc1b142945510b67b42b6174fc638a7a0148251003bad12fec7", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x4e894c2B60214beC53B60D09F39544518296C07B", + "transactionIndex": 1, + "gasUsed": "694556", + "logsBloom": "0x00400000000000000000000000000000000000001000000000000004000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000008000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x33793b94d33d55c2967688a53eb3c0caeb50b0c981549cee08319c64431d323c", + "transactionHash": "0xe42584ddaf841bc1b142945510b67b42b6174fc638a7a0148251003bad12fec7", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 14453123, + "transactionHash": "0xe42584ddaf841bc1b142945510b67b42b6174fc638a7a0148251003bad12fec7", + "address": "0x4e894c2B60214beC53B60D09F39544518296C07B", + "topics": [ + "0x61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000064252494447450000000000000000000000000000000000000000000000000000", + "logIndex": 0, + "blockHash": "0x33793b94d33d55c2967688a53eb3c0caeb50b0c981549cee08319c64431d323c" + } + ], + "blockNumber": 14453123, + "cumulativeGasUsed": "694556", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F", + "0xf8A4a85e7153374A1b9BDA763a84252eC286843b", + "0x8681CE0CA5706Cf4732d9060e8eC9f865F7d546a", + 4 + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\":\"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\":\"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\":\"_originalChainID\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_originalBlockHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_originalDisputeID\",\"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.\"}},\"relayCreateDispute(uint256,bytes32,uint256,uint256,bytes,address)\":{\"details\":\"Provide the same parameters as on the originalChain while creating a dispute. Providing incorrect parameters will create a different hash than on the originalChain and will not affect the actual dispute/arbitrable's ruling.\",\"params\":{\"_arbitrable\":\"arbitrable\",\"_choices\":\"number of ruling choices\",\"_extraData\":\"extraData\",\"_originalBlockHash\":\"originalBlockHash\",\"_originalChainID\":\"originalChainId\",\"_originalDisputeID\":\"originalDisputeID\"}},\"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\":200},\"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/bridge/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\"},\"src/bridge/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\"},\"src/bridge/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 \\\"../../bridge/interfaces/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\":\"0x0c4a83b87e4810d2e9798a3df3876d0708171c25757c9a2e04c0b3360c9a0d3a\",\"license\":\"MIT\"},\"src/bridge/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 \\\"../../bridge/interfaces/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\":\"0x2c84190092d2b50a8267aef262531dfebebc4ed612377be04d8bee1146689ef2\",\"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\"},\"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 \\\"../bridge/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 originalChain while creating a dispute. Providing incorrect parameters will create a different hash than on the originalChain and will not affect the actual dispute/arbitrable's ruling.\\n * @param _originalChainID originalChainId\\n * @param _originalBlockHash originalBlockHash\\n * @param _originalDisputeID originalDisputeID\\n * @param _choices number of ruling choices\\n * @param _extraData extraData\\n * @param _arbitrable arbitrable\\n */\\n function relayCreateDispute(\\n uint256 _originalChainID,\\n bytes32 _originalBlockHash,\\n uint256 _originalDisputeID,\\n uint256 _choices,\\n bytes calldata _extraData,\\n address _arbitrable\\n ) external payable override {\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n _originalChainID,\\n _originalBlockHash,\\n \\\"createDispute\\\",\\n _originalDisputeID,\\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 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 function disputeHashToHomeID(bytes32 _disputeHash) external view override returns (uint256) {\\n return disputeHashtoID[_disputeHash];\\n }\\n}\\n\",\"keccak256\":\"0x866fdced5677b2a078ea3e486b9d6b8236020f787c8dd6bdcb0ed58c16618a1b\",\"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 \\\"../../bridge/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(\\n address _messageSender,\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _forwarder\\n ) 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\",\"keccak256\":\"0xef24b9fbfb1afcb5cd8ac01541dab1142c34e87e723f0d3355bf80d163136b38\",\"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 \\\"../../bridge/interfaces/ISenderGateway.sol\\\";\\n\\ninterface IHomeGateway is IArbitrable, IMetaEvidence, ISenderGateway {\\n function relayCreateDispute(\\n uint256 _originalChainID,\\n bytes32 _originalBlockHash,\\n uint256 _originalDisputeID,\\n uint256 _choices,\\n bytes calldata _extraData,\\n address _arbitrable\\n ) external payable;\\n\\n // For cross-chain Evidence standard\\n function disputeHashToHomeID(bytes32 _disputeHash) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x5242b2697e7ad168165d924e7a8a7ad295eb5d89f80de6d38debe543bce1640a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405234801561001057600080fd5b50604051610bd5380380610bd583398101604081905261002f916100e6565b600080546001600160a01b038088166001600160a01b031992831617835586811660805260018054878316908416179055600280549186169190921617905560a08290526040517f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d906100bc9060208082526006908201526542524944474560d01b604082015260600190565b60405180910390a25050505050610151565b6001600160a01b03811681146100e357600080fd5b50565b600080600080600060a086880312156100fe57600080fd5b8551610109816100ce565b602087015190955061011a816100ce565b604087015190945061012b816100ce565b606087015190935061013c816100ce565b80925050608086015190509295509295909350565b60805160a051610a436101926000396000610286015260008181610130015281816102e0015281816104e9015281816105c601526106af0152610a436000f3fe6080604052600436106100a75760003560e01c8063c5ffcf7011610064578063c5ffcf70146101ad578063c95c0951146101cd578063cddbfa14146101fa578063e7fe313914610254578063ea4f97d314610274578063fc4ba3a2146102a857600080fd5b80630c340a24146100ac578063311a6c56146100e95780633b103f531461010b5780636cc6cde11461011e5780638ed87e0014610152578063ba4bc76314610172575b600080fd5b3480156100b857600080fd5b506000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100f557600080fd5b50610109610104366004610796565b6102d5565b005b6101096101193660046107e0565b610430565b34801561012a57600080fd5b506100cc7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015e57600080fd5b5061010961016d36600461088a565b61070f565b34801561017e57600080fd5b5061019f61018d3660046108ae565b60036020526000908152604090205481565b6040519081526020016100e0565b3480156101b957600080fd5b506002546100cc906001600160a01b031681565b3480156101d957600080fd5b5061019f6101e83660046108ae565b60046020526000908152604090205481565b34801561020657600080fd5b506102376102153660046108ae565b600560205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016100e0565b34801561026057600080fd5b506001546100cc906001600160a01b031681565b34801561028057600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102b457600080fd5b5061019f6102c33660046108ae565b60009081526004602052604090205490565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103445760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b60448201526064015b60405180910390fd5b600082815260036020908152604080832054808452600583529281902081518083018352815481526001918201546001600160a01b039081168286018190528451602481018890526044810189905260648082019290925285518082039092018252608401855294850180516001600160e01b031663a60a4db560e01b9081179091529254600254945163263b083b60e21b815292959394908216926398ec20ec926103f692169085906004016108c7565b600060405180830381600087803b15801561041057600080fd5b505af1158015610424573d6000803e3d6000fd5b50505050505050505050565b60008787878787878760405160200161044f979695949392919061092c565b60408051601f1981840301815291815281516020928301206000818152600590935291206001810154919250906001600160a01b0316156104d25760405162461bcd60e51b815260206004820152601760248201527f4469737075746520616c72656164792072656c61796564000000000000000000604482015260640161033b565b60405163f7434ea960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f7434ea99061052090889088906004016109b5565b60206040518083038186803b15801561053857600080fd5b505afa15801561054c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057091906109d1565b8082553410156105c25760405162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f756768206172626974726174696f6e20636f73742070616964604482015260640161033b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c13517e1348989896040518563ffffffff1660e01b8152600401610615939291906109ea565b6020604051808303818588803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061066791906109d1565b6000818152600360209081526040808320879055868352600482528083208490556001860180546001600160a01b0319163317905580518381529182019290925291925082917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350505050505050505050565b6000546001600160a01b031633146107745760405162461bcd60e51b815260206004820152602260248201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6044820152613c9760f11b606482015260840161033b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080604083850312156107a957600080fd5b50508035926020909101359150565b6001600160a01b03811681146107cd57600080fd5b50565b80356107db816107b8565b919050565b600080600080600080600060c0888a0312156107fb57600080fd5b87359650602088013595506040880135945060608801359350608088013567ffffffffffffffff8082111561082f57600080fd5b818a0191508a601f83011261084357600080fd5b81358181111561085257600080fd5b8b602082850101111561086457600080fd5b60208301955080945050505061087c60a089016107d0565b905092959891949750929550565b60006020828403121561089c57600080fd5b81356108a7816107b8565b9392505050565b6000602082840312156108c057600080fd5b5035919050565b60018060a01b038316815260006020604081840152835180604085015260005b81811015610903578581018301518582016060015282016108e7565b81811115610915576000606083870101525b50601f01601f191692909201606001949350505050565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006109c960208301848661098c565b949350505050565b6000602082840312156109e357600080fd5b5051919050565b838152604060208201526000610a0460408301848661098c565b9594505050505056fea2646970667358221220e7dca6bd4df7f5f6dafa874c8f411cd92054731fefd5309ddf74a2854e21243064736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100a75760003560e01c8063c5ffcf7011610064578063c5ffcf70146101ad578063c95c0951146101cd578063cddbfa14146101fa578063e7fe313914610254578063ea4f97d314610274578063fc4ba3a2146102a857600080fd5b80630c340a24146100ac578063311a6c56146100e95780633b103f531461010b5780636cc6cde11461011e5780638ed87e0014610152578063ba4bc76314610172575b600080fd5b3480156100b857600080fd5b506000546100cc906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100f557600080fd5b50610109610104366004610796565b6102d5565b005b6101096101193660046107e0565b610430565b34801561012a57600080fd5b506100cc7f000000000000000000000000000000000000000000000000000000000000000081565b34801561015e57600080fd5b5061010961016d36600461088a565b61070f565b34801561017e57600080fd5b5061019f61018d3660046108ae565b60036020526000908152604090205481565b6040519081526020016100e0565b3480156101b957600080fd5b506002546100cc906001600160a01b031681565b3480156101d957600080fd5b5061019f6101e83660046108ae565b60046020526000908152604090205481565b34801561020657600080fd5b506102376102153660046108ae565b600560205260009081526040902080546001909101546001600160a01b031682565b604080519283526001600160a01b039091166020830152016100e0565b34801561026057600080fd5b506001546100cc906001600160a01b031681565b34801561028057600080fd5b5061019f7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102b457600080fd5b5061019f6102c33660046108ae565b60009081526004602052604090205490565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146103445760405162461bcd60e51b815260206004820152600f60248201526e27b7363c9020b93134ba3930ba37b960891b60448201526064015b60405180910390fd5b600082815260036020908152604080832054808452600583529281902081518083018352815481526001918201546001600160a01b039081168286018190528451602481018890526044810189905260648082019290925285518082039092018252608401855294850180516001600160e01b031663a60a4db560e01b9081179091529254600254945163263b083b60e21b815292959394908216926398ec20ec926103f692169085906004016108c7565b600060405180830381600087803b15801561041057600080fd5b505af1158015610424573d6000803e3d6000fd5b50505050505050505050565b60008787878787878760405160200161044f979695949392919061092c565b60408051601f1981840301815291815281516020928301206000818152600590935291206001810154919250906001600160a01b0316156104d25760405162461bcd60e51b815260206004820152601760248201527f4469737075746520616c72656164792072656c61796564000000000000000000604482015260640161033b565b60405163f7434ea960e01b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063f7434ea99061052090889088906004016109b5565b60206040518083038186803b15801561053857600080fd5b505afa15801561054c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061057091906109d1565b8082553410156105c25760405162461bcd60e51b815260206004820181905260248201527f4e6f7420656e6f756768206172626974726174696f6e20636f73742070616964604482015260640161033b565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663c13517e1348989896040518563ffffffff1660e01b8152600401610615939291906109ea565b6020604051808303818588803b15801561062e57600080fd5b505af1158015610642573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061066791906109d1565b6000818152600360209081526040808320879055868352600482528083208490556001860180546001600160a01b0319163317905580518381529182019290925291925082917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350505050505050505050565b6000546001600160a01b031633146107745760405162461bcd60e51b815260206004820152602260248201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6044820152613c9760f11b606482015260840161033b565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b600080604083850312156107a957600080fd5b50508035926020909101359150565b6001600160a01b03811681146107cd57600080fd5b50565b80356107db816107b8565b919050565b600080600080600080600060c0888a0312156107fb57600080fd5b87359650602088013595506040880135945060608801359350608088013567ffffffffffffffff8082111561082f57600080fd5b818a0191508a601f83011261084357600080fd5b81358181111561085257600080fd5b8b602082850101111561086457600080fd5b60208301955080945050505061087c60a089016107d0565b905092959891949750929550565b60006020828403121561089c57600080fd5b81356108a7816107b8565b9392505050565b6000602082840312156108c057600080fd5b5035919050565b60018060a01b038316815260006020604081840152835180604085015260005b81811015610903578581018301518582016060015282016108e7565b81811115610915576000606083870101525b50601f01601f191692909201606001949350505050565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6020815260006109c960208301848661098c565b949350505050565b6000602082840312156109e357600080fd5b5051919050565b838152604060208201526000610a0460408301848661098c565b9594505050505056fea2646970667358221220e7dca6bd4df7f5f6dafa874c8f411cd92054731fefd5309ddf74a2854e21243064736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "changeFastbridge(address)": { + "details": "Changes the fastBridge, useful to increase the claim deposit.", + "params": { + "_fastBridgeSender": "The address of the new fastBridge." + } + }, + "relayCreateDispute(uint256,bytes32,uint256,uint256,bytes,address)": { + "details": "Provide the same parameters as on the originalChain while creating a dispute. Providing incorrect parameters will create a different hash than on the originalChain and will not affect the actual dispute/arbitrable's ruling.", + "params": { + "_arbitrable": "arbitrable", + "_choices": "number of ruling choices", + "_extraData": "extraData", + "_originalBlockHash": "originalBlockHash", + "_originalChainID": "originalChainId", + "_originalDisputeID": "originalDisputeID" + } + }, + "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": 22235, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 22241, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "fastBridgeSender", + "offset": 0, + "slot": "1", + "type": "t_contract(IFastBridgeSender)16804" + }, + { + "astId": 22244, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "receiverGateway", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 22251, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "disputeIDtoHash", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_bytes32)" + }, + { + "astId": 22255, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "disputeHashtoID", + "offset": 0, + "slot": "4", + "type": "t_mapping(t_bytes32,t_uint256)" + }, + { + "astId": 22260, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "disputeHashtoRelayedData", + "offset": 0, + "slot": "5", + "type": "t_mapping(t_bytes32,t_struct(RelayedData)22233_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IFastBridgeSender)16804": { + "encoding": "inplace", + "label": "contract IFastBridgeSender", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_struct(RelayedData)22233_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct HomeGateway.RelayedData)", + "numberOfBytes": "32", + "value": "t_struct(RelayedData)22233_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)22233_storage": { + "encoding": "inplace", + "label": "struct HomeGateway.RelayedData", + "members": [ + { + "astId": 22230, + "contract": "src/gateway/HomeGateway.sol:HomeGateway", + "label": "arbitrationCost", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 22232, + "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/arbitrumRinkeby/KlerosCore.json b/contracts/deployments/arbitrumRinkeby/KlerosCore.json index 1bfc4f38e..f3c359478 100644 --- a/contracts/deployments/arbitrumRinkeby/KlerosCore.json +++ b/contracts/deployments/arbitrumRinkeby/KlerosCore.json @@ -1,5 +1,5 @@ { - "address": "0x140Cae40BD7eEF075e15c30CF84d1EAa0F4932b8", + "address": "0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F", "abi": [ { "inputs": [ @@ -143,6 +143,12 @@ { "anonymous": false, "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_disputeKitID", + "type": "uint256" + }, { "indexed": true, "internalType": "contract IDisputeKit", @@ -156,7 +162,7 @@ "type": "uint256" } ], - "name": "DisputeKitCreation", + "name": "DisputeKitCreated", "type": "event" }, { @@ -173,28 +179,15 @@ "internalType": "uint256", "name": "_disputeKitID", "type": "uint256" - } - ], - "name": "DisputeKitDisable", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint96", - "name": "_subcourtID", - "type": "uint96" }, { "indexed": true, - "internalType": "uint256", - "name": "_disputeKitID", - "type": "uint256" + "internalType": "bool", + "name": "_enable", + "type": "bool" } ], - "name": "DisputeKitEnable", + "name": "DisputeKitEnabled", "type": "event" }, { @@ -386,7 +379,7 @@ "type": "uint256[]" } ], - "name": "SubcourtCreation", + "name": "SubcourtCreated", "type": "event" }, { @@ -405,7 +398,7 @@ "type": "string" } ], - "name": "SubcourtModification", + "name": "SubcourtModified", "type": "event" }, { @@ -454,7 +447,7 @@ }, { "inputs": [], - "name": "DISPUTE_KIT_CLASSIC_INDEX", + "name": "DISPUTE_KIT_CLASSIC", "outputs": [ { "internalType": "uint256", @@ -470,9 +463,9 @@ "name": "FORKING_COURT", "outputs": [ { - "internalType": "uint256", + "internalType": "uint96", "name": "", - "type": "uint256" + "type": "uint96" } ], "stateMutability": "view", @@ -483,9 +476,9 @@ "name": "GENERAL_COURT", "outputs": [ { - "internalType": "uint256", + "internalType": "uint96", "name": "", - "type": "uint256" + "type": "uint96" } ], "stateMutability": "view", @@ -659,25 +652,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_subcourtID", - "type": "uint256" - } - ], - "name": "areVotesHidden", - "outputs": [ - { - "internalType": "bool", - "name": "hiddenVotes", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1282,25 +1256,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_disputeID", - "type": "uint256" - } - ], - "name": "getCurrentPeriod", - "outputs": [ - { - "internalType": "enum KlerosCore.Period", - "name": "period", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1320,19 +1275,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "getDisputeKitNodesLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "getDisputesKitIDsThatNeedFreezing", @@ -1346,19 +1288,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "getFreezeBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1505,6 +1434,11 @@ "internalType": "bytes32", "name": "_key", "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "_nodeIndex", + "type": "uint256" } ], "name": "getSortitionSumTree", @@ -1514,35 +1448,11 @@ "name": "K", "type": "uint256" }, - { - "internalType": "uint256[]", - "name": "stack", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "nodes", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_key", - "type": "bytes32" - }, { "internalType": "uint256", - "name": "_nodeIndex", + "name": "length", "type": "uint256" - } - ], - "name": "getSortitionSumTreeID", - "outputs": [ + }, { "internalType": "bytes32", "name": "ID", @@ -1552,25 +1462,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_key", - "type": "bytes32" - } - ], - "name": "getSortitionSumTreeK", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1595,44 +1486,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_key", - "type": "bytes32" - } - ], - "name": "getSortitionSumTreeNodesLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_disputeID", - "type": "uint256" - } - ], - "name": "getSubcourtID", - "outputs": [ - { - "internalType": "uint256", - "name": "subcourtID", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1684,25 +1537,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_disputeID", - "type": "uint256" - } - ], - "name": "isRuled", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [ { @@ -1844,19 +1678,64 @@ "type": "function" } ], - "transactionHash": "0x6244d7dbd14d2cfc5daeeaa954066647e7ce2c6c3d0918eb88b3c2ad8e5e1adb", + "transactionHash": "0x1d72ee146e24c8d2cdf5ad96d3f0d10cf86e39f10d6e5f9cb58dc9a517d7da5f", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x140Cae40BD7eEF075e15c30CF84d1EAa0F4932b8", - "transactionIndex": 0, - "gasUsed": "92686125", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb68198bffe98803385e1f8df8dc56beb4e1093dded3e5a5c29d9d76a712d8ec1", - "transactionHash": "0x6244d7dbd14d2cfc5daeeaa954066647e7ce2c6c3d0918eb88b3c2ad8e5e1adb", - "logs": [], - "blockNumber": 13351474, - "cumulativeGasUsed": "42400763", + "contractAddress": "0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F", + "transactionIndex": 1, + "gasUsed": "5827557", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000020000000400000000020000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000100040000000000000000000080000000020000000000000000000800400000000008000000000000000000000000000100000000004000000000040000000000000000000000000000000000080000000000000000000000000000000000010000000000000000000000000000000008000000004000000000000000000000000000000000000000000060000000001000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x9084eb4aacd00c8bcb71734af5e1a474787b6352e968df81282b504ec2ea1da4", + "transactionHash": "0x1d72ee146e24c8d2cdf5ad96d3f0d10cf86e39f10d6e5f9cb58dc9a517d7da5f", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 14452893, + "transactionHash": "0x1d72ee146e24c8d2cdf5ad96d3f0d10cf86e39f10d6e5f9cb58dc9a517d7da5f", + "address": "0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F", + "topics": [ + "0x7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x000000000000000000000000a2c538aa05bbcc44c213441f6f3777223d2bf9e5", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x", + "logIndex": 0, + "blockHash": "0x9084eb4aacd00c8bcb71734af5e1a474787b6352e968df81282b504ec2ea1da4" + }, + { + "transactionIndex": 1, + "blockNumber": 14452893, + "transactionHash": "0x1d72ee146e24c8d2cdf5ad96d3f0d10cf86e39f10d6e5f9cb58dc9a517d7da5f", + "address": "0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F", + "topics": [ + "0x2e689e2ae8e3c8e02797c3ff9998e8297e587a74bc6d0e48b6b5991f70991d1c", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ad78ebc5ac62000000000000000000000000000000000000000000000000000000000000000002710000000000000000000000000000000000000000000000000016345785d8a000000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000", + "logIndex": 1, + "blockHash": "0x9084eb4aacd00c8bcb71734af5e1a474787b6352e968df81282b504ec2ea1da4" + }, + { + "transactionIndex": 1, + "blockNumber": 14452893, + "transactionHash": "0x1d72ee146e24c8d2cdf5ad96d3f0d10cf86e39f10d6e5f9cb58dc9a517d7da5f", + "address": "0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F", + "topics": [ + "0xb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc79", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0000000000000000000000000000000000000000000000000000000000000001" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0x9084eb4aacd00c8bcb71734af5e1a474787b6352e968df81282b504ec2ea1da4" + } + ], + "blockNumber": 14452893, + "cumulativeGasUsed": "5827557", "status": 1, "byzantium": true }, @@ -1864,7 +1743,7 @@ "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", "0x364530164a2338cdba211f72c1438eb811b5c639", "0x0000000000000000000000000000000000000000", - "0x6b9268082415b5499175849E46AaE4EDf819916F", + "0xA2c538AA05BBCc44c213441f6f3777223D2BF9e5", [ 120, 120 @@ -1884,11 +1763,11 @@ ], 3 ], - "numDeployments": 2, - "solcInputHash": "d464953816050410147003aa7264a227", - "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\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_fromSubcourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"_toSubcourtID\",\"type\":\"uint96\"}],\"name\":\"CourtJump\",\"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\":\"contract IDisputeKit\",\"name\":\"_disputeKitAddress\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_parent\",\"type\":\"uint256\"}],\"name\":\"DisputeKitCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"DisputeKitDisable\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"DisputeKitEnable\",\"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\":\"_subcourtID\",\"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\":\"uint256\",\"name\":\"_subcourtID\",\"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\":\"SubcourtCreation\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_param\",\"type\":\"string\"}],\"name\":\"SubcourtModification\",\"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_INDEX\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"FORKING_COURT\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"GENERAL_COURT\",\"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\":\"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\":\"uint256\",\"name\":\"_subcourtID\",\"type\":\"uint256\"}],\"name\":\"areVotesHidden\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"hiddenVotes\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"}],\"name\":\"changeHiddenVotes\",\"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\":\"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\":\"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\"},{\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"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\":[],\"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\":\"subcourtID\",\"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\":\"subcourtID\",\"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\":\"_subcourtID\",\"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\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getCurrentPeriod\",\"outputs\":[{\"internalType\":\"enum KlerosCore.Period\",\"name\":\"period\",\"type\":\"uint8\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeKitID\",\"type\":\"uint256\"}],\"name\":\"getDisputeKitChildren\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDisputeKitNodesLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDisputesKitIDsThatNeedFreezing\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getFreezeBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_juror\",\"type\":\"address\"},{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"}],\"name\":\"getJurorBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"staked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"locked\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getLastRoundResult\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"}],\"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\"}],\"name\":\"getSortitionSumTree\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"K\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"stack\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256[]\",\"name\":\"nodes\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_nodeIndex\",\"type\":\"uint256\"}],\"name\":\"getSortitionSumTreeID\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"ID\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"}],\"name\":\"getSortitionSumTreeK\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"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\":\"bytes32\",\"name\":\"_key\",\"type\":\"bytes32\"}],\"name\":\"getSortitionSumTreeNodesLength\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getSubcourtID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"subcourtID\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"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\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"isRuled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"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\":\"_subcourtID\",\"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 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 arbitration cost.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeHiddenVotes(uint96,bool)\":{\"details\":\"Changes the `hiddenVotes` property value of a specified subcourt.\",\"params\":{\"_hiddenVotes\":\"The new value for the `hiddenVotes` property value.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"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.\"}},\"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.\"}},\"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.\"}},\"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 subcourt (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.\"}},\"createSubcourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256,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.\",\"_supportedDisputeKits\":\"Indexes of dispute kits that this subcourt will support.\",\"_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.\"}},\"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\":{\"_disputeKitIDs\":\"The IDs of dispute kits which support should be added/removed.\",\"_enable\":\"Whether add or remove the dispute kits from the subcourt.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"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\":{\"_subcourtID\":\"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 subcourt.\",\"params\":{\"_stake\":\"The new stake.\",\"_subcourtID\":\"The ID of the subcourt.\"}}},\"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\":200},\"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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling);\\n\\n /** @dev Returns the voting data from the most relevant round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @return winningChoice The winning choice of this round.\\n * @return tied Whether it's a tie or not.\\n */\\n function getLastRoundResult(uint256 _coreDisputeID) external view returns (uint256 winningChoice, bool tied);\\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(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) 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 )\\n external\\n view\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n );\\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\":\"0x235f027aa27fa972c56d863cfbc33832c8100135cf32d6827294de138e97dd44\",\"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 subcourtID; // The ID of the subcourt 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[] subcourtIDs; // The IDs of subcourts 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 subcourt in the form `stakedTokens[subcourtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the subcourt in the form `lockedTokens[subcourtID]`.\\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 subcourtID; // The ID of the subcourt.\\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 uint256 public constant FORKING_COURT = 0; // Index of the forking court.\\n uint256 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_INDEX = 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 subcourts.\\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 StakeSet(address indexed _address, uint256 _subcourtID, uint256 _amount, uint256 _newTotalStake);\\n event NewPeriod(uint256 indexed _disputeID, Period _period);\\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 SubcourtCreation(\\n uint256 indexed _subcourtID,\\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 SubcourtModification(uint96 indexed _subcourtID, string _param);\\n event DisputeKitCreation(IDisputeKit indexed _disputeKitAddress, uint256 indexed _parent);\\n event DisputeKitEnable(uint96 indexed _subcourtID, uint256 indexed _disputeKitID);\\n event DisputeKitDisable(uint96 indexed _subcourtID, uint256 indexed _disputeKitID);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromSubcourtID,\\n uint96 _toSubcourtID\\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, \\\"Access not allowed: 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\\n disputeKitNodes.push(); // NULL_DISPUTE_KIT: an empty element at index 0 to indicate when a node has no parent.\\n disputeKitNodes.push(\\n DisputeKitNode({\\n parent: 0,\\n children: new uint256[](0),\\n disputeKit: _disputeKit,\\n needsFreezing: false,\\n depthLevel: 0\\n })\\n );\\n\\n minStakingTime = _phaseTimeouts[0];\\n maxFreezingTime = _phaseTimeouts[1];\\n lastPhaseChange = block.timestamp;\\n\\n // Create the Forking court.\\n courts.push();\\n // TODO: fill the properties for Forking court.\\n\\n // Create the General court.\\n Court storage court = courts.push();\\n court.parent = 1; // TODO: Should the parent for General court be 0 or 1? In the former case the Forking court will become the top court after jumping.\\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 court.supportedDisputeKits[DISPUTE_KIT_CLASSIC_INDEX] = true;\\n\\n // TODO: fill the properties for Forking court.\\n sortitionSumTrees.createTree(bytes32(FORKING_COURT), _sortitionSumTreeK);\\n sortitionSumTrees.createTree(bytes32(GENERAL_COURT), _sortitionSumTreeK);\\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 doesn't exist\\\");\\n uint256 depthLevel;\\n\\n // Create new tree, which root should be supported by General court.\\n if (_parent == NULL_DISPUTE_KIT) {\\n courts[GENERAL_COURT].supportedDisputeKits[disputeKitID] = true;\\n } else {\\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 is at 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 }\\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 * @param _supportedDisputeKits Indexes of dispute kits that this subcourt will support.\\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 uint256[] memory _supportedDisputeKits\\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 require(_supportedDisputeKits.length > 0, \\\"Must support at least one DK\\\");\\n require(_parent != FORKING_COURT, \\\"Can't have Forking court as a parent\\\");\\n\\n uint256 subcourtID = 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(subcourtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(subcourtID);\\n emit SubcourtCreation(\\n subcourtID,\\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 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 == GENERAL_COURT || 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 emit SubcourtModification(_subcourtID, \\\"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 emit SubcourtModification(_subcourtID, \\\"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 emit SubcourtModification(_subcourtID, \\\"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 emit SubcourtModification(_subcourtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeHiddenVotes(uint96 _subcourtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_subcourtID].hiddenVotes = _hiddenVotes;\\n emit SubcourtModification(_subcourtID, \\\"hiddenVotes\\\");\\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(uint96 _subcourtID, uint256[4] memory _timesPerPeriod)\\n external\\n onlyByGovernor\\n {\\n courts[_subcourtID].timesPerPeriod = _timesPerPeriod;\\n emit SubcourtModification(_subcourtID, \\\"timesPerPeriod\\\");\\n }\\n\\n /** @dev Adds/removes court's support for specified dispute kits..\\n * @param _subcourtID The ID of the subcourt.\\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 subcourt.\\n */\\n function enableDisputeKits(\\n uint96 _subcourtID,\\n uint256[] memory _disputeKitIDs,\\n bool _enable\\n ) external onlyByGovernor {\\n Court storage subcourt = courts[_subcourtID];\\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 subcourt.supportedDisputeKits[_disputeKitIDs[i]] = true;\\n emit DisputeKitEnable(_subcourtID, _disputeKitIDs[i]);\\n } else {\\n require(\\n !(_subcourtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't remove root DK support from the general court\\\"\\n );\\n subcourt.supportedDisputeKits[_disputeKitIDs[i]] = false;\\n emit DisputeKitDisable(_subcourtID, _disputeKitIDs[i]);\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\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, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _subcourtID, _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, \\\"Should be in Staking phase.\\\");\\n\\n uint256 actualIterations = (delayedStakeReadIndex + _iterations) - 1 > delayedStakeWriteIndex\\n ? (delayedStakeWriteIndex - delayedStakeReadIndex) + 1\\n : _iterations;\\n uint256 newDelayedStakeReadIndex = delayedStakeReadIndex + actualIterations;\\n\\n for (uint256 i = delayedStakeReadIndex; i < newDelayedStakeReadIndex; i++) {\\n DelayedStake storage delayedStake = delayedStakes[i];\\n setStakeForAccount(delayedStake.account, delayedStake.subcourtID, 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 subcourt (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(uint256 _numberOfChoices, bytes memory _extraData)\\n external\\n payable\\n override\\n returns (uint256 disputeID)\\n {\\n require(msg.value >= arbitrationCost(_extraData), \\\"Not enough ETH to cover arbitration cost.\\\");\\n (uint96 subcourtID, , uint256 disputeKitID) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n\\n require(\\n courts[subcourtID].supportedDisputeKits[disputeKitID],\\n \\\"The dispute kit is not supported by this subcourt\\\"\\n );\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.subcourtID = subcourtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.subcourtID];\\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, \\\"The minimal staking time has not passed yet\\\");\\n require(disputesKitIDsThatNeedFreezing.length > 0, \\\"There are no dispute kit which need 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(), \\\"A dispute kit has not passed to Resolving phase\\\");\\n } else {\\n // Check if the dispute kit is ready for Staking phase.\\n require(disputeKit.isResolving(), \\\"A dispute kit has not passed to 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.subcourtID];\\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 \\\"The evidence period time has not passed yet and it is not an appeal.\\\"\\n );\\n require(round.drawnJurors.length == round.nbVotes, \\\"The dispute has not finished drawing yet.\\\");\\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 \\\"The commit period time has not passed yet.\\\"\\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 \\\"The vote period time has not passed yet\\\"\\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 \\\"The appeal period time has not passed yet.\\\"\\n );\\n dispute.period = Period.execution;\\n } else if (dispute.period == Period.execution) {\\n revert(\\\"The dispute is already in the last period.\\\");\\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, \\\"Should be 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.subcourtID] += round.tokensAtStakePerJuror;\\n round.drawnJurors.push(drawnAddress);\\n emit Draw(drawnAddress, _disputeID, currentRound, i);\\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(\\n uint256 _disputeID,\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) external payable {\\n require(msg.value >= appealCost(_disputeID), \\\"Not enough ETH to cover appeal cost.\\\");\\n\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.appeal, \\\"Dispute is not appealable.\\\");\\n\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n require(\\n msg.sender == address(disputeKitNodes[round.disputeKitID].disputeKit),\\n \\\"Access not allowed: Dispute Kit only.\\\"\\n );\\n\\n uint96 newSubcourtID = dispute.subcourtID;\\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[newDisputeKitID].jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n newSubcourtID = courts[newSubcourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newSubcourtID].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 newSubcourtID = courts[newSubcourtID].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[newSubcourtID].supportedDisputeKits[newDisputeKitID]) {\\n newSubcourtID = uint96(GENERAL_COURT);\\n }\\n\\n if (newSubcourtID != dispute.subcourtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.subcourtID, newSubcourtID);\\n }\\n }\\n\\n dispute.subcourtID = newSubcourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newSubcourtID];\\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(\\n uint256 _disputeID,\\n uint256 _round,\\n uint256 _iterations\\n ) external {\\n Dispute storage dispute = disputes[_disputeID];\\n require(dispute.period == Period.execution, \\\"Should be 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.subcourtID] -= 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.subcourtID] >= courts[dispute.subcourtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.subcourtID] - penalty;\\n setStakeForAccount(account, dispute.subcourtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.subcourtID] != 0) {\\n setStakeForAccount(account, dispute.subcourtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n for (uint256 j = 0; j < jurors[account].subcourtIDs.length; j++) {\\n setStakeForAccount(account, jurors[account].subcourtIDs[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.subcourtID] -=\\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.subcourtID] == 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, \\\"Should be 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 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)\\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 subcourtID, uint256 minJurors, ) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[subcourtID].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.subcourtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n if (dispute.subcourtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent subcourt.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current subcourt.\\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.subcourtID].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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n return disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round)\\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 Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.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 Dispute storage dispute = disputes[_disputeID];\\n return dispute.rounds.length;\\n }\\n\\n function getJurorBalance(address _juror, uint96 _subcourtID)\\n external\\n view\\n returns (uint256 staked, uint256 locked)\\n {\\n Juror storage juror = jurors[_juror];\\n staked = juror.stakedTokens[_subcourtID];\\n locked = juror.lockedTokens[_subcourtID];\\n }\\n\\n function isSupported(uint96 _subcourtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_subcourtID].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 _subcourtID 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 _subcourtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_subcourtID];\\n timesPerPeriod = court.timesPerPeriod;\\n }\\n\\n // ************************************* //\\n // * Public Views for Dispute Kits * //\\n // ************************************* //\\n\\n function getSortitionSumTreeK(bytes32 _key) public view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].K;\\n }\\n\\n function getSortitionSumTreeNode(bytes32 _key, uint256 _index) public view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].nodes[_index];\\n }\\n\\n function getSortitionSumTreeNodesLength(bytes32 _key) public view returns (uint256) {\\n return sortitionSumTrees.sortitionSumTrees[_key].nodes.length;\\n }\\n\\n function getSortitionSumTree(bytes32 _key)\\n public\\n view\\n returns (\\n uint256 K,\\n uint256[] memory stack,\\n uint256[] memory nodes\\n )\\n {\\n SortitionSumTreeFactory.SortitionSumTree storage tree = sortitionSumTrees.sortitionSumTrees[_key];\\n K = tree.K;\\n stack = tree.stack;\\n nodes = tree.nodes;\\n }\\n\\n // TODO: some getters can be merged into a single function\\n function getSortitionSumTreeID(bytes32 _key, uint256 _nodeIndex) external view returns (bytes32 ID) {\\n ID = sortitionSumTrees.sortitionSumTrees[_key].nodeIndexesToIDs[_nodeIndex];\\n }\\n\\n function getSubcourtID(uint256 _disputeID) external view returns (uint256 subcourtID) {\\n return disputes[_disputeID].subcourtID;\\n }\\n\\n function getCurrentPeriod(uint256 _disputeID) external view returns (Period period) {\\n return disputes[_disputeID].period;\\n }\\n\\n function areVotesHidden(uint256 _subcourtID) external view returns (bool hiddenVotes) {\\n return courts[_subcourtID].hiddenVotes;\\n }\\n\\n function isRuled(uint256 _disputeID) external view returns (bool) {\\n return disputes[_disputeID].ruled;\\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 getFreezeBlock() external view returns (uint256) {\\n return freezeBlock;\\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) public 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.subcourtID];\\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 getLastRoundResult(uint256 _disputeID) external view returns (uint256 winningChoice, bool tied) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (winningChoice, tied) = disputeKitNodes[round.disputeKitID].disputeKit.getLastRoundResult(_disputeID);\\n }\\n\\n function getDisputeKitNodesLength() external view returns (uint256) {\\n return disputeKitNodes.length;\\n }\\n\\n function getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\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 * @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 _subcourtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_subcourtID == FORKING_COURT || _subcourtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_subcourtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_subcourtID].minStake || _stake < juror.lockedTokens[_subcourtID]) return false;\\n if (currentStake == 0 && juror.subcourtIDs.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 subcourtID: _subcourtID,\\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.subcourtIDs.push(_subcourtID);\\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[_subcourtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\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 }\\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[_subcourtID] - currentStake + _stake;\\n juror.stakedTokens[_subcourtID] = newTotalStake;\\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 == GENERAL_COURT) finished = true;\\n else currentSubcourtID = courts[currentSubcourtID].parent;\\n }\\n\\n emit StakeSet(_account, _subcourtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a subcourt 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 subcourt ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return subcourtID The subcourt ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\n function extraDataToSubcourtIDMinJurorsDisputeKit(bytes memory _extraData)\\n internal\\n view\\n returns (\\n uint96 subcourtID,\\n uint256 minJurors,\\n uint256 disputeKitID\\n )\\n {\\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 subcourtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (subcourtID == FORKING_COURT || subcourtID >= courts.length) {\\n subcourtID = uint96(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_INDEX; // 0 index is not used.\\n }\\n } else {\\n subcourtID = uint96(GENERAL_COURT);\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC_INDEX;\\n }\\n }\\n\\n /** @dev Packs an account and a subcourt ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _subcourtID The subcourt ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndSubcourtIDToStakePathID(address _account, uint96 _subcourtID)\\n internal\\n pure\\n returns (bytes32 stakePathID)\\n {\\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 /** @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(\\n address _from,\\n address _to,\\n uint256 _value\\n ) 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\":\"0xe51c00b74782151959e5a5c311afb7d7dcc715a6de7e8be2932f2c96ca4e9a58\",\"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": "0x60806040526001600f553480156200001657600080fd5b5060405162006b8d38038062006b8d8339810160408190526200003991620004f3565b600080546001600160a01b038b81166001600160a01b0319928316178355600180548c8316908416178155600280548c84169416939093178355600880546040805160a081018252878152815188815260208082018452808301918252968f1692820192909252606081018890526080810188905295820183559190955283517ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3959092016004029485019182555180519394919362000123937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee490930192919091019062000378565b506040828101516002838101805460608701511515600160a01b026001600160a81b03199091166001600160a01b039094169390931792909217909155608090930151600392830155875190915560208088015160045542600555600780546000828152948101909155600b6001918201027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c688810180546001600160601b0319169092178255835194855291840192839052925162000208927fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c689909201919062000378565b50805460ff60601b19166c01000000000000000000000000861515021781558351600282015560208401516003820155604084015160048083019190915560608501516005830155620002629060068301908590620003c8565b5060016000818152600a83016020526040808220805460ff1916909317909255905163483abc4f60e11b8152600c60048201526024810191909152604481018390527348ce286978C74c288eA6Bc9a536BcC899DF8D17790639075789e9060640160006040518083038186803b158015620002dc57600080fd5b505af4158015620002f1573d6000803e3d6000fd5b505060405163483abc4f60e11b8152600c600482015260016024820152604481018590527348ce286978C74c288eA6Bc9a536BcC899DF8D1779250639075789e915060640160006040518083038186803b1580156200034f57600080fd5b505af415801562000364573d6000803e3d6000fd5b5050505050505050505050505050620005f5565b828054828255906000526020600020908101928215620003b6579160200282015b82811115620003b657825182559160200191906001019062000399565b50620003c4929150620003f8565b5090565b8260048101928215620003b65791602002820182811115620003b657825182559160200191906001019062000399565b5b80821115620003c45760008155600101620003f9565b6001600160a01b03811681146200042557600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b038111828210171562000463576200046362000428565b60405290565b805180151581146200047a57600080fd5b919050565b600082601f8301126200049157600080fd5b604051608081016001600160401b0381118282101715620004b657620004b662000428565b604052806080840185811115620004cc57600080fd5b845b81811015620004e8578051835260209283019201620004ce565b509195945050505050565b60008060008060008060008060006102008a8c0312156200051357600080fd5b895162000520816200040f565b809950506020808b015162000535816200040f565b60408c015190995062000548816200040f565b60608c01519098506200055b816200040f565b9650609f8b018c136200056d57600080fd5b620005776200043e565b8060c08d018e8111156200058a57600080fd5b60808e015b81811015620005a857805184529284019284016200058f565b50819850620005b78162000469565b975050505050620005cc8b60e08c016200047f565b9250620005de8b6101608c016200047f565b91506101e08a015190509295985092959850929598565b61658880620006056000396000f3fe6080604052600436106104305760003560e01c80638a9bb02a11610229578063c71f42531161012e578063eaff425a116100b6578063f8bdb57b1161007a578063f8bdb57b14610ddf578063fa41488014610dff578063fbf405b014610e14578063fc6f8f1614610e34578063fe524c3914610e5457600080fd5b8063eaff425a14610ce1578063f12ada8b14610cf6578063f6a6ef7a14610d16578063f6b4d82d14610d36578063f7434ea914610dbf57600080fd5b8063d2d514e0116100fd578063d2d514e014610c21578063d578cbac14610c50578063d8b03fd814610c70578063de1a1e5914610c85578063e4c0aaf414610cc157600080fd5b8063c71f425314610b64578063cf0c38f814610b84578063d1c1df4814610ba4578063d2b8035a14610c0157600080fd5b8063b31b4540116101b1578063bd8193bb11610180578063bd8193bb14610adb578063c057eca714610b08578063c13517e114610b1e578063c258bb1914610b31578063c356990214610b5157600080fd5b8063b31b454014610a85578063b4a6160814610a9b578063b70c4e9414610ab0578063b888adfa14610ac557600080fd5b8063a57366e7116101f8578063a57366e7146109b2578063a9b713af146109d2578063afe15cfb14610a02578063b1c9fe6e14610a37578063b2866af714610a6557600080fd5b80638a9bb02a1461090b5780638bb048751461093d5780638edf47411461095d5780639b05c2611461097d57600080fd5b806335975f4a1161033a57806359354c77116102c25780636c1eb1b9116102865780636c1eb1b91461087b578063751accd0146108905780637717a6e8146108b0578063823cfd70146108d0578063840bc19c146108f057600080fd5b806359354c771461080657806359ec827e146108265780635bc24dd3146108465780635ea5c038146108665780636235593f1461064457600080fd5b806343d4137f1161030957806343d4137f146107525780634b7fcda21461077f578063564a565d1461079f57806356acb050146107d057806357260364146107e657600080fd5b806335975f4a146106cf5780633a157860146106ef5780633cfd1184146107055780633e1d09be1461073257600080fd5b80631f5a0dd2116103bd5780632922d6041161038c5780632922d604146106595780632b6a63f1146106795780632d29a47b146106995780632ea7b4d0146106b957806334d5fb311461060257600080fd5b80631f5a0dd2146105ab5780632256aaf31461060257806322684db01461061757806327e6ec8a1461064457600080fd5b80630d1b9d1a116104045780630d1b9d1a146104c95780630e083ec914610517578063115d53761461053b57806319b815291461055b5780631c3db16d1461058b57600080fd5b8062f5822c146104355780630b274f2e146104575780630b7414bc1461046c5780630c340a241461048c575b600080fd5b34801561044157600080fd5b50610455610450366004615ac4565b610e74565b005b34801561046357600080fd5b50610455610ec9565b34801561047857600080fd5b50610455610487366004615bd9565b611487565b34801561049857600080fd5b506000546104ac906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156104d557600080fd5b506104e96104e4366004615c3b565b61177f565b604080519485526001600160a01b0390931660208501529015159183019190915260608201526080016104c0565b34801561052357600080fd5b5061052d600e5481565b6040519081526020016104c0565b34801561054757600080fd5b50610455610556366004615c3b565b6117c8565b34801561056757600080fd5b5061057b610576366004615c3b565b611ed0565b60405190151581526020016104c0565b34801561059757600080fd5b5061052d6105a6366004615c3b565b611fc7565b3480156105b757600080fd5b506105cb6105c6366004615c3b565b6120d2565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c0016104c0565b34801561060e57600080fd5b5061052d600181565b34801561062357600080fd5b50610637610632366004615c3b565b612129565b6040516104c09190615c7e565b34801561065057600080fd5b5061052d600081565b34801561066557600080fd5b5061052d610674366004615c8c565b61215b565b34801561068557600080fd5b50610455610694366004615d1c565b612192565b3480156106a557600080fd5b506104556106b4366004615dc0565b6125d2565b3480156106c557600080fd5b5061052d61271081565b3480156106db57600080fd5b506104556106ea366004615c3b565b612e89565b3480156106fb57600080fd5b5061052d60065481565b34801561071157600080fd5b50610725610720366004615dec565b612fd4565b6040516104c09190615e2a565b34801561073e57600080fd5b5061045561074d366004615e38565b613045565b34801561075e57600080fd5b5061077261076d366004615c3b565b6132ac565b6040516104c09190615e9d565b34801561078b57600080fd5b5061057b61079a366004615c3b565b613328565b3480156107ab57600080fd5b506107bf6107ba366004615c3b565b61335f565b6040516104c0959493929190615eb0565b3480156107dc57600080fd5b5061052d600f5481565b3480156107f257600080fd5b50610455610801366004615eef565b6133bb565b34801561081257600080fd5b50610455610821366004615e38565b61346a565b34801561083257600080fd5b5061052d610841366004615c3b565b61350b565b34801561085257600080fd5b50610455610861366004615e38565b61365b565b34801561087257600080fd5b5060085461052d565b34801561088757600080fd5b5061052d600a81565b34801561089c57600080fd5b506104556108ab366004615f93565b6136f6565b3480156108bc57600080fd5b506104556108cb366004615e38565b6137c8565b3480156108dc57600080fd5b506104556108eb366004615c3b565b613816565b3480156108fc57600080fd5b5061052d6001600160ff1b0381565b34801561091757600080fd5b5061092b610926366004615c8c565b613845565b6040516104c096959493929190615fec565b34801561094957600080fd5b50610455610958366004615c3b565b61392b565b34801561096957600080fd5b5061052d610978366004615c3b565b613aa0565b34801561098957600080fd5b5061099d610998366004615c3b565b613ac1565b604080519283529015156020830152016104c0565b3480156109be57600080fd5b506104556109cd366004615e38565b613bcb565b3480156109de57600080fd5b5061052d6109ed366004615c3b565b6000908152600c602052604090206002015490565b348015610a0e57600080fd5b50610a22610a1d366004615c3b565b613c73565b604080519283526020830191909152016104c0565b348015610a4357600080fd5b50600254610a5890600160a01b900460ff1681565b6040516104c09190616061565b348015610a7157600080fd5b50610455610a80366004615c3b565b613d20565b348015610a9157600080fd5b5061052d60045481565b348015610aa757600080fd5b5061052d600481565b348015610abc57600080fd5b5061057b613d4f565b348015610ad157600080fd5b5061052d60055481565b348015610ae757600080fd5b5061052d610af6366004615c3b565b6000908152600c602052604090205490565b348015610b1457600080fd5b5061052d60035481565b61052d610b2c36600461607b565b613d91565b348015610b3d57600080fd5b50610455610b4c366004615ac4565b61413f565b610455610b5f3660046160c2565b61418b565b348015610b7057600080fd5b5061052d610b7f366004615c3b565b61483c565b348015610b9057600080fd5b506002546104ac906001600160a01b031681565b348015610bb057600080fd5b50610a22610bbf3660046160fc565b6001600160a01b039091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610c0d57600080fd5b50610455610c1c366004615c8c565b6148a4565b348015610c2d57600080fd5b50610c41610c3c366004615c3b565b614ba5565b6040516104c093929190616128565b348015610c5c57600080fd5b5061057b610c6b366004615c3b565b614c6d565b348015610c7c57600080fd5b50610772614ca3565b348015610c9157600080fd5b5061052d610ca0366004615c8c565b6000918252600c602090815260408084209284526004909201905290205490565b348015610ccd57600080fd5b50610455610cdc366004615ac4565b614cfb565b348015610ced57600080fd5b5061052d600381565b348015610d0257600080fd5b50610455610d11366004616153565b614d47565b348015610d2257600080fd5b5061052d610d31366004615c3b565b614fbb565b348015610d4257600080fd5b50610d8d610d51366004615c3b565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b0390931660208501529183015260608201526080016104c0565b348015610dcb57600080fd5b5061052d610dda366004616171565b614ff0565b348015610deb57600080fd5b50610455610dfa3660046161a6565b615044565b348015610e0b57600080fd5b5060065461052d565b348015610e2057600080fd5b506001546104ac906001600160a01b031681565b348015610e4057600080fd5b5061052d610e4f366004615c3b565b6150f8565b348015610e6057600080fd5b5061057b610e6f366004615e38565b615129565b6000546001600160a01b03163314610ea75760405162461bcd60e51b8152600401610e9e906161dd565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610ee957610ee9615c54565b1415610fe157600354600554610eff9042616235565b1015610f615760405162461bcd60e51b815260206004820152602b60248201527f546865206d696e696d616c207374616b696e672074696d6520686173206e6f7460448201526a081c185cdcd959081e595d60aa1b6064820152608401610e9e565b600954610fc55760405162461bcd60e51b815260206004820152602c60248201527f546865726520617265206e6f2064697370757465206b6974207768696368206e60448201526b65656420667265657a696e6760a01b6064820152608401610e9e565b6002805460ff60a01b1916600160a01b1790554360065561143c565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561101c57600080fd5b505afa158015611030573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611054919061624c565b60095490915060009061106990600190616269565b90505b6000811261142c57600060098281548110611089576110896162a8565b9060005260206000200154905060006008600984815481106110ad576110ad6162a8565b9060005260206000200154815481106110c8576110c86162a8565b60009182526020909120600260049092020101546001600160a01b031690508380156111625750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561112857600080fd5b505afa15801561113c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611160919061624c565b155b1561124c57806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156111a257600080fd5b505af11580156111b6573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b1580156111f357600080fd5b505afa158015611207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122b919061624c565b6112475760405162461bcd60e51b8152600401610e9e906162be565b611419565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561128557600080fd5b505afa158015611299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112bd919061624c565b6112d95760405162461bcd60e51b8152600401610e9e906162be565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561131257600080fd5b505afa158015611326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134a919061630d565b61141957600060088381548110611363576113636162a8565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b1990921691909117905560095461139f90600190616269565b8312156113f157600980546113b690600190616235565b815481106113c6576113c66162a8565b9060005260206000200154600984815481106113e4576113e46162a8565b6000918252602090912001555b600980548061140257611402616326565b600190038181906000526020600020016000905590555b5050806114259061633c565b905061106c565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161147d91600160a01b90910460ff1690616061565b60405180910390a1565b6000546001600160a01b031633146114b15760405162461bcd60e51b8152600401610e9e906161dd565b60006007846001600160601b0316815481106114cf576114cf6162a8565b90600052602060002090600b0201905060005b835181101561177857821561160f576000848281518110611505576115056162a8565b60200260200101511180156115365750600854845185908390811061152c5761152c6162a8565b6020026020010151105b6115735760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610e9e565b600182600a01600086848151811061158d5761158d6162a8565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055508381815181106115cc576115cc6162a8565b6020026020010151856001600160601b03167fd64105c77264bc0916356e533ac7fe93408b57128cc16819a4079e69369efc5a60405160405180910390a3611766565b6001856001600160601b0316148015611665575060006008858381518110611639576116396162a8565b602002602001015181548110611651576116516162a8565b906000526020600020906004020160000154145b156116ce5760405162461bcd60e51b815260206004820152603360248201527f43616e27742072656d6f766520726f6f7420444b20737570706f72742066726f6044820152721b481d1a194819d95b995c985b0818dbdd5c9d606a1b6064820152608401610e9e565b600082600a0160008684815181106116e8576116e86162a8565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908315150217905550838181518110611727576117276162a8565b6020026020010151856001600160601b03167f73607cee0f079da3d86ea5a962393fde9082aa0137009e4ba163d5dec19b5d2560405160405180910390a35b806117708161635a565b9150506114e2565b5050505050565b6008818154811061178f57600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106117dd576117dd6162a8565b600091825260208220600490910201805460078054929450916001600160601b03909116908110611810576118106162a8565b6000918252602082206003850154600b90920201925061183290600190616235565b9050600083600301828154811061184b5761184b6162a8565b6000918252602082206007909102019150600185015460ff16600481111561187557611875615c54565b14156119f65760008211806118c757506001840154600684019060ff1660048111156118a3576118a3615c54565b600481106118b3576118b36162a8565b015460028501546118c49042616235565b10155b6119475760405162461bcd60e51b8152602060048201526044602482018190527f5468652065766964656e636520706572696f642074696d6520686173206e6f74908201527f207061737365642079657420616e64206974206973206e6f7420616e2061707060648201526332b0b61760e11b608482015260a401610e9e565b60038101546006820154146119b05760405162461bcd60e51b815260206004820152602960248201527f546865206469737075746520686173206e6f742066696e6973686564206472616044820152683bb4b733903cb2ba1760b91b6064820152608401610e9e565b8254600160601b900460ff166119c75760026119ca565b60015b60018086018054909160ff19909116908360048111156119ec576119ec615c54565b0217905550611e82565b60018085015460ff166004811115611a1057611a10615c54565b1415611b74576001840154600684019060ff166004811115611a3457611a34615c54565b60048110611a4457611a446162a8565b01546002850154611a559042616235565b101580611afe57506008816000015481548110611a7457611a746162a8565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b158015611ac657600080fd5b505afa158015611ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afe919061624c565b611b5d5760405162461bcd60e51b815260206004820152602a60248201527f54686520636f6d6d697420706572696f642074696d6520686173206e6f74207060448201526930b9b9b2b2103cb2ba1760b11b6064820152608401610e9e565b6001808501805460029260ff1990911690836119ec565b6002600185015460ff166004811115611b8f57611b8f615c54565b1415611d2e576001840154600684019060ff166004811115611bb357611bb3615c54565b60048110611bc357611bc36162a8565b01546002850154611bd49042616235565b101580611c7d57506008816000015481548110611bf357611bf36162a8565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b158015611c4557600080fd5b505afa158015611c59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7d919061624c565b611cd95760405162461bcd60e51b815260206004820152602760248201527f54686520766f746520706572696f642074696d6520686173206e6f74207061736044820152661cd959081e595d60ca1b6064820152608401610e9e565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611e82565b6003600185015460ff166004811115611d4957611d49615c54565b1415611e06576001840154600684019060ff166004811115611d6d57611d6d615c54565b60048110611d7d57611d7d6162a8565b01546002850154611d8e9042616235565b1015611def5760405162461bcd60e51b815260206004820152602a60248201527f5468652061707065616c20706572696f642074696d6520686173206e6f74207060448201526930b9b9b2b2103cb2ba1760b11b6064820152608401610e9e565b6001808501805460049260ff1990911690836119ec565b6004600185015460ff166004811115611e2157611e21615c54565b1415611e825760405162461bcd60e51b815260206004820152602a60248201527f546865206469737075746520697320616c726561647920696e20746865206c6160448201526939ba103832b934b7b21760b11b6064820152608401610e9e565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611ec19160ff1690615c7e565b60405180910390a25050505050565b600080600a8381548110611ee657611ee66162a8565b6000918252602082206003600490920201908101805491935090611f0c90600190616235565b81548110611f1c57611f1c6162a8565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611f4f57611f4f6162a8565b90600052602060002090600b02019050806005015482600301541015611f7a57506000949350505050565b80546007805490916001600160601b0316908110611f9a57611f9a6162a8565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600a8381548110611fdd57611fdd6162a8565b600091825260208220600360049092020190810180549193509061200390600190616235565b81548110612013576120136162a8565b906000526020600020906007020190506000600882600001548154811061203c5761203c6162a8565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018790526001600160a01b031691508190631c3db16d9060240160206040518083038186803b15801561209157600080fd5b505afa1580156120a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c9919061630d565b95945050505050565b600781815481106120e257600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000600a828154811061213e5761213e6162a8565b600091825260209091206001600490920201015460ff1692915050565b6000828152600c6020526040812060020180548390811061217e5761217e6162a8565b906000526020600020015490505b92915050565b6000546001600160a01b031633146121bc5760405162461bcd60e51b8152600401610e9e906161dd565b8660078a6001600160601b0316815481106121d9576121d96162a8565b90600052602060002090600b020160020154111561226f5760405162461bcd60e51b815260206004820152604760248201527f4120737562636f7572742063616e6e6f742062652061206368696c64206f662060448201527f6120737562636f7572742077697468206120686967686572206d696e696d756d6064820152661039ba30b5b29760c91b608482015260a401610e9e565b60008151116122c05760405162461bcd60e51b815260206004820152601c60248201527f4d75737420737570706f7274206174206c65617374206f6e6520444b000000006044820152606401610e9e565b6001600160601b0389166123225760405162461bcd60e51b8152602060048201526024808201527f43616e2774206861766520466f726b696e6720636f75727420617320612070616044820152631c995b9d60e21b6064820152608401610e9e565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b835181101561243f576000848281518110612377576123776162a8565b60200260200101511180156123a85750600854845185908390811061239e5761239e6162a8565b6020026020010151105b6123e55760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610e9e565b600182600a0160008684815181106123ff576123ff6162a8565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806124379061635a565b91505061235a565b5080546bffffffffffffffffffffffff19166001600160601b038c16178155604080516000815260208101918290525161247d916001840191615a01565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556124c09060068301908790615a4c565b5060405163483abc4f60e11b8152600c600482015260248101839052604481018590527348ce286978C74c288eA6Bc9a536BcC899DF8D17790639075789e9060640160006040518083038186803b15801561251a57600080fd5b505af415801561252e573d6000803e3d6000fd5b5050505060078b6001600160601b03168154811061254e5761254e6162a8565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907ffbf60f92e3c38b643d7205bd6bacfdeb2bfb72f63294a2e646f8d2f18462ee24906125bd908e908e908e908e908e908e908e908e90616375565b60405180910390a35050505050505050505050565b6000600a84815481106125e7576125e76162a8565b600091825260209091206004918202019150600182015460ff16600481111561261257612612615c54565b1461265f5760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520657865637574696f6e20706572696f642e00000000006044820152606401610e9e565b6000816003018481548110612676576126766162a8565b906000526020600020906007020190506000600882600001548154811061269f5761269f6162a8565b60009182526020822060049182020160020154908401546001600160a01b0390911692506126ce9086906163cd565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b15801561272757600080fd5b505afa15801561273b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275f919061630d565b90506000808261277a5783861115612775578395505b61279a565b6127858460026163e5565b86111561279a576127978460026163e5565b95505b60048801545b86811015612e635784811015612bd857604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b1580156127fe57600080fd5b505afa158015612812573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612836919061630d565b91506127108211156128485761271091505b60006127106128578482616235565b8b6001015461286691906163e5565b612870919061641a565b905061287c81886163cd565b9650896006018281548110612893576128936162a8565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b031685526002019092529082208054919650839290916128e0908490616235565b90915550508a546007805483926001600160601b0316908110612905576129056162a8565b90600052602060002090600b02016002015461292191906163cd565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b03168452600101909152902054106129b5576001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152812054612993908390616235565b8c549091506129ae9086906001600160601b03168385615171565b5050612a06565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b0316845260010190915290205415612a06578a54612a049085906001600160601b0316600084615171565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b158015612a5457600080fd5b505afa158015612a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8c919061624c565b612b295760005b6001600160a01b0385166000908152600b6020526040902054811015612b27576001600160a01b0385166000908152600b602052604090208054612b1491879184908110612ae357612ae36162a8565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316600080615171565b5080612b1f8161635a565b915050612a93565b505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e19612b5e8461642e565b60408051918252600060208301520160405180910390a3612b80600187616235565b821415612bd25784612bd2576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f15050600054612bd093506001600160a01b0316915089905061578b565b505b50612e51565b6001600160a01b038816634fe264fb8e8e612bf3898661644b565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b158015612c3757600080fd5b505afa158015612c4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c6f919061630d565b9150612710821115612c815761271091505b60068901612c8f868361644b565b81548110612c9f57612c9f6162a8565b60009182526020909120015460018a01546001600160a01b03909116935061271090612ccc9084906163e5565b612cd6919061641a565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b0316845260020190915281208054909190612d16908490616235565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b03168452600101909152902054612d7e576000612710838b60010154612d6591906163e5565b612d6f919061641a565b9050612d7b848261578b565b50505b600061271083612d8e878a61641a565b612d9891906163e5565b612da2919061641a565b9050600061271084878d60020154612dba919061641a565b612dc491906163e5565b612dce919061641a565b9050612dda858361578b565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e198484604051612e46929190918252602082015260400190565b60405180910390a350505b80612e5b8161635a565b9150506127a0565b5084886005015414612e7757600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff166001811115612ea957612ea9615c54565b14612ef65760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520696e205374616b696e672070686173652e00000000006044820152606401610e9e565b6000600e54600183600f54612f0b91906163cd565b612f159190616235565b11612f205781612f3b565b600f54600e54612f309190616235565b612f3b9060016163cd565b9050600081600f54612f4d91906163cd565b600f549091505b81811015612fcc576000818152600d60205260409020805460018201546002830154612f9c926001600160a01b03811692600160a01b9091046001600160601b031691615171565b50506000818152600d60205260408120818155600181018290556002015580612fc48161635a565b915050612f54565b50600f555050565b612fdc615a79565b60006007836001600160601b031681548110612ffa57612ffa6162a8565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b815481526020019060010190808311613025575050505050915050919050565b6000546001600160a01b0316331461306f5760405162461bcd60e51b8152600401610e9e906161dd565b6001826001600160601b031614806130e2575080600780846001600160601b0316815481106130a0576130a06162a8565b60009182526020909120600b909102015481546001600160601b039091169081106130cd576130cd6162a8565b90600052602060002090600b02016002015411155b6130eb57600080fd5b60005b6007836001600160601b03168154811061310a5761310a6162a8565b90600052602060002090600b02016001018054905081101561322b5781600780856001600160601b031681548110613144576131446162a8565b90600052602060002090600b02016001018381548110613166576131666162a8565b906000526020600020015481548110613181576131816162a8565b90600052602060002090600b02016002015410156132195760405162461bcd60e51b815260206004820152604960248201527f4120737562636f7572742063616e6e6f742062652074686520706172656e742060448201527f6f66206120737562636f75727420776974682061206c6f776572206d696e696d6064820152683ab69039ba30b5b29760b91b608482015260a401610e9e565b806132238161635a565b9150506130ee565b50806007836001600160601b031681548110613249576132496162a8565b90600052602060002090600b020160020181905550816001600160601b03166000805160206165338339815191526040516132a0906020808252600890820152676d696e5374616b6560c01b604082015260600190565b60405180910390a25050565b6060600882815481106132c1576132c16162a8565b906000526020600020906004020160010180548060200260200160405190810160405280929190818152602001828054801561331c57602002820191906000526020600020905b815481526020019060010190808311613308575b50505050509050919050565b6000600a828154811061333d5761333d6162a8565b6000918252602090912060049091020160010154610100900460ff1692915050565b600a818154811061336f57600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b6000546001600160a01b031633146133e55760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b031681548110613402576134026162a8565b90600052602060002090600b0201600601906004613421929190615a4c565b50816001600160601b03166000805160206165338339815191526040516132a0906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b6000546001600160a01b031633146134945760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b0316815481106134b1576134b16162a8565b90600052602060002090600b020160040181905550816001600160601b03166000805160206165338339815191526040516132a0906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b600080600a8381548110613521576135216162a8565b600091825260208220600360049092020190810180549193509061354790600190616235565b81548110613557576135576162a8565b600091825260208220845460078054938102909201945090916001600160601b0390911690811061358a5761358a6162a8565b90600052602060002090600b0201905080600501548260030154106136295782546001600160601b0316600114156135cb576001600160ff1b039350613653565b60038201546135db9060026163e5565b6135e69060016163cd565b81546007805490916001600160601b0316908110613606576136066162a8565b90600052602060002090600b02016004015461362291906163e5565b9350613653565b60038201546136399060026163e5565b6136449060016163cd565b81600401546120c991906163e5565b505050919050565b6000546001600160a01b031633146136855760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b0316815481106136a2576136a26162a8565b90600052602060002090600b020160030181905550816001600160601b03166000805160206165338339815191526040516132a090602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b031633146137205760405162461bcd60e51b8152600401610e9e906161dd565b6000836001600160a01b0316838360405161373b919061648b565b60006040518083038185875af1925050503d8060008114613778576040519150601f19603f3d011682016040523d82523d6000602084013e61377d565b606091505b50509050806137c25760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610e9e565b50505050565b6137d53383836000615171565b6138125760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610e9e565b5050565b6000546001600160a01b031633146138405760405162461bcd60e51b8152600401610e9e906161dd565b600355565b6000806000806060600080600a8981548110613863576138636162a8565b90600052602060002090600402019050600081600301898154811061388a5761388a6162a8565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561390c57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116138ee575b5050505050915097509750975097509750975050509295509295509295565b6000600a8281548110613940576139406162a8565b600091825260209091206004918202019150600182015460ff16600481111561396b5761396b615c54565b146139b85760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520657865637574696f6e20706572696f642e00000000006044820152606401610e9e565b6001810154610100900460ff1615613a125760405162461bcd60e51b815260206004820152601860248201527f52756c696e6720616c72656164792065786563757465642e00000000000000006044820152606401610e9e565b6000613a1d83611fc7565b60018301805461ff001916610100179055825460405163188d362b60e11b815260048101869052602481018390529192506001600160a01b03600160601b909104169063311a6c5690604401600060405180830381600087803b158015613a8357600080fd5b505af1158015613a97573d6000803e3d6000fd5b50505050505050565b60098181548110613ab057600080fd5b600091825260209091200154905081565b6000806000600a8481548110613ad957613ad96162a8565b6000918252602082206003600490920201908101805491935090613aff90600190616235565b81548110613b0f57613b0f6162a8565b906000526020600020906007020190506008816000015481548110613b3657613b366162a8565b6000918252602090912060049182020160020154604051639b05c26160e01b81529182018790526001600160a01b031690639b05c26190602401604080518083038186803b158015613b8757600080fd5b505afa158015613b9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bbf91906164a7565b90969095509350505050565b6000546001600160a01b03163314613bf55760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b031681548110613c1257613c126162a8565b90600052602060002090600b020160050181905550816001600160601b03166000805160206165338339815191526040516132a09060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a8481548110613c8b57613c8b6162a8565b6000918252602090912060049091020190506003600182015460ff166004811115613cb857613cb8615c54565b1415613d11576002810154815460078054929550916001600160601b03909116908110613ce757613ce76162a8565b600091825260209091206009600b9092020101546002820154613d0a91906163cd565b9150613d1a565b60009250600091505b50915091565b6000546001600160a01b03163314613d4a5760405162461bcd60e51b8152600401610e9e906161dd565b600455565b60006001600254600160a01b900460ff166001811115613d7157613d71615c54565b148015613d8c5750600454600554613d899042616235565b10155b905090565b6000613d9c82614ff0565b341015613dfd5760405162461bcd60e51b815260206004820152602960248201527f4e6f7420656e6f7567682045544820746f20636f76657220617262697472617460448201526834b7b71031b7b9ba1760b91b6064820152608401610e9e565b600080613e0984615857565b92505091506007826001600160601b031681548110613e2a57613e2a6162a8565b60009182526020808320848452600a600b90930201919091019052604090205460ff16613eb35760405162461bcd60e51b815260206004820152603160248201527f5468652064697370757465206b6974206973206e6f7420737570706f7274656460448201527008189e481d1a1a5cc81cdd5898dbdd5c9d607a1b6064820152608401610e9e565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa909101556008805492965090929184908110613f3e57613f3e6162a8565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b03909116908110613f7f57613f7f6162a8565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613fbe903461641a565b600380830191909155858255820154600283015461271091613fdf916163e5565b613fe9919061641a565b60018201553460028201556008805486908110614008576140086162a8565b906000526020600020906004020160020160149054906101000a900460ff1661409f57600160088681548110614040576140406162a8565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede540916140d4918b918e918e916004016164cc565b600060405180830381600087803b1580156140ee57600080fd5b505af1158015614102573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b031633146141695760405162461bcd60e51b8152600401610e9e906161dd565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6141948361350b565b3410156141ef5760405162461bcd60e51b8152602060048201526024808201527f4e6f7420656e6f7567682045544820746f20636f7665722061707065616c206360448201526337b9ba1760e11b6064820152608401610e9e565b6000600a8481548110614204576142046162a8565b6000918252602090912060049091020190506003600182015460ff16600481111561423157614231615c54565b1461427e5760405162461bcd60e51b815260206004820152601a60248201527f44697370757465206973206e6f742061707065616c61626c652e0000000000006044820152606401610e9e565b6003810180546000919061429490600190616235565b815481106142a4576142a46162a8565b9060005260206000209060070201905060088160000154815481106142cb576142cb6162a8565b60009182526020909120600490910201600201546001600160a01b031633146143445760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2044697370757465204b69742060448201526437b7363c9760d91b6064820152608401610e9e565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019183908110614385576143856162a8565b90600052602060002090600b020160050154846003015410614589576007836001600160601b0316815481106143bd576143bd6162a8565b600091825260208220600b90910201546001600160601b031693505b600a8110156144ce576007846001600160601b0316815481106143fe576143fe6162a8565b60009182526020808320868452600a600b90930201919091019052604090205460ff161561442b576144ce565b600060088481548110614440576144406162a8565b90600052602060002090600402016000015414614483576008838154811061446a5761446a6162a8565b90600052602060002090600402016000015492506144bc565b6007846001600160601b03168154811061449f5761449f6162a8565b60009182526020909120600b90910201546001600160601b031693505b806144c68161635a565b9150506143d9565b506007836001600160601b0316815481106144eb576144eb6162a8565b60009182526020808320858452600a600b90930201919091019052604090205460ff1661451757600192505b84546001600160601b0384811691161461458957845460038601546001600160601b039091169061454a90600190616235565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546bffffffffffffffffffffffff19166001600160601b038416908117865560018601805460ff19169055426002870155600780546000929081106145d1576145d16162a8565b90600052602060002090600b020190508060040154346145f1919061641a565b82600301819055506127108160030154826002015461461091906163e5565b61461a919061641a565b6001830155346002830155828255600880548490811061463c5761463c6162a8565b906000526020600020906004020160020160149054906101000a900460ff166146d357600160088481548110614674576146746162a8565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b84548254146147b957845460038701546146ef90600190616235565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a4600882600001548154811061473d5761473d6162a8565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede54092614786928e928e928e9291016164cc565b600060405180830381600087803b1580156147a057600080fd5b505af11580156147b4573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516148299190615c7e565b60405180910390a2505050505050505050565b600080600a8381548110614852576148526162a8565b90600052602060002090600402019050806003016001826003018054905061487a9190616235565b8154811061488a5761488a6162a8565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff1660018111156148c4576148c4615c54565b146149005760405162461bcd60e51b815260206004820152600c60248201526b2bb937b73390383430b9b29760a11b6044820152606401610e9e565b6000600a8381548110614915576149156162a8565b9060005260206000209060040201905060006001826003018054905061493b9190616235565b90506000826003018281548110614954576149546162a8565b6000918252602082206007909102019150600184015460ff16600481111561497e5761497e615c54565b146149cb5760405162461bcd60e51b815260206004820152601a60248201527f53686f756c642062652065766964656e636520706572696f642e0000000000006044820152606401610e9e565b600060088260000154815481106149e4576149e46162a8565b60009182526020822060026004909202010154600684015460038501546001600160a01b0390921693509190614a1a88846163cd565b1115614a2a578360030154614a34565b614a3487836163cd565b9050815b81811015614b9a57604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b158015614a8557600080fd5b505af1158015614a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614abd9190616515565b90506001600160a01b03811615614b875760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614b139084906163cd565b909155505060068601805460018101825560009182526020918290200180546001600160a01b0319166001600160a01b038416908117909155604080518a81529283018590528c927f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a35b5080614b928161635a565b915050614a38565b505050505050505050565b6000818152600c60209081526040918290208054600182018054855181860281018601909652808652919460609485949391929190830182828015614c0957602002820191906000526020600020905b815481526020019060010190808311614bf5575b5050505050925080600201805480602002602001604051908101604052809291908181526020018280548015614c5e57602002820191906000526020600020905b815481526020019060010190808311614c4a575b50505050509150509193909250565b600060078281548110614c8257614c826162a8565b60009182526020909120600b9091020154600160601b900460ff1692915050565b60606009805480602002602001604051908101604052809291908181526020018280548015614cf157602002820191906000526020600020905b815481526020019060010190808311614cdd575b5050505050905090565b6000546001600160a01b03163314614d255760405162461bcd60e51b8152600401610e9e906161dd565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314614d715760405162461bcd60e51b8152600401610e9e906161dd565b600854808210614dba5760405162461bcd60e51b815260206004820152601460248201527314185c995b9d08191bd95cdb89dd08195e1a5cdd60621b6044820152606401610e9e565b600082614e0a5760016007600181548110614dd757614dd76162a8565b60009182526020808320868452600b92909202909101600a01905260409020805460ff1916911515919091179055614e85565b60088381548110614e1d57614e1d6162a8565b9060005260206000209060040201600301546001614e3b91906163cd565b9050600a8110614e855760405162461bcd60e51b8152602060048201526015602482015274088cae0e8d040d8caeccad840d2e640c2e840dac2f605b1b6044820152606401610e9e565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee381019182559151805193949193614f37937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee401929190910190615a01565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b03909316929092179190911790556080909101516003909101556008805484908110614f9157614f916162a8565b60009182526020808320600160049093020182018054928301815583529091200191909155505050565b6000600a8281548110614fd057614fd06162a8565b60009182526020909120600490910201546001600160601b031692915050565b6000806000614ffe84615857565b5091509150806007836001600160601b031681548110615020576150206162a8565b90600052602060002090600b02016004015461503c91906163e5565b949350505050565b6000546001600160a01b0316331461506e5760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b03168154811061508b5761508b6162a8565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b03166000805160206165338339815191526040516132a0906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b600080600a838154811061510e5761510e6162a8565b60009182526020909120600360049092020101549392505050565b60006007836001600160601b031681548110615147576151476162a8565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b60006001600160601b038416158061519357506007546001600160601b038516115b156151a05750600061503c565b6001600160a01b0385166000908152600b60205260408120906151c387876158db565b604051637521ccb160e01b8152600c60048201526001600160601b0388166024820152604481018290529091506000907348ce286978C74c288eA6Bc9a536BcC899DF8D17790637521ccb19060640160206040518083038186803b15801561522a57600080fd5b505af415801561523e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190615262919061630d565b905085156152f0576007876001600160601b031681548110615286576152866162a8565b90600052602060002090600b0201600201548610806152be57506001600160601b038716600090815260028401602052604090205486105b156152cf576000935050505061503c565b801580156152df57508254600411155b156152f0576000935050505061503c565b6000600254600160a01b900460ff16600181111561531057615310615c54565b146153bc576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e6000815461535b9061635a565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b03909316929092178255820151600180830191909155606090920151600290910155935061503c92505050565b6000818710615439576153cf8288616235565b90508015615427576153e2893083615923565b1561542c5781615427578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b61560e565b600094505050505061503c565b866155d6576001600160601b038816600090815260028501602052604090205486906154659084616235565b61546f9190616235565b9050801561542757615481898261578b565b1561542c5760005b84548110156155d057886001600160601b03168560000182815481106154b1576154b16162a8565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031614156155be57845485906154ee90600190616235565b815481106154fe576154fe6162a8565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b031685600001828154811061553c5761553c6162a8565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b031602179055508460000180548061558857615588616326565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a021916905590556155d0565b806155c88161635a565b915050615489565b5061560e565b856155e18884616235565b6155eb9190616235565b9050801561560e576155fd898261578b565b61560e57600094505050505061503c565b6001600160601b03881660009081526001850160205260408120548890615636908590616235565b61564091906163cd565b6001600160601b038a16600081815260018801602052604081208390559192505b8161572457604051631712e1c560e11b8152600c600482015260248101829052604481018b9052606481018790527348ce286978C74c288eA6Bc9a536BcC899DF8D17790632e25c38a9060840160006040518083038186803b1580156156c657600080fd5b505af41580156156da573d6000803e3d6000fd5b5050505060018114156156f05760019150615661565b60078181548110615703576157036162a8565b60009182526020909120600b90910201546001600160601b03169050615661565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600093849384939116916157eb919061648b565b6000604051808303816000865af19150503d8060008114615828576040519150601f19603f3d011682016040523d82523d6000602084013e61582d565b606091505b50915091508180156120c95750805115806120c95750808060200190518101906120c9919061624c565b600080600060408451106158c9575050506020810151604082015160608301516001600160601b038316158061589857506007546001600160601b03841610155b156158a257600192505b816158ac57600391505b8015806158bb57506008548110155b156158c4575060015b6158d4565b506001915060039050815b9193909250565b600060405160005b60148110156158fe578481600c011a818301536001016158e3565b5060145b602081101561591a5783811a81830153600101615902565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000938493849391169161598b919061648b565b6000604051808303816000865af19150503d80600081146159c8576040519150601f19603f3d011682016040523d82523d6000602084013e6159cd565b606091505b50915091508180156159f75750805115806159f75750808060200190518101906159f7919061624c565b9695505050505050565b828054828255906000526020600020908101928215615a3c579160200282015b82811115615a3c578251825591602001919060010190615a21565b50615a48929150615a97565b5090565b8260048101928215615a3c5791602002820182811115615a3c578251825591602001919060010190615a21565b60405180608001604052806004906020820280368337509192915050565b5b80821115615a485760008155600101615a98565b6001600160a01b0381168114615ac157600080fd5b50565b600060208284031215615ad657600080fd5b8135615ae181615aac565b9392505050565b80356001600160601b0381168114615aff57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715615b4357615b43615b04565b604052919050565b600082601f830112615b5c57600080fd5b8135602067ffffffffffffffff821115615b7857615b78615b04565b8160051b615b87828201615b1a565b9283528481018201928281019087851115615ba157600080fd5b83870192505b84831015615bc057823582529183019190830190615ba7565b979650505050505050565b8015158114615ac157600080fd5b600080600060608486031215615bee57600080fd5b615bf784615ae8565b9250602084013567ffffffffffffffff811115615c1357600080fd5b615c1f86828701615b4b565b9250506040840135615c3081615bcb565b809150509250925092565b600060208284031215615c4d57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60058110615c7a57615c7a615c54565b9052565b6020810161218c8284615c6a565b60008060408385031215615c9f57600080fd5b50508035926020909101359150565b600082601f830112615cbf57600080fd5b6040516080810181811067ffffffffffffffff82111715615ce257615ce2615b04565b604052806080840185811115615cf757600080fd5b845b81811015615d11578035835260209283019201615cf9565b509195945050505050565b60008060008060008060008060006101808a8c031215615d3b57600080fd5b615d448a615ae8565b985060208a0135615d5481615bcb565b975060408a0135965060608a0135955060808a0135945060a08a01359350615d7f8b60c08c01615cae565b92506101408a013591506101608a013567ffffffffffffffff811115615da457600080fd5b615db08c828d01615b4b565b9150509295985092959850929598565b600080600060608486031215615dd557600080fd5b505081359360208301359350604090920135919050565b600060208284031215615dfe57600080fd5b615ae182615ae8565b8060005b60048110156137c2578151845260209384019390910190600101615e0b565b6080810161218c8284615e07565b60008060408385031215615e4b57600080fd5b615e5483615ae8565b946020939093013593505050565b600081518084526020808501945080840160005b83811015615e9257815187529582019590820190600101615e76565b509495945050505050565b602081526000615ae16020830184615e62565b6001600160601b03861681526001600160a01b038516602082015260a08101615edc6040830186615c6a565b9215156060820152608001529392505050565b60008060a08385031215615f0257600080fd5b615f0b83615ae8565b9150615f1a8460208501615cae565b90509250929050565b600082601f830112615f3457600080fd5b813567ffffffffffffffff811115615f4e57615f4e615b04565b615f61601f8201601f1916602001615b1a565b818152846020838601011115615f7657600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215615fa857600080fd5b8335615fb381615aac565b925060208401359150604084013567ffffffffffffffff811115615fd657600080fd5b615fe286828701615f23565b9150509250925092565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b818110156160485784516001600160a01b031683529383019391830191600101616023565b50508093505050508260a0830152979650505050505050565b602081016002831061607557616075615c54565b91905290565b6000806040838503121561608e57600080fd5b82359150602083013567ffffffffffffffff8111156160ac57600080fd5b6160b885828601615f23565b9150509250929050565b6000806000606084860312156160d757600080fd5b8335925060208401359150604084013567ffffffffffffffff811115615fd657600080fd5b6000806040838503121561610f57600080fd5b823561611a81615aac565b9150615f1a60208401615ae8565b8381526060602082015260006161416060830185615e62565b82810360408401526159f78185615e62565b6000806040838503121561616657600080fd5b8235615e5481615aac565b60006020828403121561618357600080fd5b813567ffffffffffffffff81111561619a57600080fd5b61503c84828501615f23565b600080604083850312156161b957600080fd5b6161c283615ae8565b915060208301356161d281615bcb565b809150509250929050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000828210156162475761624761621f565b500390565b60006020828403121561625e57600080fd5b8151615ae181615bcb565b60008083128015600160ff1b8501841216156162875761628761621f565b6001600160ff1b03840183138116156162a2576162a261621f565b50500390565b634e487b7160e01b600052603260045260246000fd5b6020808252602f908201527f412064697370757465206b697420686173206e6f742070617373656420746f2060408201526e5265736f6c76696e6720706861736560881b606082015260800190565b60006020828403121561631f57600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b8214156163525761635261621f565b506000190190565b600060001982141561636e5761636e61621f565b5060010190565b60006101608a151583528960208401528860408401528760608401528660808401526163a460a0840187615e07565b84610120840152806101408401526163be81840185615e62565b9b9a5050505050505050505050565b600082198211156163e0576163e061621f565b500190565b60008160001904831182151516156163ff576163ff61621f565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261642957616429616404565b500490565b6000600160ff1b8214156164445761644461621f565b5060000390565b60008261645a5761645a616404565b500690565b60005b8381101561647a578181015183820152602001616462565b838111156137c25750506000910152565b6000825161649d81846020870161645f565b9190910192915050565b600080604083850312156164ba57600080fd5b8251915060208301516161d281615bcb565b84815283602082015260806040820152600083518060808401526164f78160a085016020880161645f565b606083019390935250601f91909101601f19160160a0019392505050565b60006020828403121561652757600080fd5b8151615ae181615aac56fe8f4ab3272f699ef825c5008ac66b1b213bfab7b8f730599d1deeaf4e048dc922a264697066735822122074bec8c99f0d37eab91640b145df87385a966b1495ccf21b84e1b6403133415764736f6c63430008090033", - "deployedBytecode": "0x6080604052600436106104305760003560e01c80638a9bb02a11610229578063c71f42531161012e578063eaff425a116100b6578063f8bdb57b1161007a578063f8bdb57b14610ddf578063fa41488014610dff578063fbf405b014610e14578063fc6f8f1614610e34578063fe524c3914610e5457600080fd5b8063eaff425a14610ce1578063f12ada8b14610cf6578063f6a6ef7a14610d16578063f6b4d82d14610d36578063f7434ea914610dbf57600080fd5b8063d2d514e0116100fd578063d2d514e014610c21578063d578cbac14610c50578063d8b03fd814610c70578063de1a1e5914610c85578063e4c0aaf414610cc157600080fd5b8063c71f425314610b64578063cf0c38f814610b84578063d1c1df4814610ba4578063d2b8035a14610c0157600080fd5b8063b31b4540116101b1578063bd8193bb11610180578063bd8193bb14610adb578063c057eca714610b08578063c13517e114610b1e578063c258bb1914610b31578063c356990214610b5157600080fd5b8063b31b454014610a85578063b4a6160814610a9b578063b70c4e9414610ab0578063b888adfa14610ac557600080fd5b8063a57366e7116101f8578063a57366e7146109b2578063a9b713af146109d2578063afe15cfb14610a02578063b1c9fe6e14610a37578063b2866af714610a6557600080fd5b80638a9bb02a1461090b5780638bb048751461093d5780638edf47411461095d5780639b05c2611461097d57600080fd5b806335975f4a1161033a57806359354c77116102c25780636c1eb1b9116102865780636c1eb1b91461087b578063751accd0146108905780637717a6e8146108b0578063823cfd70146108d0578063840bc19c146108f057600080fd5b806359354c771461080657806359ec827e146108265780635bc24dd3146108465780635ea5c038146108665780636235593f1461064457600080fd5b806343d4137f1161030957806343d4137f146107525780634b7fcda21461077f578063564a565d1461079f57806356acb050146107d057806357260364146107e657600080fd5b806335975f4a146106cf5780633a157860146106ef5780633cfd1184146107055780633e1d09be1461073257600080fd5b80631f5a0dd2116103bd5780632922d6041161038c5780632922d604146106595780632b6a63f1146106795780632d29a47b146106995780632ea7b4d0146106b957806334d5fb311461060257600080fd5b80631f5a0dd2146105ab5780632256aaf31461060257806322684db01461061757806327e6ec8a1461064457600080fd5b80630d1b9d1a116104045780630d1b9d1a146104c95780630e083ec914610517578063115d53761461053b57806319b815291461055b5780631c3db16d1461058b57600080fd5b8062f5822c146104355780630b274f2e146104575780630b7414bc1461046c5780630c340a241461048c575b600080fd5b34801561044157600080fd5b50610455610450366004615ac4565b610e74565b005b34801561046357600080fd5b50610455610ec9565b34801561047857600080fd5b50610455610487366004615bd9565b611487565b34801561049857600080fd5b506000546104ac906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156104d557600080fd5b506104e96104e4366004615c3b565b61177f565b604080519485526001600160a01b0390931660208501529015159183019190915260608201526080016104c0565b34801561052357600080fd5b5061052d600e5481565b6040519081526020016104c0565b34801561054757600080fd5b50610455610556366004615c3b565b6117c8565b34801561056757600080fd5b5061057b610576366004615c3b565b611ed0565b60405190151581526020016104c0565b34801561059757600080fd5b5061052d6105a6366004615c3b565b611fc7565b3480156105b757600080fd5b506105cb6105c6366004615c3b565b6120d2565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c0016104c0565b34801561060e57600080fd5b5061052d600181565b34801561062357600080fd5b50610637610632366004615c3b565b612129565b6040516104c09190615c7e565b34801561065057600080fd5b5061052d600081565b34801561066557600080fd5b5061052d610674366004615c8c565b61215b565b34801561068557600080fd5b50610455610694366004615d1c565b612192565b3480156106a557600080fd5b506104556106b4366004615dc0565b6125d2565b3480156106c557600080fd5b5061052d61271081565b3480156106db57600080fd5b506104556106ea366004615c3b565b612e89565b3480156106fb57600080fd5b5061052d60065481565b34801561071157600080fd5b50610725610720366004615dec565b612fd4565b6040516104c09190615e2a565b34801561073e57600080fd5b5061045561074d366004615e38565b613045565b34801561075e57600080fd5b5061077261076d366004615c3b565b6132ac565b6040516104c09190615e9d565b34801561078b57600080fd5b5061057b61079a366004615c3b565b613328565b3480156107ab57600080fd5b506107bf6107ba366004615c3b565b61335f565b6040516104c0959493929190615eb0565b3480156107dc57600080fd5b5061052d600f5481565b3480156107f257600080fd5b50610455610801366004615eef565b6133bb565b34801561081257600080fd5b50610455610821366004615e38565b61346a565b34801561083257600080fd5b5061052d610841366004615c3b565b61350b565b34801561085257600080fd5b50610455610861366004615e38565b61365b565b34801561087257600080fd5b5060085461052d565b34801561088757600080fd5b5061052d600a81565b34801561089c57600080fd5b506104556108ab366004615f93565b6136f6565b3480156108bc57600080fd5b506104556108cb366004615e38565b6137c8565b3480156108dc57600080fd5b506104556108eb366004615c3b565b613816565b3480156108fc57600080fd5b5061052d6001600160ff1b0381565b34801561091757600080fd5b5061092b610926366004615c8c565b613845565b6040516104c096959493929190615fec565b34801561094957600080fd5b50610455610958366004615c3b565b61392b565b34801561096957600080fd5b5061052d610978366004615c3b565b613aa0565b34801561098957600080fd5b5061099d610998366004615c3b565b613ac1565b604080519283529015156020830152016104c0565b3480156109be57600080fd5b506104556109cd366004615e38565b613bcb565b3480156109de57600080fd5b5061052d6109ed366004615c3b565b6000908152600c602052604090206002015490565b348015610a0e57600080fd5b50610a22610a1d366004615c3b565b613c73565b604080519283526020830191909152016104c0565b348015610a4357600080fd5b50600254610a5890600160a01b900460ff1681565b6040516104c09190616061565b348015610a7157600080fd5b50610455610a80366004615c3b565b613d20565b348015610a9157600080fd5b5061052d60045481565b348015610aa757600080fd5b5061052d600481565b348015610abc57600080fd5b5061057b613d4f565b348015610ad157600080fd5b5061052d60055481565b348015610ae757600080fd5b5061052d610af6366004615c3b565b6000908152600c602052604090205490565b348015610b1457600080fd5b5061052d60035481565b61052d610b2c36600461607b565b613d91565b348015610b3d57600080fd5b50610455610b4c366004615ac4565b61413f565b610455610b5f3660046160c2565b61418b565b348015610b7057600080fd5b5061052d610b7f366004615c3b565b61483c565b348015610b9057600080fd5b506002546104ac906001600160a01b031681565b348015610bb057600080fd5b50610a22610bbf3660046160fc565b6001600160a01b039091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610c0d57600080fd5b50610455610c1c366004615c8c565b6148a4565b348015610c2d57600080fd5b50610c41610c3c366004615c3b565b614ba5565b6040516104c093929190616128565b348015610c5c57600080fd5b5061057b610c6b366004615c3b565b614c6d565b348015610c7c57600080fd5b50610772614ca3565b348015610c9157600080fd5b5061052d610ca0366004615c8c565b6000918252600c602090815260408084209284526004909201905290205490565b348015610ccd57600080fd5b50610455610cdc366004615ac4565b614cfb565b348015610ced57600080fd5b5061052d600381565b348015610d0257600080fd5b50610455610d11366004616153565b614d47565b348015610d2257600080fd5b5061052d610d31366004615c3b565b614fbb565b348015610d4257600080fd5b50610d8d610d51366004615c3b565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b0390931660208501529183015260608201526080016104c0565b348015610dcb57600080fd5b5061052d610dda366004616171565b614ff0565b348015610deb57600080fd5b50610455610dfa3660046161a6565b615044565b348015610e0b57600080fd5b5060065461052d565b348015610e2057600080fd5b506001546104ac906001600160a01b031681565b348015610e4057600080fd5b5061052d610e4f366004615c3b565b6150f8565b348015610e6057600080fd5b5061057b610e6f366004615e38565b615129565b6000546001600160a01b03163314610ea75760405162461bcd60e51b8152600401610e9e906161dd565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610ee957610ee9615c54565b1415610fe157600354600554610eff9042616235565b1015610f615760405162461bcd60e51b815260206004820152602b60248201527f546865206d696e696d616c207374616b696e672074696d6520686173206e6f7460448201526a081c185cdcd959081e595d60aa1b6064820152608401610e9e565b600954610fc55760405162461bcd60e51b815260206004820152602c60248201527f546865726520617265206e6f2064697370757465206b6974207768696368206e60448201526b65656420667265657a696e6760a01b6064820152608401610e9e565b6002805460ff60a01b1916600160a01b1790554360065561143c565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b15801561101c57600080fd5b505afa158015611030573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611054919061624c565b60095490915060009061106990600190616269565b90505b6000811261142c57600060098281548110611089576110896162a8565b9060005260206000200154905060006008600984815481106110ad576110ad6162a8565b9060005260206000200154815481106110c8576110c86162a8565b60009182526020909120600260049092020101546001600160a01b031690508380156111625750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561112857600080fd5b505afa15801561113c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611160919061624c565b155b1561124c57806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b1580156111a257600080fd5b505af11580156111b6573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b1580156111f357600080fd5b505afa158015611207573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061122b919061624c565b6112475760405162461bcd60e51b8152600401610e9e906162be565b611419565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561128557600080fd5b505afa158015611299573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112bd919061624c565b6112d95760405162461bcd60e51b8152600401610e9e906162be565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561131257600080fd5b505afa158015611326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134a919061630d565b61141957600060088381548110611363576113636162a8565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b1990921691909117905560095461139f90600190616269565b8312156113f157600980546113b690600190616235565b815481106113c6576113c66162a8565b9060005260206000200154600984815481106113e4576113e46162a8565b6000918252602090912001555b600980548061140257611402616326565b600190038181906000526020600020016000905590555b5050806114259061633c565b905061106c565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161147d91600160a01b90910460ff1690616061565b60405180910390a1565b6000546001600160a01b031633146114b15760405162461bcd60e51b8152600401610e9e906161dd565b60006007846001600160601b0316815481106114cf576114cf6162a8565b90600052602060002090600b0201905060005b835181101561177857821561160f576000848281518110611505576115056162a8565b60200260200101511180156115365750600854845185908390811061152c5761152c6162a8565b6020026020010151105b6115735760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610e9e565b600182600a01600086848151811061158d5761158d6162a8565b6020026020010151815260200190815260200160002060006101000a81548160ff0219169083151502179055508381815181106115cc576115cc6162a8565b6020026020010151856001600160601b03167fd64105c77264bc0916356e533ac7fe93408b57128cc16819a4079e69369efc5a60405160405180910390a3611766565b6001856001600160601b0316148015611665575060006008858381518110611639576116396162a8565b602002602001015181548110611651576116516162a8565b906000526020600020906004020160000154145b156116ce5760405162461bcd60e51b815260206004820152603360248201527f43616e27742072656d6f766520726f6f7420444b20737570706f72742066726f6044820152721b481d1a194819d95b995c985b0818dbdd5c9d606a1b6064820152608401610e9e565b600082600a0160008684815181106116e8576116e86162a8565b6020026020010151815260200190815260200160002060006101000a81548160ff021916908315150217905550838181518110611727576117276162a8565b6020026020010151856001600160601b03167f73607cee0f079da3d86ea5a962393fde9082aa0137009e4ba163d5dec19b5d2560405160405180910390a35b806117708161635a565b9150506114e2565b5050505050565b6008818154811061178f57600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106117dd576117dd6162a8565b600091825260208220600490910201805460078054929450916001600160601b03909116908110611810576118106162a8565b6000918252602082206003850154600b90920201925061183290600190616235565b9050600083600301828154811061184b5761184b6162a8565b6000918252602082206007909102019150600185015460ff16600481111561187557611875615c54565b14156119f65760008211806118c757506001840154600684019060ff1660048111156118a3576118a3615c54565b600481106118b3576118b36162a8565b015460028501546118c49042616235565b10155b6119475760405162461bcd60e51b8152602060048201526044602482018190527f5468652065766964656e636520706572696f642074696d6520686173206e6f74908201527f207061737365642079657420616e64206974206973206e6f7420616e2061707060648201526332b0b61760e11b608482015260a401610e9e565b60038101546006820154146119b05760405162461bcd60e51b815260206004820152602960248201527f546865206469737075746520686173206e6f742066696e6973686564206472616044820152683bb4b733903cb2ba1760b91b6064820152608401610e9e565b8254600160601b900460ff166119c75760026119ca565b60015b60018086018054909160ff19909116908360048111156119ec576119ec615c54565b0217905550611e82565b60018085015460ff166004811115611a1057611a10615c54565b1415611b74576001840154600684019060ff166004811115611a3457611a34615c54565b60048110611a4457611a446162a8565b01546002850154611a559042616235565b101580611afe57506008816000015481548110611a7457611a746162a8565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b158015611ac657600080fd5b505afa158015611ada573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611afe919061624c565b611b5d5760405162461bcd60e51b815260206004820152602a60248201527f54686520636f6d6d697420706572696f642074696d6520686173206e6f74207060448201526930b9b9b2b2103cb2ba1760b11b6064820152608401610e9e565b6001808501805460029260ff1990911690836119ec565b6002600185015460ff166004811115611b8f57611b8f615c54565b1415611d2e576001840154600684019060ff166004811115611bb357611bb3615c54565b60048110611bc357611bc36162a8565b01546002850154611bd49042616235565b101580611c7d57506008816000015481548110611bf357611bf36162a8565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b158015611c4557600080fd5b505afa158015611c59573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7d919061624c565b611cd95760405162461bcd60e51b815260206004820152602760248201527f54686520766f746520706572696f642074696d6520686173206e6f74207061736044820152661cd959081e595d60ca1b6064820152608401610e9e565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611e82565b6003600185015460ff166004811115611d4957611d49615c54565b1415611e06576001840154600684019060ff166004811115611d6d57611d6d615c54565b60048110611d7d57611d7d6162a8565b01546002850154611d8e9042616235565b1015611def5760405162461bcd60e51b815260206004820152602a60248201527f5468652061707065616c20706572696f642074696d6520686173206e6f74207060448201526930b9b9b2b2103cb2ba1760b11b6064820152608401610e9e565b6001808501805460049260ff1990911690836119ec565b6004600185015460ff166004811115611e2157611e21615c54565b1415611e825760405162461bcd60e51b815260206004820152602a60248201527f546865206469737075746520697320616c726561647920696e20746865206c6160448201526939ba103832b934b7b21760b11b6064820152608401610e9e565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611ec19160ff1690615c7e565b60405180910390a25050505050565b600080600a8381548110611ee657611ee66162a8565b6000918252602082206003600490920201908101805491935090611f0c90600190616235565b81548110611f1c57611f1c6162a8565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611f4f57611f4f6162a8565b90600052602060002090600b02019050806005015482600301541015611f7a57506000949350505050565b80546007805490916001600160601b0316908110611f9a57611f9a6162a8565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600a8381548110611fdd57611fdd6162a8565b600091825260208220600360049092020190810180549193509061200390600190616235565b81548110612013576120136162a8565b906000526020600020906007020190506000600882600001548154811061203c5761203c6162a8565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018790526001600160a01b031691508190631c3db16d9060240160206040518083038186803b15801561209157600080fd5b505afa1580156120a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120c9919061630d565b95945050505050565b600781815481106120e257600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000600a828154811061213e5761213e6162a8565b600091825260209091206001600490920201015460ff1692915050565b6000828152600c6020526040812060020180548390811061217e5761217e6162a8565b906000526020600020015490505b92915050565b6000546001600160a01b031633146121bc5760405162461bcd60e51b8152600401610e9e906161dd565b8660078a6001600160601b0316815481106121d9576121d96162a8565b90600052602060002090600b020160020154111561226f5760405162461bcd60e51b815260206004820152604760248201527f4120737562636f7572742063616e6e6f742062652061206368696c64206f662060448201527f6120737562636f7572742077697468206120686967686572206d696e696d756d6064820152661039ba30b5b29760c91b608482015260a401610e9e565b60008151116122c05760405162461bcd60e51b815260206004820152601c60248201527f4d75737420737570706f7274206174206c65617374206f6e6520444b000000006044820152606401610e9e565b6001600160601b0389166123225760405162461bcd60e51b8152602060048201526024808201527f43616e2774206861766520466f726b696e6720636f75727420617320612070616044820152631c995b9d60e21b6064820152608401610e9e565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b835181101561243f576000848281518110612377576123776162a8565b60200260200101511180156123a85750600854845185908390811061239e5761239e6162a8565b6020026020010151105b6123e55760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610e9e565b600182600a0160008684815181106123ff576123ff6162a8565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806124379061635a565b91505061235a565b5080546bffffffffffffffffffffffff19166001600160601b038c16178155604080516000815260208101918290525161247d916001840191615a01565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556124c09060068301908790615a4c565b5060405163483abc4f60e11b8152600c6004820152602481018390526044810185905273__$52cf47af9c3c0d67e54ac2a3225447effa$__90639075789e9060640160006040518083038186803b15801561251a57600080fd5b505af415801561252e573d6000803e3d6000fd5b5050505060078b6001600160601b03168154811061254e5761254e6162a8565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907ffbf60f92e3c38b643d7205bd6bacfdeb2bfb72f63294a2e646f8d2f18462ee24906125bd908e908e908e908e908e908e908e908e90616375565b60405180910390a35050505050505050505050565b6000600a84815481106125e7576125e76162a8565b600091825260209091206004918202019150600182015460ff16600481111561261257612612615c54565b1461265f5760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520657865637574696f6e20706572696f642e00000000006044820152606401610e9e565b6000816003018481548110612676576126766162a8565b906000526020600020906007020190506000600882600001548154811061269f5761269f6162a8565b60009182526020822060049182020160020154908401546001600160a01b0390911692506126ce9086906163cd565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b15801561272757600080fd5b505afa15801561273b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061275f919061630d565b90506000808261277a5783861115612775578395505b61279a565b6127858460026163e5565b86111561279a576127978460026163e5565b95505b60048801545b86811015612e635784811015612bd857604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b1580156127fe57600080fd5b505afa158015612812573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612836919061630d565b91506127108211156128485761271091505b60006127106128578482616235565b8b6001015461286691906163e5565b612870919061641a565b905061287c81886163cd565b9650896006018281548110612893576128936162a8565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b031685526002019092529082208054919650839290916128e0908490616235565b90915550508a546007805483926001600160601b0316908110612905576129056162a8565b90600052602060002090600b02016002015461292191906163cd565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b03168452600101909152902054106129b5576001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152812054612993908390616235565b8c549091506129ae9086906001600160601b03168385615171565b5050612a06565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b0316845260010190915290205415612a06578a54612a049085906001600160601b0316600084615171565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b158015612a5457600080fd5b505afa158015612a68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a8c919061624c565b612b295760005b6001600160a01b0385166000908152600b6020526040902054811015612b27576001600160a01b0385166000908152600b602052604090208054612b1491879184908110612ae357612ae36162a8565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316600080615171565b5080612b1f8161635a565b915050612a93565b505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e19612b5e8461642e565b60408051918252600060208301520160405180910390a3612b80600187616235565b821415612bd25784612bd2576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f15050600054612bd093506001600160a01b0316915089905061578b565b505b50612e51565b6001600160a01b038816634fe264fb8e8e612bf3898661644b565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b158015612c3757600080fd5b505afa158015612c4b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c6f919061630d565b9150612710821115612c815761271091505b60068901612c8f868361644b565b81548110612c9f57612c9f6162a8565b60009182526020909120015460018a01546001600160a01b03909116935061271090612ccc9084906163e5565b612cd6919061641a565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b0316845260020190915281208054909190612d16908490616235565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b03168452600101909152902054612d7e576000612710838b60010154612d6591906163e5565b612d6f919061641a565b9050612d7b848261578b565b50505b600061271083612d8e878a61641a565b612d9891906163e5565b612da2919061641a565b9050600061271084878d60020154612dba919061641a565b612dc491906163e5565b612dce919061641a565b9050612dda858361578b565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e198484604051612e46929190918252602082015260400190565b60405180910390a350505b80612e5b8161635a565b9150506127a0565b5084886005015414612e7757600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff166001811115612ea957612ea9615c54565b14612ef65760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520696e205374616b696e672070686173652e00000000006044820152606401610e9e565b6000600e54600183600f54612f0b91906163cd565b612f159190616235565b11612f205781612f3b565b600f54600e54612f309190616235565b612f3b9060016163cd565b9050600081600f54612f4d91906163cd565b600f549091505b81811015612fcc576000818152600d60205260409020805460018201546002830154612f9c926001600160a01b03811692600160a01b9091046001600160601b031691615171565b50506000818152600d60205260408120818155600181018290556002015580612fc48161635a565b915050612f54565b50600f555050565b612fdc615a79565b60006007836001600160601b031681548110612ffa57612ffa6162a8565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b815481526020019060010190808311613025575050505050915050919050565b6000546001600160a01b0316331461306f5760405162461bcd60e51b8152600401610e9e906161dd565b6001826001600160601b031614806130e2575080600780846001600160601b0316815481106130a0576130a06162a8565b60009182526020909120600b909102015481546001600160601b039091169081106130cd576130cd6162a8565b90600052602060002090600b02016002015411155b6130eb57600080fd5b60005b6007836001600160601b03168154811061310a5761310a6162a8565b90600052602060002090600b02016001018054905081101561322b5781600780856001600160601b031681548110613144576131446162a8565b90600052602060002090600b02016001018381548110613166576131666162a8565b906000526020600020015481548110613181576131816162a8565b90600052602060002090600b02016002015410156132195760405162461bcd60e51b815260206004820152604960248201527f4120737562636f7572742063616e6e6f742062652074686520706172656e742060448201527f6f66206120737562636f75727420776974682061206c6f776572206d696e696d6064820152683ab69039ba30b5b29760b91b608482015260a401610e9e565b806132238161635a565b9150506130ee565b50806007836001600160601b031681548110613249576132496162a8565b90600052602060002090600b020160020181905550816001600160601b03166000805160206165338339815191526040516132a0906020808252600890820152676d696e5374616b6560c01b604082015260600190565b60405180910390a25050565b6060600882815481106132c1576132c16162a8565b906000526020600020906004020160010180548060200260200160405190810160405280929190818152602001828054801561331c57602002820191906000526020600020905b815481526020019060010190808311613308575b50505050509050919050565b6000600a828154811061333d5761333d6162a8565b6000918252602090912060049091020160010154610100900460ff1692915050565b600a818154811061336f57600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b6000546001600160a01b031633146133e55760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b031681548110613402576134026162a8565b90600052602060002090600b0201600601906004613421929190615a4c565b50816001600160601b03166000805160206165338339815191526040516132a0906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b6000546001600160a01b031633146134945760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b0316815481106134b1576134b16162a8565b90600052602060002090600b020160040181905550816001600160601b03166000805160206165338339815191526040516132a0906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b600080600a8381548110613521576135216162a8565b600091825260208220600360049092020190810180549193509061354790600190616235565b81548110613557576135576162a8565b600091825260208220845460078054938102909201945090916001600160601b0390911690811061358a5761358a6162a8565b90600052602060002090600b0201905080600501548260030154106136295782546001600160601b0316600114156135cb576001600160ff1b039350613653565b60038201546135db9060026163e5565b6135e69060016163cd565b81546007805490916001600160601b0316908110613606576136066162a8565b90600052602060002090600b02016004015461362291906163e5565b9350613653565b60038201546136399060026163e5565b6136449060016163cd565b81600401546120c991906163e5565b505050919050565b6000546001600160a01b031633146136855760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b0316815481106136a2576136a26162a8565b90600052602060002090600b020160030181905550816001600160601b03166000805160206165338339815191526040516132a090602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b031633146137205760405162461bcd60e51b8152600401610e9e906161dd565b6000836001600160a01b0316838360405161373b919061648b565b60006040518083038185875af1925050503d8060008114613778576040519150601f19603f3d011682016040523d82523d6000602084013e61377d565b606091505b50509050806137c25760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610e9e565b50505050565b6137d53383836000615171565b6138125760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610e9e565b5050565b6000546001600160a01b031633146138405760405162461bcd60e51b8152600401610e9e906161dd565b600355565b6000806000806060600080600a8981548110613863576138636162a8565b90600052602060002090600402019050600081600301898154811061388a5761388a6162a8565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561390c57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116138ee575b5050505050915097509750975097509750975050509295509295509295565b6000600a8281548110613940576139406162a8565b600091825260209091206004918202019150600182015460ff16600481111561396b5761396b615c54565b146139b85760405162461bcd60e51b815260206004820152601b60248201527f53686f756c6420626520657865637574696f6e20706572696f642e00000000006044820152606401610e9e565b6001810154610100900460ff1615613a125760405162461bcd60e51b815260206004820152601860248201527f52756c696e6720616c72656164792065786563757465642e00000000000000006044820152606401610e9e565b6000613a1d83611fc7565b60018301805461ff001916610100179055825460405163188d362b60e11b815260048101869052602481018390529192506001600160a01b03600160601b909104169063311a6c5690604401600060405180830381600087803b158015613a8357600080fd5b505af1158015613a97573d6000803e3d6000fd5b50505050505050565b60098181548110613ab057600080fd5b600091825260209091200154905081565b6000806000600a8481548110613ad957613ad96162a8565b6000918252602082206003600490920201908101805491935090613aff90600190616235565b81548110613b0f57613b0f6162a8565b906000526020600020906007020190506008816000015481548110613b3657613b366162a8565b6000918252602090912060049182020160020154604051639b05c26160e01b81529182018790526001600160a01b031690639b05c26190602401604080518083038186803b158015613b8757600080fd5b505afa158015613b9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613bbf91906164a7565b90969095509350505050565b6000546001600160a01b03163314613bf55760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b031681548110613c1257613c126162a8565b90600052602060002090600b020160050181905550816001600160601b03166000805160206165338339815191526040516132a09060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a8481548110613c8b57613c8b6162a8565b6000918252602090912060049091020190506003600182015460ff166004811115613cb857613cb8615c54565b1415613d11576002810154815460078054929550916001600160601b03909116908110613ce757613ce76162a8565b600091825260209091206009600b9092020101546002820154613d0a91906163cd565b9150613d1a565b60009250600091505b50915091565b6000546001600160a01b03163314613d4a5760405162461bcd60e51b8152600401610e9e906161dd565b600455565b60006001600254600160a01b900460ff166001811115613d7157613d71615c54565b148015613d8c5750600454600554613d899042616235565b10155b905090565b6000613d9c82614ff0565b341015613dfd5760405162461bcd60e51b815260206004820152602960248201527f4e6f7420656e6f7567682045544820746f20636f76657220617262697472617460448201526834b7b71031b7b9ba1760b91b6064820152608401610e9e565b600080613e0984615857565b92505091506007826001600160601b031681548110613e2a57613e2a6162a8565b60009182526020808320848452600a600b90930201919091019052604090205460ff16613eb35760405162461bcd60e51b815260206004820152603160248201527f5468652064697370757465206b6974206973206e6f7420737570706f7274656460448201527008189e481d1a1a5cc81cdd5898dbdd5c9d607a1b6064820152608401610e9e565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa909101556008805492965090929184908110613f3e57613f3e6162a8565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b03909116908110613f7f57613f7f6162a8565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613fbe903461641a565b600380830191909155858255820154600283015461271091613fdf916163e5565b613fe9919061641a565b60018201553460028201556008805486908110614008576140086162a8565b906000526020600020906004020160020160149054906101000a900460ff1661409f57600160088681548110614040576140406162a8565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede540916140d4918b918e918e916004016164cc565b600060405180830381600087803b1580156140ee57600080fd5b505af1158015614102573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b031633146141695760405162461bcd60e51b8152600401610e9e906161dd565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b6141948361350b565b3410156141ef5760405162461bcd60e51b8152602060048201526024808201527f4e6f7420656e6f7567682045544820746f20636f7665722061707065616c206360448201526337b9ba1760e11b6064820152608401610e9e565b6000600a8481548110614204576142046162a8565b6000918252602090912060049091020190506003600182015460ff16600481111561423157614231615c54565b1461427e5760405162461bcd60e51b815260206004820152601a60248201527f44697370757465206973206e6f742061707065616c61626c652e0000000000006044820152606401610e9e565b6003810180546000919061429490600190616235565b815481106142a4576142a46162a8565b9060005260206000209060070201905060088160000154815481106142cb576142cb6162a8565b60009182526020909120600490910201600201546001600160a01b031633146143445760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2044697370757465204b69742060448201526437b7363c9760d91b6064820152608401610e9e565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019183908110614385576143856162a8565b90600052602060002090600b020160050154846003015410614589576007836001600160601b0316815481106143bd576143bd6162a8565b600091825260208220600b90910201546001600160601b031693505b600a8110156144ce576007846001600160601b0316815481106143fe576143fe6162a8565b60009182526020808320868452600a600b90930201919091019052604090205460ff161561442b576144ce565b600060088481548110614440576144406162a8565b90600052602060002090600402016000015414614483576008838154811061446a5761446a6162a8565b90600052602060002090600402016000015492506144bc565b6007846001600160601b03168154811061449f5761449f6162a8565b60009182526020909120600b90910201546001600160601b031693505b806144c68161635a565b9150506143d9565b506007836001600160601b0316815481106144eb576144eb6162a8565b60009182526020808320858452600a600b90930201919091019052604090205460ff1661451757600192505b84546001600160601b0384811691161461458957845460038601546001600160601b039091169061454a90600190616235565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546bffffffffffffffffffffffff19166001600160601b038416908117865560018601805460ff19169055426002870155600780546000929081106145d1576145d16162a8565b90600052602060002090600b020190508060040154346145f1919061641a565b82600301819055506127108160030154826002015461461091906163e5565b61461a919061641a565b6001830155346002830155828255600880548490811061463c5761463c6162a8565b906000526020600020906004020160020160149054906101000a900460ff166146d357600160088481548110614674576146746162a8565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b84548254146147b957845460038701546146ef90600190616235565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a4600882600001548154811061473d5761473d6162a8565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede54092614786928e928e928e9291016164cc565b600060405180830381600087803b1580156147a057600080fd5b505af11580156147b4573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516148299190615c7e565b60405180910390a2505050505050505050565b600080600a8381548110614852576148526162a8565b90600052602060002090600402019050806003016001826003018054905061487a9190616235565b8154811061488a5761488a6162a8565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff1660018111156148c4576148c4615c54565b146149005760405162461bcd60e51b815260206004820152600c60248201526b2bb937b73390383430b9b29760a11b6044820152606401610e9e565b6000600a8381548110614915576149156162a8565b9060005260206000209060040201905060006001826003018054905061493b9190616235565b90506000826003018281548110614954576149546162a8565b6000918252602082206007909102019150600184015460ff16600481111561497e5761497e615c54565b146149cb5760405162461bcd60e51b815260206004820152601a60248201527f53686f756c642062652065766964656e636520706572696f642e0000000000006044820152606401610e9e565b600060088260000154815481106149e4576149e46162a8565b60009182526020822060026004909202010154600684015460038501546001600160a01b0390921693509190614a1a88846163cd565b1115614a2a578360030154614a34565b614a3487836163cd565b9050815b81811015614b9a57604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b158015614a8557600080fd5b505af1158015614a99573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614abd9190616515565b90506001600160a01b03811615614b875760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614b139084906163cd565b909155505060068601805460018101825560009182526020918290200180546001600160a01b0319166001600160a01b038416908117909155604080518a81529283018590528c927f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a35b5080614b928161635a565b915050614a38565b505050505050505050565b6000818152600c60209081526040918290208054600182018054855181860281018601909652808652919460609485949391929190830182828015614c0957602002820191906000526020600020905b815481526020019060010190808311614bf5575b5050505050925080600201805480602002602001604051908101604052809291908181526020018280548015614c5e57602002820191906000526020600020905b815481526020019060010190808311614c4a575b50505050509150509193909250565b600060078281548110614c8257614c826162a8565b60009182526020909120600b9091020154600160601b900460ff1692915050565b60606009805480602002602001604051908101604052809291908181526020018280548015614cf157602002820191906000526020600020905b815481526020019060010190808311614cdd575b5050505050905090565b6000546001600160a01b03163314614d255760405162461bcd60e51b8152600401610e9e906161dd565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314614d715760405162461bcd60e51b8152600401610e9e906161dd565b600854808210614dba5760405162461bcd60e51b815260206004820152601460248201527314185c995b9d08191bd95cdb89dd08195e1a5cdd60621b6044820152606401610e9e565b600082614e0a5760016007600181548110614dd757614dd76162a8565b60009182526020808320868452600b92909202909101600a01905260409020805460ff1916911515919091179055614e85565b60088381548110614e1d57614e1d6162a8565b9060005260206000209060040201600301546001614e3b91906163cd565b9050600a8110614e855760405162461bcd60e51b8152602060048201526015602482015274088cae0e8d040d8caeccad840d2e640c2e840dac2f605b1b6044820152606401610e9e565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee381019182559151805193949193614f37937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee401929190910190615a01565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b03909316929092179190911790556080909101516003909101556008805484908110614f9157614f916162a8565b60009182526020808320600160049093020182018054928301815583529091200191909155505050565b6000600a8281548110614fd057614fd06162a8565b60009182526020909120600490910201546001600160601b031692915050565b6000806000614ffe84615857565b5091509150806007836001600160601b031681548110615020576150206162a8565b90600052602060002090600b02016004015461503c91906163e5565b949350505050565b6000546001600160a01b0316331461506e5760405162461bcd60e51b8152600401610e9e906161dd565b806007836001600160601b03168154811061508b5761508b6162a8565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b03166000805160206165338339815191526040516132a0906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b600080600a838154811061510e5761510e6162a8565b60009182526020909120600360049092020101549392505050565b60006007836001600160601b031681548110615147576151476162a8565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b60006001600160601b038416158061519357506007546001600160601b038516115b156151a05750600061503c565b6001600160a01b0385166000908152600b60205260408120906151c387876158db565b604051637521ccb160e01b8152600c60048201526001600160601b03881660248201526044810182905290915060009073__$52cf47af9c3c0d67e54ac2a3225447effa$__90637521ccb19060640160206040518083038186803b15801561522a57600080fd5b505af415801561523e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190615262919061630d565b905085156152f0576007876001600160601b031681548110615286576152866162a8565b90600052602060002090600b0201600201548610806152be57506001600160601b038716600090815260028401602052604090205486105b156152cf576000935050505061503c565b801580156152df57508254600411155b156152f0576000935050505061503c565b6000600254600160a01b900460ff16600181111561531057615310615c54565b146153bc576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e6000815461535b9061635a565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b03909316929092178255820151600180830191909155606090920151600290910155935061503c92505050565b6000818710615439576153cf8288616235565b90508015615427576153e2893083615923565b1561542c5781615427578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b61560e565b600094505050505061503c565b866155d6576001600160601b038816600090815260028501602052604090205486906154659084616235565b61546f9190616235565b9050801561542757615481898261578b565b1561542c5760005b84548110156155d057886001600160601b03168560000182815481106154b1576154b16162a8565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031614156155be57845485906154ee90600190616235565b815481106154fe576154fe6162a8565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b031685600001828154811061553c5761553c6162a8565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b031602179055508460000180548061558857615588616326565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a021916905590556155d0565b806155c88161635a565b915050615489565b5061560e565b856155e18884616235565b6155eb9190616235565b9050801561560e576155fd898261578b565b61560e57600094505050505061503c565b6001600160601b03881660009081526001850160205260408120548890615636908590616235565b61564091906163cd565b6001600160601b038a16600081815260018801602052604081208390559192505b8161572457604051631712e1c560e11b8152600c600482015260248101829052604481018b90526064810187905273__$52cf47af9c3c0d67e54ac2a3225447effa$__90632e25c38a9060840160006040518083038186803b1580156156c657600080fd5b505af41580156156da573d6000803e3d6000fd5b5050505060018114156156f05760019150615661565b60078181548110615703576157036162a8565b60009182526020909120600b90910201546001600160601b03169050615661565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600093849384939116916157eb919061648b565b6000604051808303816000865af19150503d8060008114615828576040519150601f19603f3d011682016040523d82523d6000602084013e61582d565b606091505b50915091508180156120c95750805115806120c95750808060200190518101906120c9919061624c565b600080600060408451106158c9575050506020810151604082015160608301516001600160601b038316158061589857506007546001600160601b03841610155b156158a257600192505b816158ac57600391505b8015806158bb57506008548110155b156158c4575060015b6158d4565b506001915060039050815b9193909250565b600060405160005b60148110156158fe578481600c011a818301536001016158e3565b5060145b602081101561591a5783811a81830153600101615902565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17905291516000938493849391169161598b919061648b565b6000604051808303816000865af19150503d80600081146159c8576040519150601f19603f3d011682016040523d82523d6000602084013e6159cd565b606091505b50915091508180156159f75750805115806159f75750808060200190518101906159f7919061624c565b9695505050505050565b828054828255906000526020600020908101928215615a3c579160200282015b82811115615a3c578251825591602001919060010190615a21565b50615a48929150615a97565b5090565b8260048101928215615a3c5791602002820182811115615a3c578251825591602001919060010190615a21565b60405180608001604052806004906020820280368337509192915050565b5b80821115615a485760008155600101615a98565b6001600160a01b0381168114615ac157600080fd5b50565b600060208284031215615ad657600080fd5b8135615ae181615aac565b9392505050565b80356001600160601b0381168114615aff57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715615b4357615b43615b04565b604052919050565b600082601f830112615b5c57600080fd5b8135602067ffffffffffffffff821115615b7857615b78615b04565b8160051b615b87828201615b1a565b9283528481018201928281019087851115615ba157600080fd5b83870192505b84831015615bc057823582529183019190830190615ba7565b979650505050505050565b8015158114615ac157600080fd5b600080600060608486031215615bee57600080fd5b615bf784615ae8565b9250602084013567ffffffffffffffff811115615c1357600080fd5b615c1f86828701615b4b565b9250506040840135615c3081615bcb565b809150509250925092565b600060208284031215615c4d57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b60058110615c7a57615c7a615c54565b9052565b6020810161218c8284615c6a565b60008060408385031215615c9f57600080fd5b50508035926020909101359150565b600082601f830112615cbf57600080fd5b6040516080810181811067ffffffffffffffff82111715615ce257615ce2615b04565b604052806080840185811115615cf757600080fd5b845b81811015615d11578035835260209283019201615cf9565b509195945050505050565b60008060008060008060008060006101808a8c031215615d3b57600080fd5b615d448a615ae8565b985060208a0135615d5481615bcb565b975060408a0135965060608a0135955060808a0135945060a08a01359350615d7f8b60c08c01615cae565b92506101408a013591506101608a013567ffffffffffffffff811115615da457600080fd5b615db08c828d01615b4b565b9150509295985092959850929598565b600080600060608486031215615dd557600080fd5b505081359360208301359350604090920135919050565b600060208284031215615dfe57600080fd5b615ae182615ae8565b8060005b60048110156137c2578151845260209384019390910190600101615e0b565b6080810161218c8284615e07565b60008060408385031215615e4b57600080fd5b615e5483615ae8565b946020939093013593505050565b600081518084526020808501945080840160005b83811015615e9257815187529582019590820190600101615e76565b509495945050505050565b602081526000615ae16020830184615e62565b6001600160601b03861681526001600160a01b038516602082015260a08101615edc6040830186615c6a565b9215156060820152608001529392505050565b60008060a08385031215615f0257600080fd5b615f0b83615ae8565b9150615f1a8460208501615cae565b90509250929050565b600082601f830112615f3457600080fd5b813567ffffffffffffffff811115615f4e57615f4e615b04565b615f61601f8201601f1916602001615b1a565b818152846020838601011115615f7657600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215615fa857600080fd5b8335615fb381615aac565b925060208401359150604084013567ffffffffffffffff811115615fd657600080fd5b615fe286828701615f23565b9150509250925092565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b818110156160485784516001600160a01b031683529383019391830191600101616023565b50508093505050508260a0830152979650505050505050565b602081016002831061607557616075615c54565b91905290565b6000806040838503121561608e57600080fd5b82359150602083013567ffffffffffffffff8111156160ac57600080fd5b6160b885828601615f23565b9150509250929050565b6000806000606084860312156160d757600080fd5b8335925060208401359150604084013567ffffffffffffffff811115615fd657600080fd5b6000806040838503121561610f57600080fd5b823561611a81615aac565b9150615f1a60208401615ae8565b8381526060602082015260006161416060830185615e62565b82810360408401526159f78185615e62565b6000806040838503121561616657600080fd5b8235615e5481615aac565b60006020828403121561618357600080fd5b813567ffffffffffffffff81111561619a57600080fd5b61503c84828501615f23565b600080604083850312156161b957600080fd5b6161c283615ae8565b915060208301356161d281615bcb565b809150509250929050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b6000828210156162475761624761621f565b500390565b60006020828403121561625e57600080fd5b8151615ae181615bcb565b60008083128015600160ff1b8501841216156162875761628761621f565b6001600160ff1b03840183138116156162a2576162a261621f565b50500390565b634e487b7160e01b600052603260045260246000fd5b6020808252602f908201527f412064697370757465206b697420686173206e6f742070617373656420746f2060408201526e5265736f6c76696e6720706861736560881b606082015260800190565b60006020828403121561631f57600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b8214156163525761635261621f565b506000190190565b600060001982141561636e5761636e61621f565b5060010190565b60006101608a151583528960208401528860408401528760608401528660808401526163a460a0840187615e07565b84610120840152806101408401526163be81840185615e62565b9b9a5050505050505050505050565b600082198211156163e0576163e061621f565b500190565b60008160001904831182151516156163ff576163ff61621f565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261642957616429616404565b500490565b6000600160ff1b8214156164445761644461621f565b5060000390565b60008261645a5761645a616404565b500690565b60005b8381101561647a578181015183820152602001616462565b838111156137c25750506000910152565b6000825161649d81846020870161645f565b9190910192915050565b600080604083850312156164ba57600080fd5b8251915060208301516161d281615bcb565b84815283602082015260806040820152600083518060808401526164f78160a085016020880161645f565b606083019390935250601f91909101601f19160160a0019392505050565b60006020828403121561652757600080fd5b8151615ae181615aac56fe8f4ab3272f699ef825c5008ac66b1b213bfab7b8f730599d1deeaf4e048dc922a264697066735822122074bec8c99f0d37eab91640b145df87385a966b1495ccf21b84e1b6403133415764736f6c63430008090033", + "numDeployments": 3, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\":\"_disputeID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_roundID\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_fromSubcourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"uint96\",\"name\":\"_toSubcourtID\",\"type\":\"uint96\"}],\"name\":\"CourtJump\",\"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\":\"_subcourtID\",\"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\":\"_subcourtID\",\"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\":\"uint256\",\"name\":\"_subcourtID\",\"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\":\"SubcourtCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"indexed\":false,\"internalType\":\"string\",\"name\":\"_param\",\"type\":\"string\"}],\"name\":\"SubcourtModified\",\"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\":\"address payable\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"changeGovernor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"bool\",\"name\":\"_hiddenVotes\",\"type\":\"bool\"}],\"name\":\"changeHiddenVotes\",\"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\":\"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\":\"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\"},{\"internalType\":\"uint256[]\",\"name\":\"_supportedDisputeKits\",\"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\":[],\"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\":\"subcourtID\",\"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\":\"subcourtID\",\"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\":\"_subcourtID\",\"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\":\"_subcourtID\",\"type\":\"uint96\"}],\"name\":\"getJurorBalance\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"staked\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"locked\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_disputeID\",\"type\":\"uint256\"}],\"name\":\"getLastRoundResult\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"winningChoice\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"tied\",\"type\":\"bool\"}],\"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\":\"_subcourtID\",\"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\":\"_subcourtID\",\"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\":\"_subcourtID\",\"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 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 arbitration cost.\"}},\"changeGovernor(address)\":{\"details\":\"Changes the `governor` storage variable.\",\"params\":{\"_governor\":\"The new value for the `governor` storage variable.\"}},\"changeHiddenVotes(uint96,bool)\":{\"details\":\"Changes the `hiddenVotes` property value of a specified subcourt.\",\"params\":{\"_hiddenVotes\":\"The new value for the `hiddenVotes` property value.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"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.\"}},\"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.\"}},\"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.\"}},\"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 subcourt (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.\"}},\"createSubcourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256,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.\",\"_supportedDisputeKits\":\"Indexes of dispute kits that this subcourt will support.\",\"_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.\"}},\"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\":{\"_disputeKitIDs\":\"The IDs of dispute kits which support should be added/removed.\",\"_enable\":\"Whether add or remove the dispute kits from the subcourt.\",\"_subcourtID\":\"The ID of the subcourt.\"}},\"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\":{\"_subcourtID\":\"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 subcourt.\",\"params\":{\"_stake\":\"The new stake.\",\"_subcourtID\":\"The ID of the subcourt.\"}}},\"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\":200},\"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 */\\n function currentRuling(uint256 _coreDisputeID) external view returns (uint256 ruling);\\n\\n /** @dev Returns the voting data from the most relevant round.\\n * @param _coreDisputeID The ID of the dispute in Kleros Core, not in the Dispute Kit.\\n * @return winningChoice The winning choice of this round.\\n * @return tied Whether it's a tie or not.\\n */\\n function getLastRoundResult(uint256 _coreDisputeID) external view returns (uint256 winningChoice, bool tied);\\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(\\n uint256 _coreDisputeID,\\n uint256 _coreRoundID,\\n uint256 _voteID\\n ) 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 )\\n external\\n view\\n returns (\\n address account,\\n bytes32 commit,\\n uint256 choice,\\n bool voted\\n );\\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\":\"0x235f027aa27fa972c56d863cfbc33832c8100135cf32d6827294de138e97dd44\",\"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 subcourtID; // The ID of the subcourt 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[] subcourtIDs; // The IDs of subcourts 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 subcourt in the form `stakedTokens[subcourtID]`.\\n mapping(uint96 => uint256) lockedTokens; // The number of tokens the juror has locked in the subcourt in the form `lockedTokens[subcourtID]`.\\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 subcourtID; // The ID of the subcourt.\\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 subcourts.\\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 _subcourtID, 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 SubcourtCreated(\\n uint256 indexed _subcourtID,\\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 SubcourtModified(uint96 indexed _subcourtID, string _param);\\n event DisputeKitCreated(\\n uint256 indexed _disputeKitID,\\n IDisputeKit indexed _disputeKitAddress,\\n uint256 indexed _parent\\n );\\n event DisputeKitEnabled(uint96 indexed _subcourtID, uint256 indexed _disputeKitID, bool indexed _enable);\\n event CourtJump(\\n uint256 indexed _disputeID,\\n uint256 indexed _roundID,\\n uint96 indexed _fromSubcourtID,\\n uint96 _toSubcourtID\\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 SubcourtCreated.\\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 SubcourtCreated(\\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 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 * @param _supportedDisputeKits Indexes of dispute kits that this subcourt will support.\\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 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 subcourtID = 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(subcourtID), _sortitionSumTreeK);\\n // Update the parent.\\n courts[_parent].children.push(subcourtID);\\n emit SubcourtCreated(\\n subcourtID,\\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 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(\\n _subcourtID == GENERAL_COURT || courts[courts[_subcourtID].parent].minStake <= _minStake,\\n \\\"MinStake lower than parent court\\\"\\n );\\n for (uint256 i = 0; i < courts[_subcourtID].children.length; i++) {\\n require(courts[courts[_subcourtID].children[i]].minStake >= _minStake, \\\"MinStake lower than parent court\\\");\\n }\\n\\n courts[_subcourtID].minStake = _minStake;\\n emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"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 emit SubcourtModified(_subcourtID, \\\"jurorsForCourtJump\\\");\\n }\\n\\n /** @dev Changes the `hiddenVotes` property value of a specified subcourt.\\n * @param _subcourtID The ID of the subcourt.\\n * @param _hiddenVotes The new value for the `hiddenVotes` property value.\\n */\\n function changeHiddenVotes(uint96 _subcourtID, bool _hiddenVotes) external onlyByGovernor {\\n courts[_subcourtID].hiddenVotes = _hiddenVotes;\\n emit SubcourtModified(_subcourtID, \\\"hiddenVotes\\\");\\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(uint96 _subcourtID, uint256[4] memory _timesPerPeriod)\\n external\\n onlyByGovernor\\n {\\n courts[_subcourtID].timesPerPeriod = _timesPerPeriod;\\n emit SubcourtModified(_subcourtID, \\\"timesPerPeriod\\\");\\n }\\n\\n /** @dev Adds/removes court's support for specified dispute kits.\\n * @param _subcourtID The ID of the subcourt.\\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 subcourt.\\n */\\n function enableDisputeKits(\\n uint96 _subcourtID,\\n uint256[] memory _disputeKitIDs,\\n bool _enable\\n ) external onlyByGovernor {\\n Court storage subcourt = courts[_subcourtID];\\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(_subcourtID, _disputeKitIDs[i], true);\\n } else {\\n require(\\n !(_subcourtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT),\\n \\\"Can't disable Root DK in General\\\"\\n );\\n enableDisputeKit(_subcourtID, _disputeKitIDs[i], false);\\n }\\n }\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\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, uint256 _stake) external {\\n require(setStakeForAccount(msg.sender, _subcourtID, _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.subcourtID, 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 subcourt (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(uint256 _numberOfChoices, bytes memory _extraData)\\n external\\n payable\\n override\\n returns (uint256 disputeID)\\n {\\n require(msg.value >= arbitrationCost(_extraData), \\\"ETH too low for arbitration cost\\\");\\n\\n (uint96 subcourtID, , uint256 disputeKitID) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n require(courts[subcourtID].supportedDisputeKits[disputeKitID], \\\"DK unsupported by subcourt\\\");\\n\\n disputeID = disputes.length;\\n Dispute storage dispute = disputes.push();\\n dispute.subcourtID = subcourtID;\\n dispute.arbitrated = IArbitrable(msg.sender);\\n dispute.lastPeriodChange = block.timestamp;\\n\\n IDisputeKit disputeKit = disputeKitNodes[disputeKitID].disputeKit;\\n Court storage court = courts[dispute.subcourtID];\\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.subcourtID];\\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.subcourtID] += round.tokensAtStakePerJuror;\\n round.drawnJurors.push(drawnAddress);\\n emit Draw(drawnAddress, _disputeID, currentRound, i);\\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(\\n uint256 _disputeID,\\n uint256 _numberOfChoices,\\n bytes memory _extraData\\n ) 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 newSubcourtID = dispute.subcourtID;\\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[newDisputeKitID].jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n newSubcourtID = courts[newSubcourtID].parent;\\n\\n for (uint256 i = 0; i < SEARCH_ITERATIONS; i++) {\\n if (courts[newSubcourtID].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 newSubcourtID = courts[newSubcourtID].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[newSubcourtID].supportedDisputeKits[newDisputeKitID]) {\\n newSubcourtID = GENERAL_COURT;\\n }\\n\\n if (newSubcourtID != dispute.subcourtID) {\\n emit CourtJump(_disputeID, dispute.rounds.length - 1, dispute.subcourtID, newSubcourtID);\\n }\\n }\\n\\n dispute.subcourtID = newSubcourtID;\\n dispute.period = Period.evidence;\\n dispute.lastPeriodChange = block.timestamp;\\n\\n Court storage court = courts[newSubcourtID];\\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(\\n uint256 _disputeID,\\n uint256 _round,\\n uint256 _iterations\\n ) 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.subcourtID] -= 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.subcourtID] >= courts[dispute.subcourtID].minStake + penalty) {\\n uint256 newStake = jurors[account].stakedTokens[dispute.subcourtID] - penalty;\\n setStakeForAccount(account, dispute.subcourtID, newStake, penalty);\\n } else if (jurors[account].stakedTokens[dispute.subcourtID] != 0) {\\n setStakeForAccount(account, dispute.subcourtID, 0, penalty);\\n }\\n\\n // Unstake the juror if he lost due to inactivity.\\n if (!disputeKit.isVoteActive(_disputeID, _round, i)) {\\n for (uint256 j = 0; j < jurors[account].subcourtIDs.length; j++) {\\n setStakeForAccount(account, jurors[account].subcourtIDs[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.subcourtID] -=\\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.subcourtID] == 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 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)\\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 subcourtID, uint256 minJurors, ) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData);\\n cost = courts[subcourtID].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.subcourtID];\\n if (round.nbVotes >= court.jurorsForCourtJump) {\\n // Jump to parent subcourt.\\n if (dispute.subcourtID == GENERAL_COURT) {\\n // TODO: Handle the forking when appealed in General court.\\n cost = NON_PAYABLE_AMOUNT; // Get the cost of the parent subcourt.\\n } else {\\n cost = courts[court.parent].feeForJuror * ((round.nbVotes * 2) + 1);\\n }\\n } else {\\n // Stay in current subcourt.\\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.subcourtID].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 */\\n function currentRuling(uint256 _disputeID) public view returns (uint256 ruling) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit;\\n return disputeKit.currentRuling(_disputeID);\\n }\\n\\n function getRoundInfo(uint256 _disputeID, uint256 _round)\\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 _subcourtID)\\n external\\n view\\n returns (uint256 staked, uint256 locked)\\n {\\n staked = jurors[_juror].stakedTokens[_subcourtID];\\n locked = jurors[_juror].lockedTokens[_subcourtID];\\n }\\n\\n function isSupported(uint96 _subcourtID, uint256 _disputeKitID) external view returns (bool) {\\n return courts[_subcourtID].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 _subcourtID 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 _subcourtID) external view returns (uint256[4] memory timesPerPeriod) {\\n Court storage court = courts[_subcourtID];\\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(bytes32 _key, uint256 _nodeIndex)\\n public\\n view\\n returns (\\n uint256 K,\\n uint256 length,\\n bytes32 ID\\n )\\n {\\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.subcourtID];\\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 getLastRoundResult(uint256 _disputeID) external view returns (uint256 winningChoice, bool tied) {\\n Dispute storage dispute = disputes[_disputeID];\\n Round storage round = dispute.rounds[dispute.rounds.length - 1];\\n (winningChoice, tied) = disputeKitNodes[round.disputeKitID].disputeKit.getLastRoundResult(_disputeID);\\n }\\n\\n function getDisputesKitIDsThatNeedFreezing() external view returns (uint256[] memory) {\\n return disputesKitIDsThatNeedFreezing;\\n }\\n\\n // ************************************* //\\n // * Internal * //\\n // ************************************* //\\n\\n function enableDisputeKit(\\n uint96 _subcourtID,\\n uint256 _disputeKitID,\\n bool _enable\\n ) internal {\\n courts[_subcourtID].supportedDisputeKits[_disputeKitID] = _enable;\\n emit DisputeKitEnabled(_subcourtID, _disputeKitID, _enable);\\n }\\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 * @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 _subcourtID,\\n uint256 _stake,\\n uint256 _penalty\\n ) internal returns (bool succeeded) {\\n if (_subcourtID == FORKING_COURT || _subcourtID > courts.length) return false;\\n\\n Juror storage juror = jurors[_account];\\n bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID);\\n uint256 currentStake = sortitionSumTrees.stakeOf(bytes32(uint256(_subcourtID)), stakePathID);\\n\\n if (_stake != 0) {\\n // Check against locked tokens in case the min stake was lowered.\\n if (_stake < courts[_subcourtID].minStake || _stake < juror.lockedTokens[_subcourtID]) return false;\\n if (currentStake == 0 && juror.subcourtIDs.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 subcourtID: _subcourtID,\\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.subcourtIDs.push(_subcourtID);\\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[_subcourtID] - _penalty;\\n if (transferredAmount > 0) {\\n if (safeTransfer(_account, transferredAmount)) {\\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 }\\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[_subcourtID] - currentStake + _stake;\\n juror.stakedTokens[_subcourtID] = newTotalStake;\\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 == GENERAL_COURT) finished = true;\\n else currentSubcourtID = courts[currentSubcourtID].parent;\\n }\\n\\n emit StakeSet(_account, _subcourtID, _stake, newTotalStake);\\n\\n return true;\\n }\\n\\n /** @dev Gets a subcourt 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 subcourt ID, the next are the minimum number of jurors and the last are the dispute kit ID.\\n * @return subcourtID The subcourt ID.\\n * @return minJurors The minimum number of jurors required.\\n * @return disputeKitID The ID of the dispute kit.\\n */\\n function extraDataToSubcourtIDMinJurorsDisputeKit(bytes memory _extraData)\\n internal\\n view\\n returns (\\n uint96 subcourtID,\\n uint256 minJurors,\\n uint256 disputeKitID\\n )\\n {\\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 subcourtID := mload(add(_extraData, 0x20))\\n minJurors := mload(add(_extraData, 0x40))\\n disputeKitID := mload(add(_extraData, 0x60))\\n }\\n if (subcourtID == FORKING_COURT || subcourtID >= courts.length) {\\n subcourtID = 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 subcourtID = GENERAL_COURT;\\n minJurors = MIN_JURORS;\\n disputeKitID = DISPUTE_KIT_CLASSIC;\\n }\\n }\\n\\n /** @dev Packs an account and a subcourt ID into a stake path ID.\\n * @param _account The address of the juror to pack.\\n * @param _subcourtID The subcourt ID to pack.\\n * @return stakePathID The stake path ID.\\n */\\n function accountAndSubcourtIDToStakePathID(address _account, uint96 _subcourtID)\\n internal\\n pure\\n returns (bytes32 stakePathID)\\n {\\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 /** @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(\\n address _from,\\n address _to,\\n uint256 _value\\n ) 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\":\"0xd8593fcedfc04eba288fded13f7ccdfe51224d65b75117bad4baee156037949f\",\"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": "0x60806040526001600f553480156200001657600080fd5b5060405162006780380380620067808339810160408190526200003991620005d3565b600080546001600160a01b038b81166001600160a01b0319928316178355600180548c831690841617815560028054928c1692909316919091179091558651600355602080880151600455426005556008805490920182558183526040805160a08101825284815281518581528084019092529293918301915081526001600160a01b0389166020808301919091526000604083018190526060909201829052835460018181018655948352918190208351600490930201918255828101518051939492936200011193850192919091019062000458565b5060408281015160028301805460608601511515600160a01b026001600160a81b03199091166001600160a01b0393841617179055608090930151600390920191909155516000918816906001907f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c498908490a4600780546001018155600090815260405163483abc4f60e11b8152600c60048201526024810191909152604481018290527348ce286978C74c288eA6Bc9a536BcC899DF8D17790639075789e9060640160006040518083038186803b158015620001ed57600080fd5b505af415801562000202573d6000803e3d6000fd5b5050600780546001810182556000918252600b027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160601b0319168155604080518381526020810190915290935091505080516200027291600184019160209091019062000458565b50805460ff60601b19166c01000000000000000000000000861515021781558351600282015560208401516003820155604084015160048083019190915560608501516005830155620002cc9060068301908590620004a8565b5060405163483abc4f60e11b8152600c600482015260016024820152604481018390527348ce286978C74c288eA6Bc9a536BcC899DF8D17790639075789e9060640160006040518083038186803b1580156200032757600080fd5b505af41580156200033c573d6000803e3d6000fd5b5050825486516020808901516040808b015160608c0151825160008152948501928390526001600160601b039096169750600196507f2e689e2ae8e3c8e02797c3ff9998e8297e587a74bc6d0e48b6b5991f70991d1c95620003a7958e959094938d918d91620006eb565b60405180910390a3620003bd60018080620003cd565b5050505050505050505062000790565b806007846001600160601b031681548110620003ed57620003ed620006d5565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b82805482825590600052602060002090810192821562000496579160200282015b828111156200049657825182559160200191906001019062000479565b50620004a4929150620004d8565b5090565b82600481019282156200049657916020028201828111156200049657825182559160200191906001019062000479565b5b80821115620004a45760008155600101620004d9565b6001600160a01b03811681146200050557600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b604080519081016001600160401b038111828210171562000543576200054362000508565b60405290565b805180151581146200055a57600080fd5b919050565b600082601f8301126200057157600080fd5b604051608081016001600160401b038111828210171562000596576200059662000508565b604052806080840185811115620005ac57600080fd5b845b81811015620005c8578051835260209283019201620005ae565b509195945050505050565b60008060008060008060008060006102008a8c031215620005f357600080fd5b89516200060081620004ef565b809950506020808b01516200061581620004ef565b60408c01519099506200062881620004ef565b60608c01519098506200063b81620004ef565b9650609f8b018c136200064d57600080fd5b620006576200051e565b8060c08d018e8111156200066a57600080fd5b60808e015b818110156200068857805184529284019284016200066f565b50819850620006978162000549565b975050505050620006ac8b60e08c016200055f565b9250620006be8b6101608c016200055f565b91506101e08a015190509295985092959850929598565b634e487b7160e01b600052603260045260246000fd5b60006101608083018b1515845260208b818601528a604086015289606086015288608086015260a085018860005b6004811015620007385781518352918301919083019060010162000719565b50505061012085018790526101408501929092528451908190526101808401918086019160005b818110156200077d578351855293820193928201926001016200075f565b50929d9c50505050505050505050505050565b615fe080620007a06000396000f3fe6080604052600436106103cd5760003560e01c8063823cfd70116101fd578063c13517e111610118578063e4c0aaf4116100ab578063f7434ea91161007a578063f7434ea914610c99578063f8bdb57b14610cb9578063fbf405b014610cd9578063fc6f8f1614610cf9578063fe524c3914610d1957600080fd5b8063e4c0aaf414610bbb578063eaff425a14610bdb578063f12ada8b14610bf0578063f6b4d82d14610c1057600080fd5b8063cf0c38f8116100e7578063cf0c38f814610b08578063d1c1df4814610b28578063d2b8035a14610b86578063d8b03fd814610ba657600080fd5b8063c13517e114610aa2578063c258bb1914610ab5578063c356990214610ad5578063c71f425314610ae857600080fd5b8063b1c9fe6e11610190578063b70c4e941161015f578063b70c4e94146109fd578063b888adfa14610a12578063bfabfe8f14610a28578063c057eca714610a8c57600080fd5b8063b1c9fe6e14610984578063b2866af7146109b2578063b31b4540146109d2578063b4a61608146109e857600080fd5b80638edf4741116101cc5780638edf4741146108da5780639b05c261146108fa578063a57366e71461092f578063afe15cfb1461094f57600080fd5b8063823cfd701461084d578063840bc19c1461086d5780638a9bb02a146108885780638bb04875146108ba57600080fd5b806334d5fb31116102ed57806357260364116102805780636235593f1161024f5780636235593f146107e35780636c1eb1b9146107f8578063751accd01461080d5780637717a6e81461082d57600080fd5b8063572603641461076357806359354c771461078357806359ec827e146107a35780635bc24dd3146107c357600080fd5b80633e1d09be116102bc5780633e1d09be146106cf57806343d4137f146106ef578063564a565d1461071c57806356acb0501461074d57600080fd5b806334d5fb311461065757806335975f4a1461066c5780633a1578601461068c5780633cfd1184146106a257600080fd5b806319b81529116103655780632922d604116103345780632922d604146105e15780632b6a63f1146106015780632d29a47b146106215780632ea7b4d01461064157600080fd5b806319b815291461050d5780631c3db16d1461053d5780631f5a0dd21461055d57806327e6ec8a146105b457600080fd5b80630d1b9d1a116103a15780630d1b9d1a146104665780630d83b940146104b45780630e083ec9146104d7578063115d5376146104ed57600080fd5b8062f5822c146103d25780630b274f2e146103f45780630b7414bc146104095780630c340a2414610429575b600080fd5b3480156103de57600080fd5b506103f26103ed36600461557c565b610d39565b005b34801561040057600080fd5b506103f2610d8e565b34801561041557600080fd5b506103f2610424366004615691565b61137a565b34801561043557600080fd5b50600054610449906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561047257600080fd5b506104866104813660046156f3565b611571565b604080519485526001600160a01b03909316602085015290151591830191909152606082015260800161045d565b3480156104c057600080fd5b506104c9600181565b60405190815260200161045d565b3480156104e357600080fd5b506104c9600e5481565b3480156104f957600080fd5b506103f26105083660046156f3565b6115ba565b34801561051957600080fd5b5061052d6105283660046156f3565b611c24565b604051901515815260200161045d565b34801561054957600080fd5b506104c96105583660046156f3565b611d1b565b34801561056957600080fd5b5061057d6105783660046156f3565b611e26565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c00161045d565b3480156105c057600080fd5b506105c9600081565b6040516001600160601b03909116815260200161045d565b3480156105ed57600080fd5b506104c96105fc36600461570c565b611e7d565b34801561060d57600080fd5b506103f261061c36600461579c565b611eb4565b34801561062d57600080fd5b506103f261063c366004615840565b612272565b34801561064d57600080fd5b506104c961271081565b34801561066357600080fd5b506105c9600181565b34801561067857600080fd5b506103f26106873660046156f3565b612b1d565b34801561069857600080fd5b506104c960065481565b3480156106ae57600080fd5b506106c26106bd36600461586c565b612c5a565b60405161045d91906158aa565b3480156106db57600080fd5b506103f26106ea3660046158b8565b612ccb565b3480156106fb57600080fd5b5061070f61070a3660046156f3565b612edd565b60405161045d919061591d565b34801561072857600080fd5b5061073c6107373660046156f3565b612f59565b60405161045d95949392919061595a565b34801561075957600080fd5b506104c9600f5481565b34801561076f57600080fd5b506103f261077e366004615999565b612fb5565b34801561078f57600080fd5b506103f261079e3660046158b8565b613064565b3480156107af57600080fd5b506104c96107be3660046156f3565b613105565b3480156107cf57600080fd5b506103f26107de3660046158b8565b613255565b3480156107ef57600080fd5b506104c9600081565b34801561080457600080fd5b506104c9600a81565b34801561081957600080fd5b506103f2610828366004615a3d565b6132f0565b34801561083957600080fd5b506103f26108483660046158b8565b6133c2565b34801561085957600080fd5b506103f26108683660046156f3565b613410565b34801561087957600080fd5b506104c96001600160ff1b0381565b34801561089457600080fd5b506108a86108a336600461570c565b61343f565b60405161045d96959493929190615a96565b3480156108c657600080fd5b506103f26108d53660046156f3565b61351f565b3480156108e657600080fd5b506104c96108f53660046156f3565b613688565b34801561090657600080fd5b5061091a6109153660046156f3565b6136a9565b6040805192835290151560208301520161045d565b34801561093b57600080fd5b506103f261094a3660046158b8565b6137b3565b34801561095b57600080fd5b5061096f61096a3660046156f3565b61385b565b6040805192835260208301919091520161045d565b34801561099057600080fd5b506002546109a590600160a01b900460ff1681565b60405161045d9190615b0b565b3480156109be57600080fd5b506103f26109cd3660046156f3565b613908565b3480156109de57600080fd5b506104c960045481565b3480156109f457600080fd5b506104c9600481565b348015610a0957600080fd5b5061052d613937565b348015610a1e57600080fd5b506104c960055481565b348015610a3457600080fd5b50610a71610a4336600461570c565b6000918252600c60209081526040808420805460028201549486526004909101909252909220549192909190565b6040805193845260208401929092529082015260600161045d565b348015610a9857600080fd5b506104c960035481565b6104c9610ab0366004615b25565b613979565b348015610ac157600080fd5b506103f2610ad036600461557c565b613cfb565b6103f2610ae3366004615b6c565b613d47565b348015610af457600080fd5b506104c9610b033660046156f3565b6143ca565b348015610b1457600080fd5b50600254610449906001600160a01b031681565b348015610b3457600080fd5b5061096f610b43366004615ba6565b6001600160a01b03919091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610b9257600080fd5b506103f2610ba136600461570c565b614432565b348015610bb257600080fd5b5061070f614725565b348015610bc757600080fd5b506103f2610bd636600461557c565b61477d565b348015610be757600080fd5b506104c9600381565b348015610bfc57600080fd5b506103f2610c0b366004615bd2565b6147c9565b348015610c1c57600080fd5b50610c67610c2b3660046156f3565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b03909316602085015291830152606082015260800161045d565b348015610ca557600080fd5b506104c9610cb4366004615bf0565b614a22565b348015610cc557600080fd5b506103f2610cd4366004615c25565b614a76565b348015610ce557600080fd5b50600154610449906001600160a01b031681565b348015610d0557600080fd5b506104c9610d143660046156f3565b614b2a565b348015610d2557600080fd5b5061052d610d343660046158b8565b614b59565b6000546001600160a01b03163314610d6c5760405162461bcd60e51b8152600401610d6390615c5c565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610dae57610dae615930565b1415610e7457600354600554610dc49042615c99565b1015610e125760405162461bcd60e51b815260206004820152601960248201527f4d696e5374616b696e6754696d65206e6f7420706173736564000000000000006044820152606401610d63565b600954610e585760405162461bcd60e51b81526020600482015260146024820152734e6f20444b206e6565647320667265657a696e6760601b6044820152606401610d63565b6002805460ff60a01b1916600160a01b1790554360065561132f565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b158015610eaf57600080fd5b505afa158015610ec3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee79190615cb0565b600954909150600090610efc90600190615ccd565b90505b6000811261131f57600060098281548110610f1c57610f1c615d0c565b906000526020600020015490506000600860098481548110610f4057610f40615d0c565b906000526020600020015481548110610f5b57610f5b615d0c565b60009182526020909120600260049092020101546001600160a01b03169050838015610ff55750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b158015610fbb57600080fd5b505afa158015610fcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff39190615cb0565b155b1561110f57806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561103557600080fd5b505af1158015611049573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561108657600080fd5b505afa15801561109a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110be9190615cb0565b61110a5760405162461bcd60e51b815260206004820152601e60248201527f536f6d6520444b206e6f7420696e205265736f6c76696e6720706861736500006044820152606401610d63565b61130c565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561114857600080fd5b505afa15801561115c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111809190615cb0565b6111cc5760405162461bcd60e51b815260206004820152601e60248201527f536f6d6520444b206e6f7420696e205265736f6c76696e6720706861736500006044820152606401610d63565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561120557600080fd5b505afa158015611219573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123d9190615d22565b61130c5760006008838154811061125657611256615d0c565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b1990921691909117905560095461129290600190615ccd565b8312156112e457600980546112a990600190615c99565b815481106112b9576112b9615d0c565b9060005260206000200154600984815481106112d7576112d7615d0c565b6000918252602090912001555b60098054806112f5576112f5615d3b565b600190038181906000526020600020016000905590555b50508061131890615d51565b9050610eff565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161137091600160a01b90910460ff1690615b0b565b60405180910390a1565b6000546001600160a01b031633146113a45760405162461bcd60e51b8152600401610d6390615c5c565b60006007846001600160601b0316815481106113c2576113c2615d0c565b90600052602060002090600b0201905060005b835181101561156a5782156114905760008482815181106113f8576113f8615d0c565b60200260200101511180156114295750600854845185908390811061141f5761141f615d0c565b6020026020010151105b6114665760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610d63565b61148b8585838151811061147c5761147c615d0c565b60200260200101516001614ba1565b611558565b6001600160601b03851660011480156114e65750600060088583815181106114ba576114ba615d0c565b6020026020010151815481106114d2576114d2615d0c565b906000526020600020906004020160000154145b156115335760405162461bcd60e51b815260206004820181905260248201527f43616e27742064697361626c6520526f6f7420444b20696e2047656e6572616c6044820152606401610d63565b6115588585838151811061154957611549615d0c565b60200260200101516000614ba1565b8061156281615d6f565b9150506113d5565b5050505050565b6008818154811061158157600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106115cf576115cf615d0c565b600091825260208220600490910201805460078054929450916001600160601b0390911690811061160257611602615d0c565b6000918252602082206003850154600b90920201925061162490600190615c99565b9050600083600301828154811061163d5761163d615d0c565b6000918252602082206007909102019150600185015460ff16600481111561166757611667615930565b141561179a5760008211806116b957506001840154600684019060ff16600481111561169557611695615930565b600481106116a5576116a5615d0c565b015460028501546116b69042615c99565b10155b6117055760405162461bcd60e51b815260206004820152601e60248201527f45766964656e6365206e6f7420706173736564202626202141707065616c00006044820152606401610d63565b60038101546006820154146117545760405162461bcd60e51b815260206004820152601560248201527444697370757465207374696c6c2064726177696e6760581b6044820152606401610d63565b8254600160601b900460ff1661176b57600261176e565b60015b60018086018054909160ff199091169083600481111561179057611790615930565b0217905550611bd6565b60018085015460ff1660048111156117b4576117b4615930565b1415611905576001840154600684019060ff1660048111156117d8576117d8615930565b600481106117e8576117e8615d0c565b015460028501546117f99042615c99565b1015806118a25750600881600001548154811061181857611818615d0c565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b15801561186a57600080fd5b505afa15801561187e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a29190615cb0565b6118ee5760405162461bcd60e51b815260206004820152601860248201527f436f6d6d697420706572696f64206e6f742070617373656400000000000000006044820152606401610d63565b6001808501805460029260ff199091169083611790565b6002600185015460ff16600481111561192057611920615930565b1415611aa8576001840154600684019060ff16600481111561194457611944615930565b6004811061195457611954615d0c565b015460028501546119659042615c99565b101580611a0e5750600881600001548154811061198457611984615d0c565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b1580156119d657600080fd5b505afa1580156119ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0e9190615cb0565b611a535760405162461bcd60e51b8152602060048201526016602482015275159bdd19481c195c9a5bd9081b9bdd081c185cdcd95960521b6044820152606401610d63565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611bd6565b6003600185015460ff166004811115611ac357611ac3615930565b1415611b6d576001840154600684019060ff166004811115611ae757611ae7615930565b60048110611af757611af7615d0c565b01546002850154611b089042615c99565b1015611b565760405162461bcd60e51b815260206004820152601860248201527f41707065616c20706572696f64206e6f742070617373656400000000000000006044820152606401610d63565b6001808501805460049260ff199091169083611790565b6004600185015460ff166004811115611b8857611b88615930565b1415611bd65760405162461bcd60e51b815260206004820152601760248201527f4469737075746520706572696f642069732066696e616c0000000000000000006044820152606401610d63565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611c159160ff1690615d8a565b60405180910390a25050505050565b600080600a8381548110611c3a57611c3a615d0c565b6000918252602082206003600490920201908101805491935090611c6090600190615c99565b81548110611c7057611c70615d0c565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611ca357611ca3615d0c565b90600052602060002090600b02019050806005015482600301541015611cce57506000949350505050565b80546007805490916001600160601b0316908110611cee57611cee615d0c565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600a8381548110611d3157611d31615d0c565b6000918252602082206003600490920201908101805491935090611d5790600190615c99565b81548110611d6757611d67615d0c565b9060005260206000209060070201905060006008826000015481548110611d9057611d90615d0c565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018790526001600160a01b031691508190631c3db16d9060240160206040518083038186803b158015611de557600080fd5b505afa158015611df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1d9190615d22565b95945050505050565b60078181548110611e3657600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000828152600c60205260408120600201805483908110611ea057611ea0615d0c565b906000526020600020015490505b92915050565b6000546001600160a01b03163314611ede5760405162461bcd60e51b8152600401610d6390615c5c565b8660078a6001600160601b031681548110611efb57611efb615d0c565b90600052602060002090600b0201600201541115611f2b5760405162461bcd60e51b8152600401610d6390615d98565b6000815111611f6c5760405162461bcd60e51b815260206004820152600d60248201526c21537570706f7274656420444b60981b6044820152606401610d63565b6001600160601b038916611fc25760405162461bcd60e51b815260206004820181905260248201527f496e76616c69643a20466f726b696e6720636f75727420617320706172656e746044820152606401610d63565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b83518110156120df57600084828151811061201757612017615d0c565b60200260200101511180156120485750600854845185908390811061203e5761203e615d0c565b6020026020010151105b6120855760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610d63565b600182600a01600086848151811061209f5761209f615d0c565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806120d790615d6f565b915050611ffa565b5080546bffffffffffffffffffffffff19166001600160601b038c16178155604080516000815260208101918290525161211d9160018401916154b9565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556121609060068301908790615504565b5060405163483abc4f60e11b8152600c600482015260248101839052604481018590527348ce286978C74c288eA6Bc9a536BcC899DF8D17790639075789e9060640160006040518083038186803b1580156121ba57600080fd5b505af41580156121ce573d6000803e3d6000fd5b5050505060078b6001600160601b0316815481106121ee576121ee615d0c565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907f2e689e2ae8e3c8e02797c3ff9998e8297e587a74bc6d0e48b6b5991f70991d1c9061225d908e908e908e908e908e908e908e908e90615dcd565b60405180910390a35050505050505050505050565b6000600a848154811061228757612287615d0c565b600091825260209091206004918202019150600182015460ff1660048111156122b2576122b2615930565b146122f35760405162461bcd60e51b815260206004820152601160248201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b6044820152606401610d63565b600081600301848154811061230a5761230a615d0c565b906000526020600020906007020190506000600882600001548154811061233357612333615d0c565b60009182526020822060049182020160020154908401546001600160a01b039091169250612362908690615e25565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b1580156123bb57600080fd5b505afa1580156123cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f39190615d22565b90506000808261240e5783861115612409578395505b61242e565b612419846002615e3d565b86111561242e5761242b846002615e3d565b95505b60048801545b86811015612af7578481101561286c57604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b15801561249257600080fd5b505afa1580156124a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ca9190615d22565b91506127108211156124dc5761271091505b60006127106124eb8482615c99565b8b600101546124fa9190615e3d565b6125049190615e72565b90506125108188615e25565b965089600601828154811061252757612527615d0c565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b03168552600201909252908220805491965083929091612574908490615c99565b90915550508a546007805483926001600160601b031690811061259957612599615d0c565b90600052602060002090600b0201600201546125b59190615e25565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b0316845260010190915290205410612649576001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152812054612627908390615c99565b8c549091506126429086906001600160601b03168385614c29565b505061269a565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b031684526001019091529020541561269a578a546126989085906001600160601b0316600084614c29565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b1580156126e857600080fd5b505afa1580156126fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127209190615cb0565b6127bd5760005b6001600160a01b0385166000908152600b60205260409020548110156127bb576001600160a01b0385166000908152600b6020526040902080546127a89187918490811061277757612777615d0c565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316600080614c29565b50806127b381615d6f565b915050612727565b505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e196127f284615e86565b60408051918252600060208301520160405180910390a3612814600187615c99565b8214156128665784612866576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f1505060005461286493506001600160a01b03169150899050615243565b505b50612ae5565b6001600160a01b038816634fe264fb8e8e6128878986615ea3565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b1580156128cb57600080fd5b505afa1580156128df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129039190615d22565b91506127108211156129155761271091505b600689016129238683615ea3565b8154811061293357612933615d0c565b60009182526020909120015460018a01546001600160a01b03909116935061271090612960908490615e3d565b61296a9190615e72565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600201909152812080549091906129aa908490615c99565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b03168452600101909152902054612a12576000612710838b600101546129f99190615e3d565b612a039190615e72565b9050612a0f8482615243565b50505b600061271083612a22878a615e72565b612a2c9190615e3d565b612a369190615e72565b9050600061271084878d60020154612a4e9190615e72565b612a589190615e3d565b612a629190615e72565b9050612a6e8583615243565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e198484604051612ada929190918252602082015260400190565b60405180910390a350505b80612aef81615d6f565b915050612434565b5084886005015414612b0b57600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff166001811115612b3d57612b3d615930565b14612b7c5760405162461bcd60e51b815260206004820152600f60248201526e10a9ba30b5b4b73390383430b9b29760891b6044820152606401610d63565b6000600e54600183600f54612b919190615e25565b612b9b9190615c99565b11612ba65781612bc1565b600f54600e54612bb69190615c99565b612bc1906001615e25565b9050600081600f54612bd39190615e25565b600f549091505b81811015612c52576000818152600d60205260409020805460018201546002830154612c22926001600160a01b03811692600160a01b9091046001600160601b031691614c29565b50506000818152600d60205260408120818155600181018290556002015580612c4a81615d6f565b915050612bda565b50600f555050565b612c62615531565b60006007836001600160601b031681548110612c8057612c80615d0c565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b815481526020019060010190808311612cab575050505050915050919050565b6000546001600160a01b03163314612cf55760405162461bcd60e51b8152600401610d6390615c5c565b6001600160601b03821660011480612d68575080600780846001600160601b031681548110612d2657612d26615d0c565b60009182526020909120600b909102015481546001600160601b03909116908110612d5357612d53615d0c565b90600052602060002090600b02016002015411155b612d845760405162461bcd60e51b8152600401610d6390615d98565b60005b6007836001600160601b031681548110612da357612da3615d0c565b90600052602060002090600b020160010180549050811015612e5c5781600780856001600160601b031681548110612ddd57612ddd615d0c565b90600052602060002090600b02016001018381548110612dff57612dff615d0c565b906000526020600020015481548110612e1a57612e1a615d0c565b90600052602060002090600b0201600201541015612e4a5760405162461bcd60e51b8152600401610d6390615d98565b80612e5481615d6f565b915050612d87565b50806007836001600160601b031681548110612e7a57612e7a615d0c565b90600052602060002090600b020160020181905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600890820152676d696e5374616b6560c01b604082015260600190565b60405180910390a25050565b606060088281548110612ef257612ef2615d0c565b9060005260206000209060040201600101805480602002602001604051908101604052809291908181526020018280548015612f4d57602002820191906000526020600020905b815481526020019060010190808311612f39575b50505050509050919050565b600a8181548110612f6957600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b6000546001600160a01b03163314612fdf5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b031681548110612ffc57612ffc615d0c565b90600052602060002090600b020160060190600461301b929190615504565b50816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b6000546001600160a01b0316331461308e5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b0316815481106130ab576130ab615d0c565b90600052602060002090600b020160040181905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b600080600a838154811061311b5761311b615d0c565b600091825260208220600360049092020190810180549193509061314190600190615c99565b8154811061315157613151615d0c565b600091825260208220845460078054938102909201945090916001600160601b0390911690811061318457613184615d0c565b90600052602060002090600b0201905080600501548260030154106132235782546001600160601b0316600114156131c5576001600160ff1b03935061324d565b60038201546131d5906002615e3d565b6131e0906001615e25565b81546007805490916001600160601b031690811061320057613200615d0c565b90600052602060002090600b02016004015461321c9190615e3d565b935061324d565b6003820154613233906002615e3d565b61323e906001615e25565b8160040154611e1d9190615e3d565b505050919050565b6000546001600160a01b0316331461327f5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b03168154811061329c5761329c615d0c565b90600052602060002090600b020160030181905550816001600160601b0316600080516020615f8b833981519152604051612ed190602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b0316331461331a5760405162461bcd60e51b8152600401610d6390615c5c565b6000836001600160a01b031683836040516133359190615ee3565b60006040518083038185875af1925050503d8060008114613372576040519150601f19603f3d011682016040523d82523d6000602084013e613377565b606091505b50509050806133bc5760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610d63565b50505050565b6133cf3383836000614c29565b61340c5760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610d63565b5050565b6000546001600160a01b0316331461343a5760405162461bcd60e51b8152600401610d6390615c5c565b600355565b6000806000806060600080600a898154811061345d5761345d615d0c565b9060005260206000209060040201600301888154811061347f5761347f615d0c565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561350157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116134e3575b50505050509150965096509650965096509650509295509295509295565b6000600a828154811061353457613534615d0c565b600091825260209091206004918202019150600182015460ff16600481111561355f5761355f615930565b146135a05760405162461bcd60e51b815260206004820152601160248201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b6044820152606401610d63565b6001810154610100900460ff16156135fa5760405162461bcd60e51b815260206004820152601760248201527f52756c696e6720616c72656164792065786563757465640000000000000000006044820152606401610d63565b600061360583611d1b565b60018301805461ff001916610100179055825460405163188d362b60e11b815260048101869052602481018390529192506001600160a01b03600160601b909104169063311a6c5690604401600060405180830381600087803b15801561366b57600080fd5b505af115801561367f573d6000803e3d6000fd5b50505050505050565b6009818154811061369857600080fd5b600091825260209091200154905081565b6000806000600a84815481106136c1576136c1615d0c565b60009182526020822060036004909202019081018054919350906136e790600190615c99565b815481106136f7576136f7615d0c565b90600052602060002090600702019050600881600001548154811061371e5761371e615d0c565b6000918252602090912060049182020160020154604051639b05c26160e01b81529182018790526001600160a01b031690639b05c26190602401604080518083038186803b15801561376f57600080fd5b505afa158015613783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a79190615eff565b90969095509350505050565b6000546001600160a01b031633146137dd5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b0316815481106137fa576137fa615d0c565b90600052602060002090600b020160050181905550816001600160601b0316600080516020615f8b833981519152604051612ed19060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a848154811061387357613873615d0c565b6000918252602090912060049091020190506003600182015460ff1660048111156138a0576138a0615930565b14156138f9576002810154815460078054929550916001600160601b039091169081106138cf576138cf615d0c565b600091825260209091206009600b90920201015460028201546138f29190615e25565b9150613902565b60009250600091505b50915091565b6000546001600160a01b031633146139325760405162461bcd60e51b8152600401610d6390615c5c565b600455565b60006001600254600160a01b900460ff16600181111561395957613959615930565b14801561397457506004546005546139719042615c99565b10155b905090565b600061398482614a22565b3410156139d35760405162461bcd60e51b815260206004820181905260248201527f45544820746f6f206c6f7720666f72206172626974726174696f6e20636f73746044820152606401610d63565b6000806139df8461530f565b92505091506007826001600160601b031681548110613a0057613a00615d0c565b60009182526020808320848452600a600b90930201919091019052604090205460ff16613a6f5760405162461bcd60e51b815260206004820152601a60248201527f444b20756e737570706f7274656420627920737562636f7572740000000000006044820152606401610d63565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa909101556008805492965090929184908110613afa57613afa615d0c565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b03909116908110613b3b57613b3b615d0c565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613b7a9034615e72565b600380830191909155858255820154600283015461271091613b9b91615e3d565b613ba59190615e72565b60018201553460028201556008805486908110613bc457613bc4615d0c565b906000526020600020906004020160020160149054906101000a900460ff16613c5b57600160088681548110613bfc57613bfc615d0c565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede54091613c90918b918e918e91600401615f24565b600060405180830381600087803b158015613caa57600080fd5b505af1158015613cbe573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b03163314613d255760405162461bcd60e51b8152600401610d6390615c5c565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b613d5083613105565b341015613d9f5760405162461bcd60e51b815260206004820152601b60248201527f45544820746f6f206c6f7720666f722061707065616c20636f737400000000006044820152606401610d63565b6000600a8481548110613db457613db4615d0c565b6000918252602090912060049091020190506003600182015460ff166004811115613de157613de1615930565b14613e275760405162461bcd60e51b815260206004820152601660248201527544697370757465206e6f742061707065616c61626c6560501b6044820152606401610d63565b60038101805460009190613e3d90600190615c99565b81548110613e4d57613e4d615d0c565b906000526020600020906007020190506008816000015481548110613e7457613e74615d0c565b60009182526020909120600490910201600201546001600160a01b03163314613ed25760405162461bcd60e51b815260206004820152601060248201526f44697370757465204b6974206f6e6c7960801b6044820152606401610d63565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019183908110613f1357613f13615d0c565b90600052602060002090600b020160050154846003015410614117576007836001600160601b031681548110613f4b57613f4b615d0c565b600091825260208220600b90910201546001600160601b031693505b600a81101561405c576007846001600160601b031681548110613f8c57613f8c615d0c565b60009182526020808320868452600a600b90930201919091019052604090205460ff1615613fb95761405c565b600060088481548110613fce57613fce615d0c565b906000526020600020906004020160000154146140115760088381548110613ff857613ff8615d0c565b906000526020600020906004020160000154925061404a565b6007846001600160601b03168154811061402d5761402d615d0c565b60009182526020909120600b90910201546001600160601b031693505b8061405481615d6f565b915050613f67565b506007836001600160601b03168154811061407957614079615d0c565b60009182526020808320858452600a600b90930201919091019052604090205460ff166140a557600192505b84546001600160601b0384811691161461411757845460038601546001600160601b03909116906140d890600190615c99565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546bffffffffffffffffffffffff19166001600160601b038416908117865560018601805460ff191690554260028701556007805460009290811061415f5761415f615d0c565b90600052602060002090600b0201905080600401543461417f9190615e72565b82600301819055506127108160030154826002015461419e9190615e3d565b6141a89190615e72565b600183015534600283015582825560088054849081106141ca576141ca615d0c565b906000526020600020906004020160020160149054906101000a900460ff166142615760016008848154811061420257614202615d0c565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b8454825414614347578454600387015461427d90600190615c99565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460088260000154815481106142cb576142cb615d0c565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede54092614314928e928e928e929101615f24565b600060405180830381600087803b15801561432e57600080fd5b505af1158015614342573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516143b79190615d8a565b60405180910390a2505050505050505050565b600080600a83815481106143e0576143e0615d0c565b9060005260206000209060040201905080600301600182600301805490506144089190615c99565b8154811061441857614418615d0c565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff16600181111561445257614452615930565b1461448d5760405162461bcd60e51b815260206004820152600b60248201526a57726f6e6720706861736560a81b6044820152606401610d63565b6000600a83815481106144a2576144a2615d0c565b906000526020600020906004020190506000600182600301805490506144c89190615c99565b905060008260030182815481106144e1576144e1615d0c565b6000918252602082206007909102019150600184015460ff16600481111561450b5761450b615930565b1461454b5760405162461bcd60e51b815260206004820152601060248201526f08515d9a59195b98d9481c195c9a5bd960821b6044820152606401610d63565b6000600882600001548154811061456457614564615d0c565b60009182526020822060026004909202010154600684015460038501546001600160a01b039092169350919061459a8884615e25565b11156145aa5783600301546145b4565b6145b48783615e25565b9050815b8181101561471a57604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b15801561460557600080fd5b505af1158015614619573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061463d9190615f6d565b90506001600160a01b038116156147075760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614693908490615e25565b909155505060068601805460018101825560009182526020918290200180546001600160a01b0319166001600160a01b038416908117909155604080518a81529283018590528c927f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a35b508061471281615d6f565b9150506145b8565b505050505050505050565b6060600980548060200260200160405190810160405280929190818152602001828054801561477357602002820191906000526020600020905b81548152602001906001019080831161475f575b5050505050905090565b6000546001600160a01b031633146147a75760405162461bcd60e51b8152600401610d6390615c5c565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146147f35760405162461bcd60e51b8152600401610d6390615c5c565b60085480821061482f5760405162461bcd60e51b81526020600482015260076024820152660854185c995b9d60ca1b6044820152606401610d63565b600082156148ac576008838154811061484a5761484a615d0c565b90600052602060002090600402016003015460016148689190615e25565b9050600a81106148ac5760405162461bcd60e51b815260206004820152600f60248201526e088cae0e8d040d8caeccad840dac2f608b1b6044820152606401610d63565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee38101918255915180519394919361495e937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee4019291909101906154b9565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b039093169290921791909117905560809091015160039091015560088054849081106149b8576149b8615d0c565b600091825260208083206001600490930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a4826133bc576133bc6001836001614ba1565b6000806000614a308461530f565b5091509150806007836001600160601b031681548110614a5257614a52615d0c565b90600052602060002090600b020160040154614a6e9190615e3d565b949350505050565b6000546001600160a01b03163314614aa05760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b031681548110614abd57614abd615d0c565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b6000600a8281548110614b3f57614b3f615d0c565b600091825260209091206003600490920201015492915050565b60006007836001600160601b031681548110614b7757614b77615d0c565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b806007846001600160601b031681548110614bbe57614bbe615d0c565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b60006001600160601b0384161580614c4b57506007546001600160601b038516115b15614c5857506000614a6e565b6001600160a01b0385166000908152600b6020526040812090614c7b8787615393565b604051637521ccb160e01b8152600c60048201526001600160601b0388166024820152604481018290529091506000907348ce286978C74c288eA6Bc9a536BcC899DF8D17790637521ccb19060640160206040518083038186803b158015614ce257600080fd5b505af4158015614cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d1a9190615d22565b90508515614da8576007876001600160601b031681548110614d3e57614d3e615d0c565b90600052602060002090600b020160020154861080614d7657506001600160601b038716600090815260028401602052604090205486105b15614d875760009350505050614a6e565b80158015614d9757508254600411155b15614da85760009350505050614a6e565b6000600254600160a01b900460ff166001811115614dc857614dc8615930565b14614e74576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e60008154614e1390615d6f565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b039093169290921782558201516001808301919091556060909201516002909101559350614a6e92505050565b6000818710614ef157614e878288615c99565b90508015614edf57614e9a8930836153db565b15614ee45781614edf578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b6150c6565b6000945050505050614a6e565b8661508e576001600160601b03881660009081526002850160205260409020548690614f1d9084615c99565b614f279190615c99565b90508015614edf57614f398982615243565b15614ee45760005b845481101561508857886001600160601b0316856000018281548110614f6957614f69615d0c565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031614156150765784548590614fa690600190615c99565b81548110614fb657614fb6615d0c565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316856000018281548110614ff457614ff4615d0c565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b031602179055508460000180548061504057615040615d3b565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055615088565b8061508081615d6f565b915050614f41565b506150c6565b856150998884615c99565b6150a39190615c99565b905080156150c6576150b58982615243565b6150c6576000945050505050614a6e565b6001600160601b038816600090815260018501602052604081205488906150ee908590615c99565b6150f89190615e25565b6001600160601b038a16600081815260018801602052604081208390559192505b816151dc57604051631712e1c560e11b8152600c600482015260248101829052604481018b9052606481018790527348ce286978C74c288eA6Bc9a536BcC899DF8D17790632e25c38a9060840160006040518083038186803b15801561517e57600080fd5b505af4158015615192573d6000803e3d6000fd5b5050505060018114156151a85760019150615119565b600781815481106151bb576151bb615d0c565b60009182526020909120600b90910201546001600160601b03169050615119565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600093849384939116916152a39190615ee3565b6000604051808303816000865af19150503d80600081146152e0576040519150601f19603f3d011682016040523d82523d6000602084013e6152e5565b606091505b5091509150818015611e1d575080511580611e1d575080806020019051810190611e1d9190615cb0565b60008060006040845110615381575050506020810151604082015160608301516001600160601b038316158061535057506007546001600160601b03841610155b1561535a57600192505b8161536457600391505b80158061537357506008548110155b1561537c575060015b61538c565b506001915060039050815b9193909250565b600060405160005b60148110156153b6578481600c011a8183015360010161539b565b5060145b60208110156153d25783811a818301536001016153ba565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600093849384939116916154439190615ee3565b6000604051808303816000865af19150503d8060008114615480576040519150601f19603f3d011682016040523d82523d6000602084013e615485565b606091505b50915091508180156154af5750805115806154af5750808060200190518101906154af9190615cb0565b9695505050505050565b8280548282559060005260206000209081019282156154f4579160200282015b828111156154f45782518255916020019190600101906154d9565b5061550092915061554f565b5090565b82600481019282156154f457916020028201828111156154f45782518255916020019190600101906154d9565b60405180608001604052806004906020820280368337509192915050565b5b808211156155005760008155600101615550565b6001600160a01b038116811461557957600080fd5b50565b60006020828403121561558e57600080fd5b813561559981615564565b9392505050565b80356001600160601b03811681146155b757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156155fb576155fb6155bc565b604052919050565b600082601f83011261561457600080fd5b8135602067ffffffffffffffff821115615630576156306155bc565b8160051b61563f8282016155d2565b928352848101820192828101908785111561565957600080fd5b83870192505b848310156156785782358252918301919083019061565f565b979650505050505050565b801515811461557957600080fd5b6000806000606084860312156156a657600080fd5b6156af846155a0565b9250602084013567ffffffffffffffff8111156156cb57600080fd5b6156d786828701615603565b92505060408401356156e881615683565b809150509250925092565b60006020828403121561570557600080fd5b5035919050565b6000806040838503121561571f57600080fd5b50508035926020909101359150565b600082601f83011261573f57600080fd5b6040516080810181811067ffffffffffffffff82111715615762576157626155bc565b60405280608084018581111561577757600080fd5b845b81811015615791578035835260209283019201615779565b509195945050505050565b60008060008060008060008060006101808a8c0312156157bb57600080fd5b6157c48a6155a0565b985060208a01356157d481615683565b975060408a0135965060608a0135955060808a0135945060a08a013593506157ff8b60c08c0161572e565b92506101408a013591506101608a013567ffffffffffffffff81111561582457600080fd5b6158308c828d01615603565b9150509295985092959850929598565b60008060006060848603121561585557600080fd5b505081359360208301359350604090920135919050565b60006020828403121561587e57600080fd5b615599826155a0565b8060005b60048110156133bc57815184526020938401939091019060010161588b565b60808101611eae8284615887565b600080604083850312156158cb57600080fd5b6158d4836155a0565b946020939093013593505050565b600081518084526020808501945080840160005b83811015615912578151875295820195908201906001016158f6565b509495945050505050565b60208152600061559960208301846158e2565b634e487b7160e01b600052602160045260246000fd5b6005811061595657615956615930565b9052565b6001600160601b03861681526001600160a01b038516602082015260a081016159866040830186615946565b9215156060820152608001529392505050565b60008060a083850312156159ac57600080fd5b6159b5836155a0565b91506159c4846020850161572e565b90509250929050565b600082601f8301126159de57600080fd5b813567ffffffffffffffff8111156159f8576159f86155bc565b615a0b601f8201601f19166020016155d2565b818152846020838601011115615a2057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215615a5257600080fd5b8335615a5d81615564565b925060208401359150604084013567ffffffffffffffff811115615a8057600080fd5b615a8c868287016159cd565b9150509250925092565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b81811015615af25784516001600160a01b031683529383019391830191600101615acd565b50508093505050508260a0830152979650505050505050565b6020810160028310615b1f57615b1f615930565b91905290565b60008060408385031215615b3857600080fd5b82359150602083013567ffffffffffffffff811115615b5657600080fd5b615b62858286016159cd565b9150509250929050565b600080600060608486031215615b8157600080fd5b8335925060208401359150604084013567ffffffffffffffff811115615a8057600080fd5b60008060408385031215615bb957600080fd5b8235615bc481615564565b91506159c4602084016155a0565b60008060408385031215615be557600080fd5b82356158d481615564565b600060208284031215615c0257600080fd5b813567ffffffffffffffff811115615c1957600080fd5b614a6e848285016159cd565b60008060408385031215615c3857600080fd5b615c41836155a0565b91506020830135615c5181615683565b809150509250929050565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015615cab57615cab615c83565b500390565b600060208284031215615cc257600080fd5b815161559981615683565b60008083128015600160ff1b850184121615615ceb57615ceb615c83565b6001600160ff1b0384018313811615615d0657615d06615c83565b50500390565b634e487b7160e01b600052603260045260246000fd5b600060208284031215615d3457600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b821415615d6757615d67615c83565b506000190190565b6000600019821415615d8357615d83615c83565b5060010190565b60208101611eae8284615946565b6020808252818101527f4d696e5374616b65206c6f776572207468616e20706172656e7420636f757274604082015260600190565b60006101608a15158352896020840152886040840152876060840152866080840152615dfc60a0840187615887565b8461012084015280610140840152615e16818401856158e2565b9b9a5050505050505050505050565b60008219821115615e3857615e38615c83565b500190565b6000816000190483118215151615615e5757615e57615c83565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615e8157615e81615e5c565b500490565b6000600160ff1b821415615e9c57615e9c615c83565b5060000390565b600082615eb257615eb2615e5c565b500690565b60005b83811015615ed2578181015183820152602001615eba565b838111156133bc5750506000910152565b60008251615ef5818460208701615eb7565b9190910192915050565b60008060408385031215615f1257600080fd5b825191506020830151615c5181615683565b8481528360208201526080604082015260008351806080840152615f4f8160a0850160208801615eb7565b606083019390935250601f91909101601f19160160a0019392505050565b600060208284031215615f7f57600080fd5b81516155998161556456fefb75175e7dd144a612469a4316b0a6e4cee24cb54400dfdc7bfe1546cd0e309da2646970667358221220bab7ca22ba7f0c78e8966a0b829254e7d3e1b2cbc13dda910dd083e0c8d0af6464736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106103cd5760003560e01c8063823cfd70116101fd578063c13517e111610118578063e4c0aaf4116100ab578063f7434ea91161007a578063f7434ea914610c99578063f8bdb57b14610cb9578063fbf405b014610cd9578063fc6f8f1614610cf9578063fe524c3914610d1957600080fd5b8063e4c0aaf414610bbb578063eaff425a14610bdb578063f12ada8b14610bf0578063f6b4d82d14610c1057600080fd5b8063cf0c38f8116100e7578063cf0c38f814610b08578063d1c1df4814610b28578063d2b8035a14610b86578063d8b03fd814610ba657600080fd5b8063c13517e114610aa2578063c258bb1914610ab5578063c356990214610ad5578063c71f425314610ae857600080fd5b8063b1c9fe6e11610190578063b70c4e941161015f578063b70c4e94146109fd578063b888adfa14610a12578063bfabfe8f14610a28578063c057eca714610a8c57600080fd5b8063b1c9fe6e14610984578063b2866af7146109b2578063b31b4540146109d2578063b4a61608146109e857600080fd5b80638edf4741116101cc5780638edf4741146108da5780639b05c261146108fa578063a57366e71461092f578063afe15cfb1461094f57600080fd5b8063823cfd701461084d578063840bc19c1461086d5780638a9bb02a146108885780638bb04875146108ba57600080fd5b806334d5fb31116102ed57806357260364116102805780636235593f1161024f5780636235593f146107e35780636c1eb1b9146107f8578063751accd01461080d5780637717a6e81461082d57600080fd5b8063572603641461076357806359354c771461078357806359ec827e146107a35780635bc24dd3146107c357600080fd5b80633e1d09be116102bc5780633e1d09be146106cf57806343d4137f146106ef578063564a565d1461071c57806356acb0501461074d57600080fd5b806334d5fb311461065757806335975f4a1461066c5780633a1578601461068c5780633cfd1184146106a257600080fd5b806319b81529116103655780632922d604116103345780632922d604146105e15780632b6a63f1146106015780632d29a47b146106215780632ea7b4d01461064157600080fd5b806319b815291461050d5780631c3db16d1461053d5780631f5a0dd21461055d57806327e6ec8a146105b457600080fd5b80630d1b9d1a116103a15780630d1b9d1a146104665780630d83b940146104b45780630e083ec9146104d7578063115d5376146104ed57600080fd5b8062f5822c146103d25780630b274f2e146103f45780630b7414bc146104095780630c340a2414610429575b600080fd5b3480156103de57600080fd5b506103f26103ed36600461557c565b610d39565b005b34801561040057600080fd5b506103f2610d8e565b34801561041557600080fd5b506103f2610424366004615691565b61137a565b34801561043557600080fd5b50600054610449906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561047257600080fd5b506104866104813660046156f3565b611571565b604080519485526001600160a01b03909316602085015290151591830191909152606082015260800161045d565b3480156104c057600080fd5b506104c9600181565b60405190815260200161045d565b3480156104e357600080fd5b506104c9600e5481565b3480156104f957600080fd5b506103f26105083660046156f3565b6115ba565b34801561051957600080fd5b5061052d6105283660046156f3565b611c24565b604051901515815260200161045d565b34801561054957600080fd5b506104c96105583660046156f3565b611d1b565b34801561056957600080fd5b5061057d6105783660046156f3565b611e26565b604080516001600160601b0390971687529415156020870152938501929092526060840152608083015260a082015260c00161045d565b3480156105c057600080fd5b506105c9600081565b6040516001600160601b03909116815260200161045d565b3480156105ed57600080fd5b506104c96105fc36600461570c565b611e7d565b34801561060d57600080fd5b506103f261061c36600461579c565b611eb4565b34801561062d57600080fd5b506103f261063c366004615840565b612272565b34801561064d57600080fd5b506104c961271081565b34801561066357600080fd5b506105c9600181565b34801561067857600080fd5b506103f26106873660046156f3565b612b1d565b34801561069857600080fd5b506104c960065481565b3480156106ae57600080fd5b506106c26106bd36600461586c565b612c5a565b60405161045d91906158aa565b3480156106db57600080fd5b506103f26106ea3660046158b8565b612ccb565b3480156106fb57600080fd5b5061070f61070a3660046156f3565b612edd565b60405161045d919061591d565b34801561072857600080fd5b5061073c6107373660046156f3565b612f59565b60405161045d95949392919061595a565b34801561075957600080fd5b506104c9600f5481565b34801561076f57600080fd5b506103f261077e366004615999565b612fb5565b34801561078f57600080fd5b506103f261079e3660046158b8565b613064565b3480156107af57600080fd5b506104c96107be3660046156f3565b613105565b3480156107cf57600080fd5b506103f26107de3660046158b8565b613255565b3480156107ef57600080fd5b506104c9600081565b34801561080457600080fd5b506104c9600a81565b34801561081957600080fd5b506103f2610828366004615a3d565b6132f0565b34801561083957600080fd5b506103f26108483660046158b8565b6133c2565b34801561085957600080fd5b506103f26108683660046156f3565b613410565b34801561087957600080fd5b506104c96001600160ff1b0381565b34801561089457600080fd5b506108a86108a336600461570c565b61343f565b60405161045d96959493929190615a96565b3480156108c657600080fd5b506103f26108d53660046156f3565b61351f565b3480156108e657600080fd5b506104c96108f53660046156f3565b613688565b34801561090657600080fd5b5061091a6109153660046156f3565b6136a9565b6040805192835290151560208301520161045d565b34801561093b57600080fd5b506103f261094a3660046158b8565b6137b3565b34801561095b57600080fd5b5061096f61096a3660046156f3565b61385b565b6040805192835260208301919091520161045d565b34801561099057600080fd5b506002546109a590600160a01b900460ff1681565b60405161045d9190615b0b565b3480156109be57600080fd5b506103f26109cd3660046156f3565b613908565b3480156109de57600080fd5b506104c960045481565b3480156109f457600080fd5b506104c9600481565b348015610a0957600080fd5b5061052d613937565b348015610a1e57600080fd5b506104c960055481565b348015610a3457600080fd5b50610a71610a4336600461570c565b6000918252600c60209081526040808420805460028201549486526004909101909252909220549192909190565b6040805193845260208401929092529082015260600161045d565b348015610a9857600080fd5b506104c960035481565b6104c9610ab0366004615b25565b613979565b348015610ac157600080fd5b506103f2610ad036600461557c565b613cfb565b6103f2610ae3366004615b6c565b613d47565b348015610af457600080fd5b506104c9610b033660046156f3565b6143ca565b348015610b1457600080fd5b50600254610449906001600160a01b031681565b348015610b3457600080fd5b5061096f610b43366004615ba6565b6001600160a01b03919091166000908152600b602090815260408083206001600160601b0390941683526001840182528083205460029094019091529020549091565b348015610b9257600080fd5b506103f2610ba136600461570c565b614432565b348015610bb257600080fd5b5061070f614725565b348015610bc757600080fd5b506103f2610bd636600461557c565b61477d565b348015610be757600080fd5b506104c9600381565b348015610bfc57600080fd5b506103f2610c0b366004615bd2565b6147c9565b348015610c1c57600080fd5b50610c67610c2b3660046156f3565b600d602052600090815260409020805460018201546002909201546001600160a01b03821692600160a01b9092046001600160601b0316919084565b604080516001600160a01b0390951685526001600160601b03909316602085015291830152606082015260800161045d565b348015610ca557600080fd5b506104c9610cb4366004615bf0565b614a22565b348015610cc557600080fd5b506103f2610cd4366004615c25565b614a76565b348015610ce557600080fd5b50600154610449906001600160a01b031681565b348015610d0557600080fd5b506104c9610d143660046156f3565b614b2a565b348015610d2557600080fd5b5061052d610d343660046158b8565b614b59565b6000546001600160a01b03163314610d6c5760405162461bcd60e51b8152600401610d6390615c5c565b60405180910390fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6000600254600160a01b900460ff166001811115610dae57610dae615930565b1415610e7457600354600554610dc49042615c99565b1015610e125760405162461bcd60e51b815260206004820152601960248201527f4d696e5374616b696e6754696d65206e6f7420706173736564000000000000006044820152606401610d63565b600954610e585760405162461bcd60e51b81526020600482015260146024820152734e6f20444b206e6565647320667265657a696e6760601b6044820152606401610d63565b6002805460ff60a01b1916600160a01b1790554360065561132f565b6000306001600160a01b031663b70c4e946040518163ffffffff1660e01b815260040160206040518083038186803b158015610eaf57600080fd5b505afa158015610ec3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee79190615cb0565b600954909150600090610efc90600190615ccd565b90505b6000811261131f57600060098281548110610f1c57610f1c615d0c565b906000526020600020015490506000600860098481548110610f4057610f40615d0c565b906000526020600020015481548110610f5b57610f5b615d0c565b60009182526020909120600260049092020101546001600160a01b03169050838015610ff55750806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b158015610fbb57600080fd5b505afa158015610fcf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ff39190615cb0565b155b1561110f57806001600160a01b0316630b274f2e6040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561103557600080fd5b505af1158015611049573d6000803e3d6000fd5b50505050806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561108657600080fd5b505afa15801561109a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110be9190615cb0565b61110a5760405162461bcd60e51b815260206004820152601e60248201527f536f6d6520444b206e6f7420696e205265736f6c76696e6720706861736500006044820152606401610d63565b61130c565b806001600160a01b031663c86ed8926040518163ffffffff1660e01b815260040160206040518083038186803b15801561114857600080fd5b505afa15801561115c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111809190615cb0565b6111cc5760405162461bcd60e51b815260206004820152601e60248201527f536f6d6520444b206e6f7420696e205265736f6c76696e6720706861736500006044820152606401610d63565b806001600160a01b031663034327446040518163ffffffff1660e01b815260040160206040518083038186803b15801561120557600080fd5b505afa158015611219573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061123d9190615d22565b61130c5760006008838154811061125657611256615d0c565b600091825260209091206002600490920201018054911515600160a01b0260ff60a01b1990921691909117905560095461129290600190615ccd565b8312156112e457600980546112a990600190615c99565b815481106112b9576112b9615d0c565b9060005260206000200154600984815481106112d7576112d7615d0c565b6000918252602090912001555b60098054806112f5576112f5615d3b565b600190038181906000526020600020016000905590555b50508061131890615d51565b9050610eff565b50506002805460ff60a01b191690555b426005556002546040517f31f72b44f546d9e7eaec13f65636997665e15f134a81c82924f568f5c0d07b939161137091600160a01b90910460ff1690615b0b565b60405180910390a1565b6000546001600160a01b031633146113a45760405162461bcd60e51b8152600401610d6390615c5c565b60006007846001600160601b0316815481106113c2576113c2615d0c565b90600052602060002090600b0201905060005b835181101561156a5782156114905760008482815181106113f8576113f8615d0c565b60200260200101511180156114295750600854845185908390811061141f5761141f615d0c565b6020026020010151105b6114665760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610d63565b61148b8585838151811061147c5761147c615d0c565b60200260200101516001614ba1565b611558565b6001600160601b03851660011480156114e65750600060088583815181106114ba576114ba615d0c565b6020026020010151815481106114d2576114d2615d0c565b906000526020600020906004020160000154145b156115335760405162461bcd60e51b815260206004820181905260248201527f43616e27742064697361626c6520526f6f7420444b20696e2047656e6572616c6044820152606401610d63565b6115588585838151811061154957611549615d0c565b60200260200101516000614ba1565b8061156281615d6f565b9150506113d5565b5050505050565b6008818154811061158157600080fd5b60009182526020909120600490910201805460028201546003909201549092506001600160a01b03821691600160a01b900460ff169084565b6000600a82815481106115cf576115cf615d0c565b600091825260208220600490910201805460078054929450916001600160601b0390911690811061160257611602615d0c565b6000918252602082206003850154600b90920201925061162490600190615c99565b9050600083600301828154811061163d5761163d615d0c565b6000918252602082206007909102019150600185015460ff16600481111561166757611667615930565b141561179a5760008211806116b957506001840154600684019060ff16600481111561169557611695615930565b600481106116a5576116a5615d0c565b015460028501546116b69042615c99565b10155b6117055760405162461bcd60e51b815260206004820152601e60248201527f45766964656e6365206e6f7420706173736564202626202141707065616c00006044820152606401610d63565b60038101546006820154146117545760405162461bcd60e51b815260206004820152601560248201527444697370757465207374696c6c2064726177696e6760581b6044820152606401610d63565b8254600160601b900460ff1661176b57600261176e565b60015b60018086018054909160ff199091169083600481111561179057611790615930565b0217905550611bd6565b60018085015460ff1660048111156117b4576117b4615930565b1415611905576001840154600684019060ff1660048111156117d8576117d8615930565b600481106117e8576117e8615d0c565b015460028501546117f99042615c99565b1015806118a25750600881600001548154811061181857611818615d0c565b6000918252602090912060049182020160020154604051630baa64d160e01b81529182018790526001600160a01b031690630baa64d19060240160206040518083038186803b15801561186a57600080fd5b505afa15801561187e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118a29190615cb0565b6118ee5760405162461bcd60e51b815260206004820152601860248201527f436f6d6d697420706572696f64206e6f742070617373656400000000000000006044820152606401610d63565b6001808501805460029260ff199091169083611790565b6002600185015460ff16600481111561192057611920615930565b1415611aa8576001840154600684019060ff16600481111561194457611944615930565b6004811061195457611954615d0c565b015460028501546119659042615c99565b101580611a0e5750600881600001548154811061198457611984615d0c565b60009182526020909120600491820201600201546040516336a66c7560e11b81529182018790526001600160a01b031690636d4cd8ea9060240160206040518083038186803b1580156119d657600080fd5b505afa1580156119ea573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a0e9190615cb0565b611a535760405162461bcd60e51b8152602060048201526016602482015275159bdd19481c195c9a5bd9081b9bdd081c185cdcd95960521b6044820152606401610d63565b600184018054600360ff199091161790558354604051600160601b9091046001600160a01b03169086907fa5d41b970d849372be1da1481ffd78d162bfe57a7aa2fe4e5fb73481fa5ac24f90600090a3611bd6565b6003600185015460ff166004811115611ac357611ac3615930565b1415611b6d576001840154600684019060ff166004811115611ae757611ae7615930565b60048110611af757611af7615d0c565b01546002850154611b089042615c99565b1015611b565760405162461bcd60e51b815260206004820152601860248201527f41707065616c20706572696f64206e6f742070617373656400000000000000006044820152606401610d63565b6001808501805460049260ff199091169083611790565b6004600185015460ff166004811115611b8857611b88615930565b1415611bd65760405162461bcd60e51b815260206004820152601760248201527f4469737075746520706572696f642069732066696e616c0000000000000000006044820152606401610d63565b426002850155600184015460405186917f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9191611c159160ff1690615d8a565b60405180910390a25050505050565b600080600a8381548110611c3a57611c3a615d0c565b6000918252602082206003600490920201908101805491935090611c6090600190615c99565b81548110611c7057611c70615d0c565b600091825260208220845460078054938102909201945090916001600160601b03909116908110611ca357611ca3615d0c565b90600052602060002090600b02019050806005015482600301541015611cce57506000949350505050565b80546007805490916001600160601b0316908110611cee57611cee615d0c565b6000918252602080832094548352600a600b9092029094010190925250604090205460ff16159392505050565b600080600a8381548110611d3157611d31615d0c565b6000918252602082206003600490920201908101805491935090611d5790600190615c99565b81548110611d6757611d67615d0c565b9060005260206000209060070201905060006008826000015481548110611d9057611d90615d0c565b6000918252602090912060049182020160020154604051631c3db16d60e01b81529182018790526001600160a01b031691508190631c3db16d9060240160206040518083038186803b158015611de557600080fd5b505afa158015611df9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1d9190615d22565b95945050505050565b60078181548110611e3657600080fd5b60009182526020909120600b9091020180546002820154600383015460048401546005909401546001600160601b0384169550600160601b90930460ff1693919290919086565b6000828152600c60205260408120600201805483908110611ea057611ea0615d0c565b906000526020600020015490505b92915050565b6000546001600160a01b03163314611ede5760405162461bcd60e51b8152600401610d6390615c5c565b8660078a6001600160601b031681548110611efb57611efb615d0c565b90600052602060002090600b0201600201541115611f2b5760405162461bcd60e51b8152600401610d6390615d98565b6000815111611f6c5760405162461bcd60e51b815260206004820152600d60248201526c21537570706f7274656420444b60981b6044820152606401610d63565b6001600160601b038916611fc25760405162461bcd60e51b815260206004820181905260248201527f496e76616c69643a20466f726b696e6720636f75727420617320706172656e746044820152606401610d63565b60078054600181018255600091825290600b82027fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801905b83518110156120df57600084828151811061201757612017615d0c565b60200260200101511180156120485750600854845185908390811061203e5761203e615d0c565b6020026020010151105b6120855760405162461bcd60e51b815260206004820152600e60248201526d0aee4dedcce40889640d2dcc8caf60931b6044820152606401610d63565b600182600a01600086848151811061209f5761209f615d0c565b6020026020010151815260200190815260200160002060006101000a81548160ff02191690831515021790555080806120d790615d6f565b915050611ffa565b5080546bffffffffffffffffffffffff19166001600160601b038c16178155604080516000815260208101918290525161211d9160018401916154b9565b50805460ff60601b1916600160601b8b15150217815560028101899055600381018890556004808201889055600582018790556121609060068301908790615504565b5060405163483abc4f60e11b8152600c6004820152602481018390526044810185905273__$52cf47af9c3c0d67e54ac2a3225447effa$__90639075789e9060640160006040518083038186803b1580156121ba57600080fd5b505af41580156121ce573d6000803e3d6000fd5b5050505060078b6001600160601b0316815481106121ee576121ee615d0c565b600091825260208083206001600b909302018201805492830181558352909120018290556040516001600160601b038c169083907f2e689e2ae8e3c8e02797c3ff9998e8297e587a74bc6d0e48b6b5991f70991d1c9061225d908e908e908e908e908e908e908e908e90615dcd565b60405180910390a35050505050505050505050565b6000600a848154811061228757612287615d0c565b600091825260209091206004918202019150600182015460ff1660048111156122b2576122b2615930565b146122f35760405162461bcd60e51b815260206004820152601160248201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b6044820152606401610d63565b600081600301848154811061230a5761230a615d0c565b906000526020600020906007020190506000600882600001548154811061233357612333615d0c565b60009182526020822060049182020160020154908401546001600160a01b039091169250612362908690615e25565b6005840154600685015460405163368efae360e21b8152600481018b9052602481018a905292935090916000906001600160a01b0386169063da3beb8c9060440160206040518083038186803b1580156123bb57600080fd5b505afa1580156123cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123f39190615d22565b90506000808261240e5783861115612409578395505b61242e565b612419846002615e3d565b86111561242e5761242b846002615e3d565b95505b60048801545b86811015612af7578481101561286c57604051634fe264fb60e01b8152600481018e9052602481018d9052604481018290526001600160a01b03891690634fe264fb9060640160206040518083038186803b15801561249257600080fd5b505afa1580156124a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124ca9190615d22565b91506127108211156124dc5761271091505b60006127106124eb8482615c99565b8b600101546124fa9190615e3d565b6125049190615e72565b90506125108188615e25565b965089600601828154811061252757612527615d0c565b60009182526020808320909101546001600160a01b0316808352600b825260408084208f546001600160601b03168552600201909252908220805491965083929091612574908490615c99565b90915550508a546007805483926001600160601b031690811061259957612599615d0c565b90600052602060002090600b0201600201546125b59190615e25565b6001600160a01b0385166000908152600b602090815260408083208f546001600160601b0316845260010190915290205410612649576001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600101909152812054612627908390615c99565b8c549091506126429086906001600160601b03168385614c29565b505061269a565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b031684526001019091529020541561269a578a546126989085906001600160601b0316600084614c29565b505b60405163ba66fde760e01b8152600481018f9052602481018e9052604481018390526001600160a01b038a169063ba66fde79060640160206040518083038186803b1580156126e857600080fd5b505afa1580156126fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127209190615cb0565b6127bd5760005b6001600160a01b0385166000908152600b60205260409020548110156127bb576001600160a01b0385166000908152600b6020526040902080546127a89187918490811061277757612777615d0c565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316600080614c29565b50806127b381615d6f565b915050612727565b505b8d6001600160a01b0385167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e196127f284615e86565b60408051918252600060208301520160405180910390a3612814600187615c99565b8214156128665784612866576000805460028c01546040516001600160a01b039092169281156108fc029290818181858888f1505060005461286493506001600160a01b03169150899050615243565b505b50612ae5565b6001600160a01b038816634fe264fb8e8e6128878986615ea3565b6040516001600160e01b031960e086901b16815260048101939093526024830191909152604482015260640160206040518083038186803b1580156128cb57600080fd5b505afa1580156128df573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129039190615d22565b91506127108211156129155761271091505b600689016129238683615ea3565b8154811061293357612933615d0c565b60009182526020909120015460018a01546001600160a01b03909116935061271090612960908490615e3d565b61296a9190615e72565b6001600160a01b0384166000908152600b602090815260408083208e546001600160601b03168452600201909152812080549091906129aa908490615c99565b90915550506001600160a01b0383166000908152600b602090815260408083208d546001600160601b03168452600101909152902054612a12576000612710838b600101546129f99190615e3d565b612a039190615e72565b9050612a0f8482615243565b50505b600061271083612a22878a615e72565b612a2c9190615e3d565b612a369190615e72565b9050600061271084878d60020154612a4e9190615e72565b612a589190615e3d565b612a629190615e72565b9050612a6e8583615243565b506040516001600160a01b0386169082156108fc029083906000818181858888f19350505050508e856001600160a01b03167f24f45c2b08bbde8c837d70b67991ccb7660537cf749de21a940ae4858b681e198484604051612ada929190918252602082015260400190565b60405180910390a350505b80612aef81615d6f565b915050612434565b5084886005015414612b0b57600588018590555b50505050600490930155505050505050565b6000600254600160a01b900460ff166001811115612b3d57612b3d615930565b14612b7c5760405162461bcd60e51b815260206004820152600f60248201526e10a9ba30b5b4b73390383430b9b29760891b6044820152606401610d63565b6000600e54600183600f54612b919190615e25565b612b9b9190615c99565b11612ba65781612bc1565b600f54600e54612bb69190615c99565b612bc1906001615e25565b9050600081600f54612bd39190615e25565b600f549091505b81811015612c52576000818152600d60205260409020805460018201546002830154612c22926001600160a01b03811692600160a01b9091046001600160601b031691614c29565b50506000818152600d60205260408120818155600181018290556002015580612c4a81615d6f565b915050612bda565b50600f555050565b612c62615531565b60006007836001600160601b031681548110612c8057612c80615d0c565b60009182526020909120604080516080810191829052600b9093029091019250600683019060049082845b815481526020019060010190808311612cab575050505050915050919050565b6000546001600160a01b03163314612cf55760405162461bcd60e51b8152600401610d6390615c5c565b6001600160601b03821660011480612d68575080600780846001600160601b031681548110612d2657612d26615d0c565b60009182526020909120600b909102015481546001600160601b03909116908110612d5357612d53615d0c565b90600052602060002090600b02016002015411155b612d845760405162461bcd60e51b8152600401610d6390615d98565b60005b6007836001600160601b031681548110612da357612da3615d0c565b90600052602060002090600b020160010180549050811015612e5c5781600780856001600160601b031681548110612ddd57612ddd615d0c565b90600052602060002090600b02016001018381548110612dff57612dff615d0c565b906000526020600020015481548110612e1a57612e1a615d0c565b90600052602060002090600b0201600201541015612e4a5760405162461bcd60e51b8152600401610d6390615d98565b80612e5481615d6f565b915050612d87565b50806007836001600160601b031681548110612e7a57612e7a615d0c565b90600052602060002090600b020160020181905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600890820152676d696e5374616b6560c01b604082015260600190565b60405180910390a25050565b606060088281548110612ef257612ef2615d0c565b9060005260206000209060040201600101805480602002602001604051908101604052809291908181526020018280548015612f4d57602002820191906000526020600020905b815481526020019060010190808311612f39575b50505050509050919050565b600a8181548110612f6957600080fd5b60009182526020909120600490910201805460018201546002909201546001600160601b0382169350600160601b9091046001600160a01b03169160ff80821692610100909204169085565b6000546001600160a01b03163314612fdf5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b031681548110612ffc57612ffc615d0c565b90600052602060002090600b020160060190600461301b929190615504565b50816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600e908201526d1d1a5b595cd4195c94195c9a5bd960921b604082015260600190565b6000546001600160a01b0316331461308e5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b0316815481106130ab576130ab615d0c565b90600052602060002090600b020160040181905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600b908201526a3332b2a337b9253ab937b960a91b604082015260600190565b600080600a838154811061311b5761311b615d0c565b600091825260208220600360049092020190810180549193509061314190600190615c99565b8154811061315157613151615d0c565b600091825260208220845460078054938102909201945090916001600160601b0390911690811061318457613184615d0c565b90600052602060002090600b0201905080600501548260030154106132235782546001600160601b0316600114156131c5576001600160ff1b03935061324d565b60038201546131d5906002615e3d565b6131e0906001615e25565b81546007805490916001600160601b031690811061320057613200615d0c565b90600052602060002090600b02016004015461321c9190615e3d565b935061324d565b6003820154613233906002615e3d565b61323e906001615e25565b8160040154611e1d9190615e3d565b505050919050565b6000546001600160a01b0316331461327f5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b03168154811061329c5761329c615d0c565b90600052602060002090600b020160030181905550816001600160601b0316600080516020615f8b833981519152604051612ed190602080825260059082015264616c70686160d81b604082015260600190565b6000546001600160a01b0316331461331a5760405162461bcd60e51b8152600401610d6390615c5c565b6000836001600160a01b031683836040516133359190615ee3565b60006040518083038185875af1925050503d8060008114613372576040519150601f19603f3d011682016040523d82523d6000602084013e613377565b606091505b50509050806133bc5760405162461bcd60e51b8152602060048201526011602482015270155b9cdd58d8d95cdcd99d5b0818d85b1b607a1b6044820152606401610d63565b50505050565b6133cf3383836000614c29565b61340c5760405162461bcd60e51b815260206004820152600e60248201526d14dd185ada5b99c819985a5b195960921b6044820152606401610d63565b5050565b6000546001600160a01b0316331461343a5760405162461bcd60e51b8152600401610d6390615c5c565b600355565b6000806000806060600080600a898154811061345d5761345d615d0c565b9060005260206000209060040201600301888154811061347f5761347f615d0c565b9060005260206000209060070201905080600101548160020154826004015483600501548460060185600001548180548060200260200160405190810160405280929190818152602001828054801561350157602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116134e3575b50505050509150965096509650965096509650509295509295509295565b6000600a828154811061353457613534615d0c565b600091825260209091206004918202019150600182015460ff16600481111561355f5761355f615930565b146135a05760405162461bcd60e51b815260206004820152601160248201527008515e1958dd5d1a5bdb881c195c9a5bd9607a1b6044820152606401610d63565b6001810154610100900460ff16156135fa5760405162461bcd60e51b815260206004820152601760248201527f52756c696e6720616c72656164792065786563757465640000000000000000006044820152606401610d63565b600061360583611d1b565b60018301805461ff001916610100179055825460405163188d362b60e11b815260048101869052602481018390529192506001600160a01b03600160601b909104169063311a6c5690604401600060405180830381600087803b15801561366b57600080fd5b505af115801561367f573d6000803e3d6000fd5b50505050505050565b6009818154811061369857600080fd5b600091825260209091200154905081565b6000806000600a84815481106136c1576136c1615d0c565b60009182526020822060036004909202019081018054919350906136e790600190615c99565b815481106136f7576136f7615d0c565b90600052602060002090600702019050600881600001548154811061371e5761371e615d0c565b6000918252602090912060049182020160020154604051639b05c26160e01b81529182018790526001600160a01b031690639b05c26190602401604080518083038186803b15801561376f57600080fd5b505afa158015613783573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137a79190615eff565b90969095509350505050565b6000546001600160a01b031633146137dd5760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b0316815481106137fa576137fa615d0c565b90600052602060002090600b020160050181905550816001600160601b0316600080516020615f8b833981519152604051612ed19060208082526012908201527106a75726f7273466f72436f7572744a756d760741b604082015260600190565b6000806000600a848154811061387357613873615d0c565b6000918252602090912060049091020190506003600182015460ff1660048111156138a0576138a0615930565b14156138f9576002810154815460078054929550916001600160601b039091169081106138cf576138cf615d0c565b600091825260209091206009600b90920201015460028201546138f29190615e25565b9150613902565b60009250600091505b50915091565b6000546001600160a01b031633146139325760405162461bcd60e51b8152600401610d6390615c5c565b600455565b60006001600254600160a01b900460ff16600181111561395957613959615930565b14801561397457506004546005546139719042615c99565b10155b905090565b600061398482614a22565b3410156139d35760405162461bcd60e51b815260206004820181905260248201527f45544820746f6f206c6f7720666f72206172626974726174696f6e20636f73746044820152606401610d63565b6000806139df8461530f565b92505091506007826001600160601b031681548110613a0057613a00615d0c565b60009182526020808320848452600a600b90930201919091019052604090205460ff16613a6f5760405162461bcd60e51b815260206004820152601a60248201527f444b20756e737570706f7274656420627920737562636f7572740000000000006044820152606401610d63565b600a80546001810182556000918252600160601b33026001600160601b03851617600482027fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a88101918255427fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2aa909101556008805492965090929184908110613afa57613afa615d0c565b600091825260208220600260049092020101548354600780546001600160a01b039093169450916001600160601b03909116908110613b3b57613b3b615d0c565b60009182526020808320600387018054600181018255908552919093206004600b9093029093019182015491935060070290910190613b7a9034615e72565b600380830191909155858255820154600283015461271091613b9b91615e3d565b613ba59190615e72565b60018201553460028201556008805486908110613bc457613bc4615d0c565b906000526020600020906004020160020160149054906101000a900460ff16613c5b57600160088681548110613bfc57613bfc615d0c565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018590555b60038101546040516302dbb79560e61b81526001600160a01b0385169163b6ede54091613c90918b918e918e91600401615f24565b600060405180830381600087803b158015613caa57600080fd5b505af1158015613cbe573d6000803e3d6000fd5b50506040513392508991507f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350505050505092915050565b6000546001600160a01b03163314613d255760405162461bcd60e51b8152600401610d6390615c5c565b600280546001600160a01b0319166001600160a01b0392909216919091179055565b613d5083613105565b341015613d9f5760405162461bcd60e51b815260206004820152601b60248201527f45544820746f6f206c6f7720666f722061707065616c20636f737400000000006044820152606401610d63565b6000600a8481548110613db457613db4615d0c565b6000918252602090912060049091020190506003600182015460ff166004811115613de157613de1615930565b14613e275760405162461bcd60e51b815260206004820152601660248201527544697370757465206e6f742061707065616c61626c6560501b6044820152606401610d63565b60038101805460009190613e3d90600190615c99565b81548110613e4d57613e4d615d0c565b906000526020600020906007020190506008816000015481548110613e7457613e74615d0c565b60009182526020909120600490910201600201546001600160a01b03163314613ed25760405162461bcd60e51b815260206004820152601060248201526f44697370757465204b6974206f6e6c7960801b6044820152606401610d63565b8154815460038401805460018101825560009182526020909120600780546001600160601b03909516949281029091019183908110613f1357613f13615d0c565b90600052602060002090600b020160050154846003015410614117576007836001600160601b031681548110613f4b57613f4b615d0c565b600091825260208220600b90910201546001600160601b031693505b600a81101561405c576007846001600160601b031681548110613f8c57613f8c615d0c565b60009182526020808320868452600a600b90930201919091019052604090205460ff1615613fb95761405c565b600060088481548110613fce57613fce615d0c565b906000526020600020906004020160000154146140115760088381548110613ff857613ff8615d0c565b906000526020600020906004020160000154925061404a565b6007846001600160601b03168154811061402d5761402d615d0c565b60009182526020909120600b90910201546001600160601b031693505b8061405481615d6f565b915050613f67565b506007836001600160601b03168154811061407957614079615d0c565b60009182526020808320858452600a600b90930201919091019052604090205460ff166140a557600192505b84546001600160601b0384811691161461411757845460038601546001600160601b03909116906140d890600190615c99565b6040516001600160601b03861681528a907f736e3f52761298c8c0823e1ebf482ed3c5ecb304f743d2d91a7c006e8e8d7a1f9060200160405180910390a45b84546bffffffffffffffffffffffff19166001600160601b038416908117865560018601805460ff191690554260028701556007805460009290811061415f5761415f615d0c565b90600052602060002090600b0201905080600401543461417f9190615e72565b82600301819055506127108160030154826002015461419e9190615e3d565b6141a89190615e72565b600183015534600283015582825560088054849081106141ca576141ca615d0c565b906000526020600020906004020160020160149054906101000a900460ff166142615760016008848154811061420257614202615d0c565b6000918252602082206002600490920201018054921515600160a01b0260ff60a01b19909316929092179091556009805460018101825591527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018390555b8454825414614347578454600387015461427d90600190615c99565b83546040519081528b907fcbe7939a71f0b369c7471d760a0a99b60b7bb010ee0406cba8a46679d1ea77569060200160405180910390a460088260000154815481106142cb576142cb615d0c565b600091825260209091206004918202016002015460038401546040516302dbb79560e61b81526001600160a01b039092169263b6ede54092614314928e928e928e929101615f24565b600060405180830381600087803b15801561432e57600080fd5b505af1158015614342573d6000803e3d6000fd5b505050505b8554604051600160601b9091046001600160a01b0316908a907f9c9b64db9e130f48381bf697abf638e73117dbfbfd7a4484f2da3ba188f4187d90600090a3887f4e6f5cf43b95303e86aee81683df63992061723a829ee012db21dad388756b9160006040516143b79190615d8a565b60405180910390a2505050505050505050565b600080600a83815481106143e0576143e0615d0c565b9060005260206000209060040201905080600301600182600301805490506144089190615c99565b8154811061441857614418615d0c565b906000526020600020906007020160030154915050919050565b6001600254600160a01b900460ff16600181111561445257614452615930565b1461448d5760405162461bcd60e51b815260206004820152600b60248201526a57726f6e6720706861736560a81b6044820152606401610d63565b6000600a83815481106144a2576144a2615d0c565b906000526020600020906004020190506000600182600301805490506144c89190615c99565b905060008260030182815481106144e1576144e1615d0c565b6000918252602082206007909102019150600184015460ff16600481111561450b5761450b615930565b1461454b5760405162461bcd60e51b815260206004820152601060248201526f08515d9a59195b98d9481c195c9a5bd960821b6044820152606401610d63565b6000600882600001548154811061456457614564615d0c565b60009182526020822060026004909202010154600684015460038501546001600160a01b039092169350919061459a8884615e25565b11156145aa5783600301546145b4565b6145b48783615e25565b9050815b8181101561471a57604051633b30414760e01b8152600481018a90526000906001600160a01b03861690633b30414790602401602060405180830381600087803b15801561460557600080fd5b505af1158015614619573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061463d9190615f6d565b90506001600160a01b038116156147075760018601546001600160a01b0382166000908152600b602090815260408083208c546001600160601b0316845260020190915281208054909190614693908490615e25565b909155505060068601805460018101825560009182526020918290200180546001600160a01b0319166001600160a01b038416908117909155604080518a81529283018590528c927f6119cf536152c11e0a9a6c22f3953ce4ecc93ee54fa72ffa326ffabded21509b910160405180910390a35b508061471281615d6f565b9150506145b8565b505050505050505050565b6060600980548060200260200160405190810160405280929190818152602001828054801561477357602002820191906000526020600020905b81548152602001906001019080831161475f575b5050505050905090565b6000546001600160a01b031633146147a75760405162461bcd60e51b8152600401610d6390615c5c565b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146147f35760405162461bcd60e51b8152600401610d6390615c5c565b60085480821061482f5760405162461bcd60e51b81526020600482015260076024820152660854185c995b9d60ca1b6044820152606401610d63565b600082156148ac576008838154811061484a5761484a615d0c565b90600052602060002090600402016003015460016148689190615e25565b9050600a81106148ac5760405162461bcd60e51b815260206004820152600f60248201526e088cae0e8d040d8caeccad840dac2f608b1b6044820152606401610d63565b6040805160a08101825284815281516000808252602080830185528084019283526001600160a01b038916948401949094526060830181905260808301859052600880546001810182559152825160049091027ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee38101918255915180519394919361495e937ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee4019291909101906154b9565b50604082015160028201805460608501511515600160a01b026001600160a81b03199091166001600160a01b039093169290921791909117905560809091015160039091015560088054849081106149b8576149b8615d0c565b600091825260208083206001600490930201820180549283018155835282200183905560405184916001600160a01b0387169185917f7921860794ac14fda09ee75f7160a5a3d266e3352f7954d0401606a92a26c49891a4826133bc576133bc6001836001614ba1565b6000806000614a308461530f565b5091509150806007836001600160601b031681548110614a5257614a52615d0c565b90600052602060002090600b020160040154614a6e9190615e3d565b949350505050565b6000546001600160a01b03163314614aa05760405162461bcd60e51b8152600401610d6390615c5c565b806007836001600160601b031681548110614abd57614abd615d0c565b90600052602060002090600b0201600001600c6101000a81548160ff021916908315150217905550816001600160601b0316600080516020615f8b833981519152604051612ed1906020808252600b908201526a68696464656e566f74657360a81b604082015260600190565b6000600a8281548110614b3f57614b3f615d0c565b600091825260209091206003600490920201015492915050565b60006007836001600160601b031681548110614b7757614b77615d0c565b60009182526020808320948352600b91909102909301600a0190925250604090205460ff16919050565b806007846001600160601b031681548110614bbe57614bbe615d0c565b60009182526020808320868452600b92909202909101600a0190526040808220805460ff19169315159390931790925590518215159184916001600160601b038716917fb47629acdf64971062d40984f77d3dee212d735b11e3e8c7a4222d9f0572cc7991a4505050565b60006001600160601b0384161580614c4b57506007546001600160601b038516115b15614c5857506000614a6e565b6001600160a01b0385166000908152600b6020526040812090614c7b8787615393565b604051637521ccb160e01b8152600c60048201526001600160601b03881660248201526044810182905290915060009073__$52cf47af9c3c0d67e54ac2a3225447effa$__90637521ccb19060640160206040518083038186803b158015614ce257600080fd5b505af4158015614cf6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614d1a9190615d22565b90508515614da8576007876001600160601b031681548110614d3e57614d3e615d0c565b90600052602060002090600b020160020154861080614d7657506001600160601b038716600090815260028401602052604090205486105b15614d875760009350505050614a6e565b80158015614d9757508254600411155b15614da85760009350505050614a6e565b6000600254600160a01b900460ff166001811115614dc857614dc8615930565b14614e74576040518060800160405280896001600160a01b03168152602001886001600160601b0316815260200187815260200186815250600d6000600e60008154614e1390615d6f565b9182905550815260208082019290925260409081016000208351928401516001600160601b0316600160a01b026001600160a01b039093169290921782558201516001808301919091556060909201516002909101559350614a6e92505050565b6000818710614ef157614e878288615c99565b90508015614edf57614e9a8930836153db565b15614ee45781614edf578354600180820186556000868152602090206002830401805491909216600c026101000a6001600160601b0381810219909216918b16021790555b6150c6565b6000945050505050614a6e565b8661508e576001600160601b03881660009081526002850160205260409020548690614f1d9084615c99565b614f279190615c99565b90508015614edf57614f398982615243565b15614ee45760005b845481101561508857886001600160601b0316856000018281548110614f6957614f69615d0c565b600091825260209091206002820401546001909116600c026101000a90046001600160601b031614156150765784548590614fa690600190615c99565b81548110614fb657614fb6615d0c565b9060005260206000209060029182820401919006600c029054906101000a90046001600160601b0316856000018281548110614ff457614ff4615d0c565b9060005260206000209060029182820401919006600c026101000a8154816001600160601b0302191690836001600160601b031602179055508460000180548061504057615040615d3b565b60008281526020902060026000199092019182040180546001600160601b03600c60018516026101000a02191690559055615088565b8061508081615d6f565b915050614f41565b506150c6565b856150998884615c99565b6150a39190615c99565b905080156150c6576150b58982615243565b6150c6576000945050505050614a6e565b6001600160601b038816600090815260018501602052604081205488906150ee908590615c99565b6150f89190615e25565b6001600160601b038a16600081815260018801602052604081208390559192505b816151dc57604051631712e1c560e11b8152600c600482015260248101829052604481018b90526064810187905273__$52cf47af9c3c0d67e54ac2a3225447effa$__90632e25c38a9060840160006040518083038186803b15801561517e57600080fd5b505af4158015615192573d6000803e3d6000fd5b5050505060018114156151a85760019150615119565b600781815481106151bb576151bb615d0c565b60009182526020909120600b90910201546001600160601b03169050615119565b604080516001600160601b038d168152602081018c90529081018490526001600160a01b038d16907f70ca4ec64687bf265f39041896f3dbf10b9f650503cb38f2b3569fdce7489c369060600160405180910390a25060019b9a5050505050505050505050565b600154604080516001600160a01b038581166024830152604480830186905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b1790529151600093849384939116916152a39190615ee3565b6000604051808303816000865af19150503d80600081146152e0576040519150601f19603f3d011682016040523d82523d6000602084013e6152e5565b606091505b5091509150818015611e1d575080511580611e1d575080806020019051810190611e1d9190615cb0565b60008060006040845110615381575050506020810151604082015160608301516001600160601b038316158061535057506007546001600160601b03841610155b1561535a57600192505b8161536457600391505b80158061537357506008548110155b1561537c575060015b61538c565b506001915060039050815b9193909250565b600060405160005b60148110156153b6578481600c011a8183015360010161539b565b5060145b60208110156153d25783811a818301536001016153ba565b50519392505050565b600154604080516001600160a01b0386811660248301528581166044830152606480830186905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600093849384939116916154439190615ee3565b6000604051808303816000865af19150503d8060008114615480576040519150601f19603f3d011682016040523d82523d6000602084013e615485565b606091505b50915091508180156154af5750805115806154af5750808060200190518101906154af9190615cb0565b9695505050505050565b8280548282559060005260206000209081019282156154f4579160200282015b828111156154f45782518255916020019190600101906154d9565b5061550092915061554f565b5090565b82600481019282156154f457916020028201828111156154f45782518255916020019190600101906154d9565b60405180608001604052806004906020820280368337509192915050565b5b808211156155005760008155600101615550565b6001600160a01b038116811461557957600080fd5b50565b60006020828403121561558e57600080fd5b813561559981615564565b9392505050565b80356001600160601b03811681146155b757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156155fb576155fb6155bc565b604052919050565b600082601f83011261561457600080fd5b8135602067ffffffffffffffff821115615630576156306155bc565b8160051b61563f8282016155d2565b928352848101820192828101908785111561565957600080fd5b83870192505b848310156156785782358252918301919083019061565f565b979650505050505050565b801515811461557957600080fd5b6000806000606084860312156156a657600080fd5b6156af846155a0565b9250602084013567ffffffffffffffff8111156156cb57600080fd5b6156d786828701615603565b92505060408401356156e881615683565b809150509250925092565b60006020828403121561570557600080fd5b5035919050565b6000806040838503121561571f57600080fd5b50508035926020909101359150565b600082601f83011261573f57600080fd5b6040516080810181811067ffffffffffffffff82111715615762576157626155bc565b60405280608084018581111561577757600080fd5b845b81811015615791578035835260209283019201615779565b509195945050505050565b60008060008060008060008060006101808a8c0312156157bb57600080fd5b6157c48a6155a0565b985060208a01356157d481615683565b975060408a0135965060608a0135955060808a0135945060a08a013593506157ff8b60c08c0161572e565b92506101408a013591506101608a013567ffffffffffffffff81111561582457600080fd5b6158308c828d01615603565b9150509295985092959850929598565b60008060006060848603121561585557600080fd5b505081359360208301359350604090920135919050565b60006020828403121561587e57600080fd5b615599826155a0565b8060005b60048110156133bc57815184526020938401939091019060010161588b565b60808101611eae8284615887565b600080604083850312156158cb57600080fd5b6158d4836155a0565b946020939093013593505050565b600081518084526020808501945080840160005b83811015615912578151875295820195908201906001016158f6565b509495945050505050565b60208152600061559960208301846158e2565b634e487b7160e01b600052602160045260246000fd5b6005811061595657615956615930565b9052565b6001600160601b03861681526001600160a01b038516602082015260a081016159866040830186615946565b9215156060820152608001529392505050565b60008060a083850312156159ac57600080fd5b6159b5836155a0565b91506159c4846020850161572e565b90509250929050565b600082601f8301126159de57600080fd5b813567ffffffffffffffff8111156159f8576159f86155bc565b615a0b601f8201601f19166020016155d2565b818152846020838601011115615a2057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215615a5257600080fd5b8335615a5d81615564565b925060208401359150604084013567ffffffffffffffff811115615a8057600080fd5b615a8c868287016159cd565b9150509250925092565b600060c082018883526020888185015287604085015286606085015260c0608085015281865180845260e086019150828801935060005b81811015615af25784516001600160a01b031683529383019391830191600101615acd565b50508093505050508260a0830152979650505050505050565b6020810160028310615b1f57615b1f615930565b91905290565b60008060408385031215615b3857600080fd5b82359150602083013567ffffffffffffffff811115615b5657600080fd5b615b62858286016159cd565b9150509250929050565b600080600060608486031215615b8157600080fd5b8335925060208401359150604084013567ffffffffffffffff811115615a8057600080fd5b60008060408385031215615bb957600080fd5b8235615bc481615564565b91506159c4602084016155a0565b60008060408385031215615be557600080fd5b82356158d481615564565b600060208284031215615c0257600080fd5b813567ffffffffffffffff811115615c1957600080fd5b614a6e848285016159cd565b60008060408385031215615c3857600080fd5b615c41836155a0565b91506020830135615c5181615683565b809150509250929050565b6020808252600d908201526c476f7665726e6f72206f6e6c7960981b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b600082821015615cab57615cab615c83565b500390565b600060208284031215615cc257600080fd5b815161559981615683565b60008083128015600160ff1b850184121615615ceb57615ceb615c83565b6001600160ff1b0384018313811615615d0657615d06615c83565b50500390565b634e487b7160e01b600052603260045260246000fd5b600060208284031215615d3457600080fd5b5051919050565b634e487b7160e01b600052603160045260246000fd5b6000600160ff1b821415615d6757615d67615c83565b506000190190565b6000600019821415615d8357615d83615c83565b5060010190565b60208101611eae8284615946565b6020808252818101527f4d696e5374616b65206c6f776572207468616e20706172656e7420636f757274604082015260600190565b60006101608a15158352896020840152886040840152876060840152866080840152615dfc60a0840187615887565b8461012084015280610140840152615e16818401856158e2565b9b9a5050505050505050505050565b60008219821115615e3857615e38615c83565b500190565b6000816000190483118215151615615e5757615e57615c83565b500290565b634e487b7160e01b600052601260045260246000fd5b600082615e8157615e81615e5c565b500490565b6000600160ff1b821415615e9c57615e9c615c83565b5060000390565b600082615eb257615eb2615e5c565b500690565b60005b83811015615ed2578181015183820152602001615eba565b838111156133bc5750506000910152565b60008251615ef5818460208701615eb7565b9190910192915050565b60008060408385031215615f1257600080fd5b825191506020830151615c5181615683565b8481528360208201526080604082015260008351806080840152615f4f8160a0850160208801615eb7565b606083019390935250601f91909101601f19160160a0019392505050565b600060208284031215615f7f57600080fd5b81516155998161556456fefb75175e7dd144a612469a4316b0a6e4cee24cb54400dfdc7bfe1546cd0e309da2646970667358221220bab7ca22ba7f0c78e8966a0b829254e7d3e1b2cbc13dda910dd083e0c8d0af6464736f6c63430008090033", "libraries": { "SortitionSumTreeFactory": "0x48ce286978C74c288eA6Bc9a536BcC899DF8D177" }, @@ -2065,7 +1944,7 @@ } }, "enableDisputeKits(uint96,uint256[],bool)": { - "details": "Adds/removes court's support for specified dispute kits..", + "details": "Adds/removes court's support for specified dispute kits.", "params": { "_disputeKitIDs": "The IDs of dispute kits which support should be added/removed.", "_enable": "Whether add or remove the dispute kits from the subcourt.", @@ -2264,7 +2143,7 @@ "label": "sortitionSumTrees", "offset": 0, "slot": "12", - "type": "t_struct(SortitionSumTrees)13202_storage" + "type": "t_struct(SortitionSumTrees)19815_storage" }, { "astId": 2122, @@ -2387,12 +2266,12 @@ "numberOfBytes": "32", "value": "t_struct(Juror)2020_storage" }, - "t_mapping(t_bytes32,t_struct(SortitionSumTree)13196_storage)": { + "t_mapping(t_bytes32,t_struct(SortitionSumTree)19809_storage)": { "encoding": "mapping", "key": "t_bytes32", "label": "mapping(bytes32 => struct SortitionSumTreeFactory.SortitionSumTree)", "numberOfBytes": "32", - "value": "t_struct(SortitionSumTree)13196_storage" + "value": "t_struct(SortitionSumTree)19809_storage" }, "t_mapping(t_bytes32,t_uint256)": { "encoding": "mapping", @@ -2743,12 +2622,12 @@ ], "numberOfBytes": "224" }, - "t_struct(SortitionSumTree)13196_storage": { + "t_struct(SortitionSumTree)19809_storage": { "encoding": "inplace", "label": "struct SortitionSumTreeFactory.SortitionSumTree", "members": [ { - "astId": 13181, + "astId": 19794, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "K", "offset": 0, @@ -2756,7 +2635,7 @@ "type": "t_uint256" }, { - "astId": 13184, + "astId": 19797, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "stack", "offset": 0, @@ -2764,7 +2643,7 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 13187, + "astId": 19800, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "nodes", "offset": 0, @@ -2772,7 +2651,7 @@ "type": "t_array(t_uint256)dyn_storage" }, { - "astId": 13191, + "astId": 19804, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "IDsToNodeIndexes", "offset": 0, @@ -2780,7 +2659,7 @@ "type": "t_mapping(t_bytes32,t_uint256)" }, { - "astId": 13195, + "astId": 19808, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "nodeIndexesToIDs", "offset": 0, @@ -2790,17 +2669,17 @@ ], "numberOfBytes": "160" }, - "t_struct(SortitionSumTrees)13202_storage": { + "t_struct(SortitionSumTrees)19815_storage": { "encoding": "inplace", "label": "struct SortitionSumTreeFactory.SortitionSumTrees", "members": [ { - "astId": 13201, + "astId": 19814, "contract": "src/arbitration/KlerosCore.sol:KlerosCore", "label": "sortitionSumTrees", "offset": 0, "slot": "0", - "type": "t_mapping(t_bytes32,t_struct(SortitionSumTree)13196_storage)" + "type": "t_mapping(t_bytes32,t_struct(SortitionSumTree)19809_storage)" } ], "numberOfBytes": "32" diff --git a/contracts/deployments/arbitrumRinkeby/PolicyRegistry.json b/contracts/deployments/arbitrumRinkeby/PolicyRegistry.json new file mode 100644 index 000000000..559cb18f5 --- /dev/null +++ b/contracts/deployments/arbitrumRinkeby/PolicyRegistry.json @@ -0,0 +1,208 @@ +{ + "address": "0x76262035D1b280cC0b08024177b837893bcAd3DA", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_subcourtID", + "type": "uint256" + }, + { + "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": "_subcourtID", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_policy", + "type": "string" + } + ], + "name": "setPolicy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x280923d35fba2db52658e25f3b17e4d934a0a0626b50cbd323542a48332b6fec", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x76262035D1b280cC0b08024177b837893bcAd3DA", + "transactionIndex": 1, + "gasUsed": "377115", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xcec7b86c2d5ce4e411669882a6f1822246b02401a4cdc10d5fcfc5d50d5fac95", + "transactionHash": "0x280923d35fba2db52658e25f3b17e4d934a0a0626b50cbd323542a48332b6fec", + "logs": [], + "blockNumber": 15211712, + "cumulativeGasUsed": "377115", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3" + ], + "numDeployments": 1, + "solcInputHash": "c8bb8c3f437d0a05adb8cac05ba37521", + "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\":\"_subcourtID\",\"type\":\"uint256\"},{\"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\":\"_subcourtID\",\"type\":\"uint256\"},{\"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 subcourt.\",\"events\":{\"PolicyUpdate(uint256,string)\":{\"details\":\"Emitted when a policy is updated.\",\"params\":{\"_policy\":\"The URI of the policy JSON.\",\"_subcourtID\":\"The ID of the policy's subcourt.\"}}},\"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)\":{\"details\":\"Sets the policy for the specified subcourt.\",\"params\":{\"_policy\":\"The URI of the policy JSON.\",\"_subcourtID\":\"The ID of the specified subcourt.\"}}},\"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\":200},\"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 subcourt.\\n */\\ncontract PolicyRegistry {\\n \\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n /** \\n * @dev Emitted when a policy is updated.\\n * @param _subcourtID The ID of the policy's subcourt.\\n * @param _policy The URI of the policy JSON.\\n */\\n event PolicyUpdate(uint indexed _subcourtID, string _policy);\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n address public governor;\\n mapping(uint => 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 subcourt.\\n * @param _subcourtID The ID of the specified subcourt.\\n * @param _policy The URI of the policy JSON.\\n */\\n function setPolicy(uint _subcourtID, string calldata _policy) external onlyByGovernor {\\n policies[_subcourtID] = _policy;\\n emit PolicyUpdate(_subcourtID, policies[_subcourtID]);\\n }\\n}\",\"keccak256\":\"0x224176fa133ecf1ff7aed4d24b78f90510e097df35853c6af5d12316d24236e0\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506040516105fe3803806105fe83398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b61056b806100936000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063d3e8948314610081578063e4c0aaf4146100a1578063f00adf5e146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f366004610338565b6100c9565b6040516100789190610351565b6100b46100af3660046103a6565b610163565b005b6100b46100c43660046103d6565b6101e0565b600160205260009081526040902080546100e290610452565b80601f016020809104026020016040519081016040528092919081815260200182805461010e90610452565b801561015b5780601f106101305761010080835404028352916020019161015b565b820191906000526020600020905b81548152906001019060200180831161013e57829003601f168201915b505050505081565b6000546001600160a01b031633146101be5760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146102365760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064016101b5565b600083815260016020526040902061024f90838361029f565b50827f6363e8b93c0bbb112f6247819a99f3c99f4a3e0f8e119a64e5ceb6edb9b3cc7b60016000868152602001908152602001600020604051610292919061048d565b60405180910390a2505050565b8280546102ab90610452565b90600052602060002090601f0160209004810192826102cd5760008555610313565b82601f106102e65782800160ff19823516178555610313565b82800160010185558215610313579182015b828111156103135782358255916020019190600101906102f8565b5061031f929150610323565b5090565b5b8082111561031f5760008155600101610324565b60006020828403121561034a57600080fd5b5035919050565b600060208083528351808285015260005b8181101561037e57858101830151858201604001528201610362565b81811115610390576000604083870101525b50601f01601f1916929092016040019392505050565b6000602082840312156103b857600080fd5b81356001600160a01b03811681146103cf57600080fd5b9392505050565b6000806000604084860312156103eb57600080fd5b83359250602084013567ffffffffffffffff8082111561040a57600080fd5b818601915086601f83011261041e57600080fd5b81358181111561042d57600080fd5b87602082850101111561043f57600080fd5b6020830194508093505050509250925092565b600181811c9082168061046657607f821691505b6020821081141561048757634e487b7160e01b600052602260045260246000fd5b50919050565b600060208083526000845481600182811c9150808316806104af57607f831692505b8583108114156104cd57634e487b7160e01b85526022600452602485fd5b8786018381526020018180156104ea57600181146104fb57610526565b60ff19861682528782019650610526565b60008b81526020902060005b8681101561052057815484820152908501908901610507565b83019750505b5094999850505050505050505056fea26469706673582212200c1103223f1ae8d623c1720f16b59b98b5d08187d8ac12e3332e184f6d0beead64736f6c63430008090033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c80630c340a2414610051578063d3e8948314610081578063e4c0aaf4146100a1578063f00adf5e146100b6575b600080fd5b600054610064906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61009461008f366004610338565b6100c9565b6040516100789190610351565b6100b46100af3660046103a6565b610163565b005b6100b46100c43660046103d6565b6101e0565b600160205260009081526040902080546100e290610452565b80601f016020809104026020016040519081016040528092919081815260200182805461010e90610452565b801561015b5780601f106101305761010080835404028352916020019161015b565b820191906000526020600020905b81548152906001019060200180831161013e57829003601f168201915b505050505081565b6000546001600160a01b031633146101be5760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064015b60405180910390fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b031633146102365760405162461bcd60e51b81526020600482015260196024820152784e6f20616c6c6f7765643a20676f7665726e6f72206f6e6c7960381b60448201526064016101b5565b600083815260016020526040902061024f90838361029f565b50827f6363e8b93c0bbb112f6247819a99f3c99f4a3e0f8e119a64e5ceb6edb9b3cc7b60016000868152602001908152602001600020604051610292919061048d565b60405180910390a2505050565b8280546102ab90610452565b90600052602060002090601f0160209004810192826102cd5760008555610313565b82601f106102e65782800160ff19823516178555610313565b82800160010185558215610313579182015b828111156103135782358255916020019190600101906102f8565b5061031f929150610323565b5090565b5b8082111561031f5760008155600101610324565b60006020828403121561034a57600080fd5b5035919050565b600060208083528351808285015260005b8181101561037e57858101830151858201604001528201610362565b81811115610390576000604083870101525b50601f01601f1916929092016040019392505050565b6000602082840312156103b857600080fd5b81356001600160a01b03811681146103cf57600080fd5b9392505050565b6000806000604084860312156103eb57600080fd5b83359250602084013567ffffffffffffffff8082111561040a57600080fd5b818601915086601f83011261041e57600080fd5b81358181111561042d57600080fd5b87602082850101111561043f57600080fd5b6020830194508093505050509250925092565b600181811c9082168061046657607f821691505b6020821081141561048757634e487b7160e01b600052602260045260246000fd5b50919050565b600060208083526000845481600182811c9150808316806104af57607f831692505b8583108114156104cd57634e487b7160e01b85526022600452602485fd5b8786018381526020018180156104ea57600181146104fb57610526565b60ff19861682528782019650610526565b60008b81526020902060005b8681101561052057815484820152908501908901610507565b83019750505b5094999850505050505050505056fea26469706673582212200c1103223f1ae8d623c1720f16b59b98b5d08187d8ac12e3332e184f6d0beead64736f6c63430008090033", + "devdoc": { + "author": "Enrique Piqueras - ", + "details": "A contract to maintain a policy for each subcourt.", + "events": { + "PolicyUpdate(uint256,string)": { + "details": "Emitted when a policy is updated.", + "params": { + "_policy": "The URI of the policy JSON.", + "_subcourtID": "The ID of the policy's subcourt." + } + } + }, + "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)": { + "details": "Sets the policy for the specified subcourt.", + "params": { + "_policy": "The URI of the policy JSON.", + "_subcourtID": "The ID of the specified subcourt." + } + } + }, + "title": "PolicyRegistry", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 11, + "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", + "label": "governor", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 15, + "contract": "src/arbitration/PolicyRegistry.sol:PolicyRegistry", + "label": "policies", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_string_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_mapping(t_uint256,t_string_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => string)", + "numberOfBytes": "32", + "value": "t_string_storage" + }, + "t_string_storage": { + "encoding": "bytes", + "label": "string", + "numberOfBytes": "32" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/arbitrumRinkeby/SafeBridgeArbitrum.json b/contracts/deployments/arbitrumRinkeby/SafeBridgeArbitrum.json deleted file mode 100644 index 72cc7cb9d..000000000 --- a/contracts/deployments/arbitrumRinkeby/SafeBridgeArbitrum.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "address": "0x1406bC99873d16Cde3491F809f1Af9442cb5A338", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "withdrawalId", - "type": "uint256" - } - ], - "name": "L2ToL1TxCreated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_receiver", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "sendSafe", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - } - ], - "transactionHash": "0xa7899bcb74e96e88994d8a9cccf51136680b236c2cfdab4ea2e7f3db5c4d797b", - "receipt": { - "to": null, - "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0x1406bC99873d16Cde3491F809f1Af9442cb5A338", - "transactionIndex": 0, - "gasUsed": "1575466", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x1129d518a7b3498206754578e5c8882dd2266ece37a097986b2b3a0429ae58b6", - "transactionHash": "0xa7899bcb74e96e88994d8a9cccf51136680b236c2cfdab4ea2e7f3db5c4d797b", - "logs": [], - "blockNumber": 9610366, - "cumulativeGasUsed": "10086", - "status": 1, - "byzantium": true - }, - "args": [], - "numDeployments": 1, - "solcInputHash": "0a1ec2a631b00a23a4a92b2eaceb36a5", - "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"withdrawalId\",\"type\":\"uint256\"}],\"name\":\"L2ToL1TxCreated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_receiver\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_calldata\",\"type\":\"bytes\"}],\"name\":\"sendSafe\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"sendSafe(address,bytes)\":{\"params\":{\"_calldata\":\"The L2 encoded message data.\",\"_receiver\":\"The L1 contract address who will receive the calldata\"},\"returns\":{\"_0\":\"Unique id to track the message request/transaction.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"sendSafe(address,bytes)\":{\"notice\":\"Sends an arbitrary message from one domain to another.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/bridge/SafeBridgeArbitrum.sol\":\"SafeBridgeArbitrum\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/bridge/SafeBridgeArbitrum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/arbitrum/IArbSys.sol\\\";\\nimport \\\"./interfaces/arbitrum/AddressAliasHelper.sol\\\";\\n\\nimport \\\"./interfaces/ISafeBridge.sol\\\";\\n\\ncontract SafeBridgeArbitrum is ISafeBridge {\\n IArbSys constant arbsys = IArbSys(address(100));\\n\\n event L2ToL1TxCreated(uint256 indexed withdrawalId);\\n\\n function sendSafe(address _receiver, bytes memory _calldata) external payable override returns (uint256) {\\n uint256 withdrawalId = arbsys.sendTxToL1(_receiver, _calldata);\\n\\n emit L2ToL1TxCreated(withdrawalId);\\n return withdrawalId;\\n }\\n}\\n\",\"keccak256\":\"0x0079614dca40603a39d3f61fa9e31f0dbe267897b926774953c889a8c599e3fa\",\"license\":\"MIT\"},\"src/bridge/interfaces/ISafeBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface ISafeBridge {\\n /**\\n * Sends an arbitrary message from one domain to another.\\n *\\n * @param _receiver The L1 contract address who will receive the calldata\\n * @param _calldata The L2 encoded message data.\\n * @return Unique id to track the message request/transaction.\\n */\\n function sendSafe(address _receiver, bytes memory _calldata) external payable returns (uint256);\\n}\\n\",\"keccak256\":\"0x2e7ab23dc7721f51f3d115ea3a06c590869e8671ed824987756ab4bb224845d1\",\"license\":\"MIT\"},\"src/bridge/interfaces/arbitrum/AddressAliasHelper.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\n/*\\n * Copyright 2019-2021, Offchain Labs, Inc.\\n *\\n * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n * you may not use this file except in compliance with the License.\\n * You may obtain a copy of the License at\\n *\\n * http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n * See the License for the specific language governing permissions and\\n * limitations under the License.\\n */\\n\\npragma solidity >=0.7.0;\\n\\nlibrary AddressAliasHelper {\\n uint160 constant offset = uint160(0x1111000000000000000000000000000000001111);\\n\\n /// @notice Utility function that converts the address in the L1 that submitted a tx to\\n /// the inbox to the msg.sender viewed in the L2\\n /// @param l1Address the address in the L1 that triggered the tx to L2\\n /// @return l2Address L2 address as viewed in msg.sender\\n function applyL1ToL2Alias(address l1Address) internal pure returns (address l2Address) {\\n l2Address = address(uint160(l1Address) + offset);\\n }\\n\\n /// @notice Utility function that converts the msg.sender viewed in the L2 to the\\n /// address in the L1 that submitted a tx to the inbox\\n /// @param l2Address L2 address as viewed in msg.sender\\n /// @return l1Address the address in the L1 that triggered the tx to L2\\n function undoL1ToL2Alias(address l2Address) internal pure returns (address l1Address) {\\n l1Address = address(uint160(l2Address) - offset);\\n }\\n}\\n\",\"keccak256\":\"0xdd595bb9f30932cb16758f5f561b80a8fcfbf239e68319615c39441b2781a9cd\",\"license\":\"Apache-2.0\"},\"src/bridge/interfaces/arbitrum/IArbSys.sol\":{\"content\":\"pragma solidity >=0.7.0;\\n\\n/**\\n * @title Precompiled contract that exists in every Arbitrum chain at address(100), 0x0000000000000000000000000000000000000064. Exposes a variety of system-level functionality.\\n */\\ninterface IArbSys {\\n /**\\n * @notice Get internal version number identifying an ArbOS build\\n * @return version number as int\\n */\\n function arbOSVersion() external pure returns (uint256);\\n\\n /**\\n * @notice Get Arbitrum block number (distinct from L1 block number; Arbitrum genesis block has block number 0)\\n * @return block number as int\\n */\\n function arbBlockNumber() external view returns (uint256);\\n\\n /**\\n * @notice Send given amount of Eth to dest from sender.\\n * This is a convenience function, which is equivalent to calling sendTxToL1 with empty calldataForL1.\\n * @param destination recipient address on L1\\n * @return unique identifier for this L2-to-L1 transaction.\\n */\\n function withdrawEth(address destination) external payable returns (uint256);\\n\\n /**\\n * @notice Send a transaction to L1\\n * @param destination recipient address on L1\\n * @param calldataForL1 (optional) calldata for L1 contract call\\n * @return a unique identifier for this L2-to-L1 transaction.\\n */\\n function sendTxToL1(address destination, bytes calldata calldataForL1) external payable returns (uint256);\\n\\n /**\\n * @notice get the number of transactions issued by the given external account or the account sequence number of the given contract\\n * @param account target account\\n * @return the number of transactions issued by the given external account or the account sequence number of the given contract\\n */\\n function getTransactionCount(address account) external view returns (uint256);\\n\\n /**\\n * @notice get the value of target L2 storage slot\\n * This function is only callable from address 0 to prevent contracts from being able to call it\\n * @param account target account\\n * @param index target index of storage slot\\n * @return stotage value for the given account at the given index\\n */\\n function getStorageAt(address account, uint256 index) external view returns (uint256);\\n\\n /**\\n * @notice check if current call is coming from l1\\n * @return true if the caller of this was called directly from L1\\n */\\n function isTopLevelCall() external view returns (bool);\\n\\n event EthWithdrawal(address indexed destAddr, uint256 amount);\\n\\n event L2ToL1Transaction(\\n address caller,\\n address indexed destination,\\n uint256 indexed uniqueId,\\n uint256 indexed batchNumber,\\n uint256 indexInBatch,\\n uint256 arbBlockNum,\\n uint256 ethBlockNum,\\n uint256 timestamp,\\n uint256 callvalue,\\n bytes data\\n );\\n}\\n\",\"keccak256\":\"0xb4607d26251273b1f9307a845295fcb982d729eb5b40efeadefb21795fad9370\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50610285806100206000396000f3fe60806040526004361061001e5760003560e01c8063be44ae1c14610023575b600080fd5b610036610031366004610101565b610048565b60405190815260200160405180910390f35b6040516349460b4d60e11b8152600090819060649063928c169a9061007390879087906004016101d1565b6020604051808303816000875af1158015610092573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100b69190610236565b60405190915081907facd96f3817031b95eab52de9132d4a9dd13dac3d9dfcfe950ca9283c89b851a590600090a29392505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561011457600080fd5b82356001600160a01b038116811461012b57600080fd5b9150602083013567ffffffffffffffff8082111561014857600080fd5b818501915085601f83011261015c57600080fd5b81358181111561016e5761016e6100eb565b604051601f8201601f19908116603f01168101908382118183101715610196576101966100eb565b816040528281528860208487010111156101af57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561020d578581018301518582016060015282016101f1565b8181111561021f576000606083870101525b50601f01601f191692909201606001949350505050565b60006020828403121561024857600080fd5b505191905056fea2646970667358221220691aeb3681b0b3a9b12bd40f31d52435b0fb90aeb41a724c79e99fdcc31d653c64736f6c634300080a0033", - "deployedBytecode": "0x60806040526004361061001e5760003560e01c8063be44ae1c14610023575b600080fd5b610036610031366004610101565b610048565b60405190815260200160405180910390f35b6040516349460b4d60e11b8152600090819060649063928c169a9061007390879087906004016101d1565b6020604051808303816000875af1158015610092573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100b69190610236565b60405190915081907facd96f3817031b95eab52de9132d4a9dd13dac3d9dfcfe950ca9283c89b851a590600090a29392505050565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561011457600080fd5b82356001600160a01b038116811461012b57600080fd5b9150602083013567ffffffffffffffff8082111561014857600080fd5b818501915085601f83011261015c57600080fd5b81358181111561016e5761016e6100eb565b604051601f8201601f19908116603f01168101908382118183101715610196576101966100eb565b816040528281528860208487010111156101af57600080fd5b8260208601602083013760006020848301015280955050505050509250929050565b60018060a01b038316815260006020604081840152835180604085015260005b8181101561020d578581018301518582016060015282016101f1565b8181111561021f576000606083870101525b50601f01601f191692909201606001949350505050565b60006020828403121561024857600080fd5b505191905056fea2646970667358221220691aeb3681b0b3a9b12bd40f31d52435b0fb90aeb41a724c79e99fdcc31d653c64736f6c634300080a0033", - "devdoc": { - "kind": "dev", - "methods": { - "sendSafe(address,bytes)": { - "params": { - "_calldata": "The L2 encoded message data.", - "_receiver": "The L1 contract address who will receive the calldata" - }, - "returns": { - "_0": "Unique id to track the message request/transaction." - } - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "sendSafe(address,bytes)": { - "notice": "Sends an arbitrary message from one domain to another." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [], - "types": null - } -} diff --git a/contracts/deployments/goerli/.chainId b/contracts/deployments/goerli/.chainId new file mode 100644 index 000000000..7813681f5 --- /dev/null +++ b/contracts/deployments/goerli/.chainId @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/contracts/deployments/goerli/ArbitrableExample.json b/contracts/deployments/goerli/ArbitrableExample.json new file mode 100644 index 000000000..045dfbd70 --- /dev/null +++ b/contracts/deployments/goerli/ArbitrableExample.json @@ -0,0 +1,387 @@ +{ + "address": "0x04Fb43F2Ce076867b5ba38750Ecb2cc6BDe78D61", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IArbitrator", + "name": "_arbitrator", + "type": "address" + }, + { + "internalType": "string", + "name": "_metaEvidence", + "type": "string" + } + ], + "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": "uint256", + "name": "_numberOfRulingOptions", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_arbitratorExtraData", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "_evidenceGroupID", + "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": [ + { + "internalType": "uint256", + "name": "_externalDisputeID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_ruling", + "type": "uint256" + } + ], + "name": "rule", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x653449f02cd28f579ffaea1a475666f2bbdd16abecf883af5c4fadbf77081b74", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x04Fb43F2Ce076867b5ba38750Ecb2cc6BDe78D61", + "transactionIndex": 3, + "gasUsed": "439280", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000002000000008000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000880000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xf174eb771195775c362c24c567cd54d82374978ba6798c13c1e1b234ec6915b4", + "transactionHash": "0x653449f02cd28f579ffaea1a475666f2bbdd16abecf883af5c4fadbf77081b74", + "logs": [ + { + "transactionIndex": 3, + "blockNumber": 7436910, + "transactionHash": "0x653449f02cd28f579ffaea1a475666f2bbdd16abecf883af5c4fadbf77081b74", + "address": "0x04Fb43F2Ce076867b5ba38750Ecb2cc6BDe78D61", + "topics": [ + "0x61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d", + "0x0000000000000000000000000000000000000000000000000000000000000000" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000007b68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6b6c65726f732f6b6c65726f732d76322f6d61737465722f636f6e7472616374732f6465706c6f796d656e74732f72696e6b6562792f4d65746145766964656e63655f41726269747261626c654578616d706c652e6a736f6e0000000000", + "logIndex": 4, + "blockHash": "0xf174eb771195775c362c24c567cd54d82374978ba6798c13c1e1b234ec6915b4" + } + ], + "blockNumber": 7436910, + "cumulativeGasUsed": "1730193", + "status": 1, + "byzantium": true + }, + "args": [ + "0xf08273e2B35E78509B027f6FAa32485844EA7cCA", + "https://raw.githubusercontent.com/kleros/kleros-v2/master/contracts/deployments/rinkeby/MetaEvidence_ArbitrableExample.json" + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_metaEvidence\",\"type\":\"string\"}],\"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\":\"uint256\",\"name\":\"_numberOfRulingOptions\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"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\":[{\"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\":\"The arbitrator to rule on created disputes.\",\"_metaEvidence\":\"The URI of the meta evidence object for evidence submissions requests.\"}},\"createDispute(uint256,bytes,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.\",\"_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\":200},\"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/ArbitrableExample.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\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 uint256 constant META_EVIDENCE_ID = 0;\\n\\n IArbitrator public immutable arbitrator; // Arbitrator is set in constructor and never changed.\\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 _metaEvidence The URI of the meta evidence object for evidence submissions requests.\\n */\\n constructor(IArbitrator _arbitrator, string memory _metaEvidence) {\\n arbitrator = _arbitrator;\\n\\n emit MetaEvidence(META_EVIDENCE_ID, _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 _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.\\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 _evidenceGroupID\\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 disputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData);\\n\\n externalIDtoLocalID[disputeID] = localDisputeID;\\n\\n emit Dispute(arbitrator, disputeID, META_EVIDENCE_ID, _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\",\"keccak256\":\"0x320f8cc4a8331891c01b6f844422de6a82164d9f45d283e309e7633183ecfd99\",\"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": "0x60a060405234801561001057600080fd5b506040516108b63803806108b683398101604081905261002f916100c4565b6001600160a01b0382166080526040516000907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d9061006f908490610192565b60405180910390a250506101c5565b634e487b7160e01b600052604160045260246000fd5b60005b838110156100af578181015183820152602001610097565b838111156100be576000848401525b50505050565b600080604083850312156100d757600080fd5b82516001600160a01b03811681146100ee57600080fd5b60208401519092506001600160401b038082111561010b57600080fd5b818501915085601f83011261011f57600080fd5b8151818111156101315761013161007e565b604051601f8201601f19908116603f011681019083821181831017156101595761015961007e565b8160405282815288602084870101111561017257600080fd5b610183836020830160208801610094565b80955050505050509250929050565b60208152600082518060208401526101b1816040850160208701610094565b601f01601f19169190910160400192915050565b6080516106c26101f46000396000818160e60152818161018501528181610454015261050d01526106c26000f3fe60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636137048c146100b35780636cc6cde1146100d4578063c21ae06114610120575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461056a565b61014d565b005b34801561007d57600080fd5b5061009161008c36600461058c565b61030a565b6040805193151584526020840192909252908201526060015b60405180910390f35b6100c66100c13660046105a5565b610341565b6040519081526020016100aa565b3480156100e057600080fd5b506101087f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100aa565b34801561012c57600080fd5b506100c661013b36600461058c565b60006020819052908152604090205481565b600082815260208190526040812054600180549192918390811061017357610173610627565b906000526020600020906003020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b0316146102175760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b806002015483111561025d5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b604482015260640161020e565b805460ff16156102bb5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b606482015260840161020e565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6001818154811061031a57600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b6000600185116103935760405162461bcd60e51b815260206004820152601b60248201527f496e636f7272656374206e756d626572206f662063686f696365730000000000604482015260640161020e565b60018054604080516060810182526000808252602082018181528284018b815285870187559590915290517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf660038502908101805460ff19169215159290921790915590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf782015592517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf890930192909255905163c13517e160e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c13517e1903490610497908a908a908a9060040161063d565b6020604051808303818588803b1580156104b057600080fd5b505af11580156104c4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104e99190610673565b600081815260208181526040808320859055805192835290820186905291935083917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350949350505050565b6000806040838503121561057d57600080fd5b50508035926020909101359150565b60006020828403121561059e57600080fd5b5035919050565b600080600080606085870312156105bb57600080fd5b84359350602085013567ffffffffffffffff808211156105da57600080fd5b818701915087601f8301126105ee57600080fd5b8135818111156105fd57600080fd5b88602082850101111561060f57600080fd5b95986020929092019750949560400135945092505050565b634e487b7160e01b600052603260045260246000fd5b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b60006020828403121561068557600080fd5b505191905056fea2646970667358221220009cf64d82ef5b990193ecc07de054a16c92c1096aa712e760d7826d67cfd99364736f6c63430008090033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636137048c146100b35780636cc6cde1146100d4578063c21ae06114610120575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461056a565b61014d565b005b34801561007d57600080fd5b5061009161008c36600461058c565b61030a565b6040805193151584526020840192909252908201526060015b60405180910390f35b6100c66100c13660046105a5565b610341565b6040519081526020016100aa565b3480156100e057600080fd5b506101087f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100aa565b34801561012c57600080fd5b506100c661013b36600461058c565b60006020819052908152604090205481565b600082815260208190526040812054600180549192918390811061017357610173610627565b906000526020600020906003020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b0316146102175760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b806002015483111561025d5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b604482015260640161020e565b805460ff16156102bb5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b606482015260840161020e565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6001818154811061031a57600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b6000600185116103935760405162461bcd60e51b815260206004820152601b60248201527f496e636f7272656374206e756d626572206f662063686f696365730000000000604482015260640161020e565b60018054604080516060810182526000808252602082018181528284018b815285870187559590915290517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf660038502908101805460ff19169215159290921790915590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf782015592517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf890930192909255905163c13517e160e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c13517e1903490610497908a908a908a9060040161063d565b6020604051808303818588803b1580156104b057600080fd5b505af11580156104c4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104e99190610673565b600081815260208181526040808320859055805192835290820186905291935083917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350949350505050565b6000806040838503121561057d57600080fd5b50508035926020909101359150565b60006020828403121561059e57600080fd5b5035919050565b600080600080606085870312156105bb57600080fd5b84359350602085013567ffffffffffffffff808211156105da57600080fd5b818701915087601f8301126105ee57600080fd5b8135818111156105fd57600080fd5b88602082850101111561060f57600080fd5b95986020929092019750949560400135945092505050565b634e487b7160e01b600052603260045260246000fd5b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b60006020828403121561068557600080fd5b505191905056fea2646970667358221220009cf64d82ef5b990193ecc07de054a16c92c1096aa712e760d7826d67cfd99364736f6c63430008090033", + "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." + } + }, + "createDispute(uint256,bytes,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.", + "_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": 5859, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "externalIDtoLocalID", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_uint256,t_uint256)" + }, + { + "astId": 5863, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "disputes", + "offset": 0, + "slot": "1", + "type": "t_array(t_struct(DisputeStruct)5849_storage)dyn_storage" + } + ], + "types": { + "t_array(t_struct(DisputeStruct)5849_storage)dyn_storage": { + "base": "t_struct(DisputeStruct)5849_storage", + "encoding": "dynamic_array", + "label": "struct ArbitrableExample.DisputeStruct[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_mapping(t_uint256,t_uint256)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(DisputeStruct)5849_storage": { + "encoding": "inplace", + "label": "struct ArbitrableExample.DisputeStruct", + "members": [ + { + "astId": 5844, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "isRuled", + "offset": 0, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 5846, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", + "label": "ruling", + "offset": 0, + "slot": "1", + "type": "t_uint256" + }, + { + "astId": 5848, + "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/goerli/FastBridgeReceiverOnEthereum.json b/contracts/deployments/goerli/FastBridgeReceiverOnEthereum.json new file mode 100644 index 000000000..09c28e14a --- /dev/null +++ b/contracts/deployments/goerli/FastBridgeReceiverOnEthereum.json @@ -0,0 +1,780 @@ +{ + "address": "0x87142b7E9C7D026776499120D902AF8896C07894", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_deposit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_epochPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_challengePeriod", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_safeBridgeSender", + "type": "address" + }, + { + "internalType": "address", + "name": "_inbox", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isBridgerHonest", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isChallengerHonest", + "type": "bool" + } + ], + "name": "BatchSafeVerified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_success", + "type": "bool" + } + ], + "name": "BatchVerified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_challenger", + "type": "address" + } + ], + "name": "ChallengeDepositWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "ClaimChallenged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_bridger", + "type": "address" + } + ], + "name": "ClaimDepositWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "_batchMerkleRoot", + "type": "bytes32" + } + ], + "name": "ClaimReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_nonce", + "type": "uint256" + } + ], + "name": "MessageRelayed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "challenge", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "challengePeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "challenges", + "outputs": [ + { + "internalType": "address", + "name": "challenger", + "type": "address" + }, + { + "internalType": "bool", + "name": "honest", + "type": "bool" + }, + { + "internalType": "bool", + "name": "depositAndRewardWithdrawn", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_batchMerkleRoot", + "type": "bytes32" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "claimChallengePeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "claims", + "outputs": [ + { + "internalType": "bytes32", + "name": "batchMerkleRoot", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "bridger", + "type": "address" + }, + { + "internalType": "uint32", + "name": "timestamp", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "honest", + "type": "bool" + }, + { + "internalType": "bool", + "name": "verificationAttempted", + "type": "bool" + }, + { + "internalType": "bool", + "name": "depositAndRewardWithdrawn", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "fastInbox", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "inbox", + "outputs": [ + { + "internalType": "contract IInbox", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "relayed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "safeBridgeSender", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "_proof", + "type": "bytes32[]" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + } + ], + "name": "verifyAndRelayMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "verifyBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_batchMerkleRoot", + "type": "bytes32" + } + ], + "name": "verifySafeBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "withdrawChallengeDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "withdrawClaimDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x9645fe2efad7ca58b0e97d758210007da86277454f6017bde63e6326084030ca", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x87142b7E9C7D026776499120D902AF8896C07894", + "transactionIndex": 8, + "gasUsed": "1556362", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xb2fff568537e668fea19fe817aaead5c89d7e576b6b420694592dfa2d5c0f7e0", + "transactionHash": "0x9645fe2efad7ca58b0e97d758210007da86277454f6017bde63e6326084030ca", + "logs": [], + "blockNumber": 7436907, + "cumulativeGasUsed": "4966974", + "status": 1, + "byzantium": true + }, + "args": [ + "100000000000000000", + 86400, + 14400, + "0xcFc0b84419583ff7b32fD5139B789cE858517d4C", + "0x6BEbC4925716945D46F0Ec336D5C2564F419682C" + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_deposit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_epochPeriod\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_challengePeriod\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_safeBridgeSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_inbox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isBridgerHonest\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isChallengerHonest\",\"type\":\"bool\"}],\"name\":\"BatchSafeVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"}],\"name\":\"BatchVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_challenger\",\"type\":\"address\"}],\"name\":\"ChallengeDepositWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"ClaimChallenged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bridger\",\"type\":\"address\"}],\"name\":\"ClaimDepositWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_batchMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"ClaimReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"challenge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"challengePeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"challenges\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"challenger\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"honest\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"depositAndRewardWithdrawn\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_batchMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"claimChallengePeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"claims\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"batchMerkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"bridger\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"timestamp\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"honest\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"verificationAttempted\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"depositAndRewardWithdrawn\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"epochPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"fastInbox\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inbox\",\"outputs\":[{\"internalType\":\"contract IInbox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"relayed\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"safeBridgeSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"_proof\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"}],\"name\":\"verifyAndRelayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"verifyBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_batchMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"verifySafeBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"withdrawChallengeDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"withdrawClaimDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"challenge(uint256)\":{\"details\":\"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.\",\"params\":{\"_epoch\":\"The epoch of the claim to challenge.\"}},\"claim(uint256,bytes32)\":{\"details\":\"Submit a claim about the `_batchMerkleRoot` for the last completed epoch from the Fast Bridge and submit a deposit. The `_batchMerkleRoot` should match the one on the sending side otherwise the sender will lose his deposit.\",\"params\":{\"_batchMerkleRoot\":\"The batch merkle root claimed for the last completed epoch.\",\"_epoch\":\"The epoch in which the batch to claim.\"}},\"claimChallengePeriod(uint256)\":{\"details\":\"Returns the `start` and `end` time of challenge period for this `epoch`.\",\"params\":{\"_epoch\":\"The epoch of the claim to request the challenge period.\"},\"returns\":{\"end\":\"The end time of the challenge period.\",\"start\":\"The start time of the challenge period.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_challengePeriod\":\"The duration of the period allowing to challenge a claim.\",\"_deposit\":\"The deposit amount to submit a claim in wei.\",\"_epochPeriod\":\"The duration of each epoch.\",\"_inbox\":\"Ethereum receiver specific: The address of the inbox contract on Ethereum.\",\"_safeBridgeSender\":\"The address of the Safe Bridge Sender on the connecting chain.\"}},\"verifyAndRelayMessage(uint256,bytes32[],bytes)\":{\"details\":\"Verifies merkle proof for the given message and associated nonce for the epoch and relays the message.\",\"params\":{\"_epoch\":\"The epoch in which the message was batched by the bridge.\",\"_message\":\"The data on the cross-domain chain for the message.\",\"_proof\":\"The merkle proof to prove the membership of the message and nonce in the merkle tree for the epoch.\"}},\"verifyBatch(uint256)\":{\"details\":\"Resolves the optimistic claim for '_epoch'.\",\"params\":{\"_epoch\":\"The epoch of the optimistic claim.\"}},\"verifySafeBatch(uint256,bytes32)\":{\"details\":\"Resolves any challenge of the optimistic claim for '_epoch'.\",\"params\":{\"_batchMerkleRoot\":\"The true batch merkle root for the epoch.\",\"_epoch\":\"The epoch to verify.\"}},\"withdrawChallengeDeposit(uint256)\":{\"details\":\"Sends the deposit back to the Challenger if their challenge is successful. Includes a portion of the Bridger's deposit.\",\"params\":{\"_epoch\":\"The epoch associated with the challenge deposit to withraw.\"}},\"withdrawClaimDeposit(uint256)\":{\"details\":\"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.\",\"params\":{\"_epoch\":\"The epoch associated with the claim deposit to withraw.\"}}},\"stateVariables\":{\"challengePeriod\":{\"details\":\"Returns the challenge period.\"},\"epochPeriod\":{\"details\":\"Returns the epoch period.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"verifySafeBatch(uint256,bytes32)\":{\"notice\":\"Note: Access restricted to the Safe Bridge.\"}},\"notice\":\"Fast Receiver On Ethereum Counterpart of `FastSenderFromArbitrum`\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/bridge/FastBridgeReceiverOnEthereum.sol\":\"FastBridgeReceiverOnEthereum\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/bridge/FastBridgeReceiverOnEthereum.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\\nimport \\\"./interfaces/IFastBridgeReceiver.sol\\\";\\nimport \\\"./interfaces/ISafeBridgeReceiver.sol\\\";\\nimport \\\"./canonical/arbitrum/IInbox.sol\\\";\\nimport \\\"./canonical/arbitrum/IOutbox.sol\\\";\\n\\n/**\\n * Fast Receiver On Ethereum\\n * Counterpart of `FastSenderFromArbitrum`\\n */\\ncontract FastBridgeReceiverOnEthereum is IFastBridgeReceiver, ISafeBridgeReceiver {\\n // **************************************** //\\n // * * //\\n // * Ethereum Receiver Specific * //\\n // * * //\\n // **************************************** //\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n IInbox public immutable inbox; // The address of the Arbitrum Inbox contract.\\n\\n // ************************************* //\\n // * Views * //\\n // ************************************* //\\n\\n function isSentBySafeBridge() internal view override returns (bool) {\\n IOutbox outbox = IOutbox(inbox.bridge().activeOutbox());\\n return outbox.l2ToL1Sender() == safeBridgeSender;\\n }\\n\\n /**\\n * @dev Constructor.\\n * @param _deposit The deposit amount to submit a claim in wei.\\n * @param _epochPeriod The duration of each epoch.\\n * @param _challengePeriod The duration of the period allowing to challenge a claim.\\n * @param _safeBridgeSender The address of the Safe Bridge Sender on the connecting chain.\\n * @param _inbox Ethereum receiver specific: The address of the inbox contract on Ethereum.\\n */\\n constructor(\\n uint256 _deposit,\\n uint256 _epochPeriod,\\n uint256 _challengePeriod,\\n address _safeBridgeSender,\\n address _inbox // Ethereum receiver specific\\n ) {\\n deposit = _deposit;\\n epochPeriod = _epochPeriod;\\n challengePeriod = _challengePeriod;\\n safeBridgeSender = _safeBridgeSender;\\n inbox = IInbox(_inbox); // Ethereum receiver specific\\n }\\n\\n // ************************************** //\\n // * * //\\n // * General Receiver * //\\n // * * //\\n // ************************************** //\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct Claim {\\n bytes32 batchMerkleRoot;\\n address bridger;\\n uint32 timestamp;\\n bool honest;\\n bool verificationAttempted;\\n bool depositAndRewardWithdrawn;\\n }\\n\\n struct Challenge {\\n address challenger;\\n bool honest;\\n bool depositAndRewardWithdrawn;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public immutable deposit; // The deposit required to submit a claim or challenge\\n uint256 public immutable override epochPeriod; // Epochs mark the period between potential batches of messages.\\n uint256 public immutable override challengePeriod; // Epochs mark the period between potential batches of messages.\\n address public immutable safeBridgeSender; // The address of the Safe Bridge Sender on the connecting chain.\\n\\n mapping(uint256 => bytes32) public fastInbox; // epoch => validated batch merkle root(optimistically, or challenged and verified with the safe bridge)\\n mapping(uint256 => Claim) public claims; // epoch => claim\\n mapping(uint256 => Challenge) public challenges; // epoch => challenge\\n mapping(uint256 => mapping(uint256 => bytes32)) public relayed; // epoch => packed replay bitmap\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Submit a claim about the `_batchMerkleRoot` for the last completed epoch from the Fast Bridge 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 in which the batch to claim.\\n * @param _batchMerkleRoot The batch merkle root claimed for the last completed epoch.\\n */\\n function claim(uint256 _epoch, bytes32 _batchMerkleRoot) external payable override {\\n require(msg.value >= deposit, \\\"Insufficient claim deposit.\\\");\\n require(_batchMerkleRoot != bytes32(0), \\\"Invalid claim.\\\");\\n\\n uint256 epochNow = block.timestamp / epochPeriod;\\n // allow claim about current or previous epoch\\n require(_epoch == epochNow || _epoch == epochNow + 1, \\\"Invalid Claim\\\");\\n require(claims[_epoch].bridger == address(0), \\\"Claim already made for most recent finalized epoch.\\\");\\n\\n claims[_epoch] = Claim({\\n batchMerkleRoot: _batchMerkleRoot,\\n bridger: msg.sender,\\n timestamp: uint32(block.timestamp),\\n honest: false,\\n verificationAttempted: false,\\n depositAndRewardWithdrawn: false\\n });\\n emit ClaimReceived(_epoch, _batchMerkleRoot);\\n }\\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 override {\\n require(msg.value >= deposit, \\\"Not enough claim deposit\\\");\\n\\n // Can only challenge the only active claim, about the previous epoch\\n require(claims[_epoch].bridger != address(0), \\\"No claim to challenge.\\\");\\n require(block.timestamp < uint256(claims[_epoch].timestamp) + challengePeriod, \\\"Challenge period elapsed.\\\");\\n\\n challenges[_epoch] = Challenge({challenger: msg.sender, honest: false, depositAndRewardWithdrawn: false});\\n emit ClaimChallenged(_epoch);\\n }\\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 override {\\n Claim storage claim = claims[_epoch];\\n require(claim.bridger != address(0), \\\"Invalid epoch, no claim to verify.\\\");\\n require(claim.verificationAttempted == false, \\\"Optimistic verification already attempted.\\\");\\n require(\\n block.timestamp > uint256(claims[_epoch].timestamp) + challengePeriod,\\n \\\"Challenge period has not yet elapsed.\\\"\\n );\\n\\n if (challenges[_epoch].challenger == address(0)) {\\n // Optimistic happy path\\n claim.honest = true;\\n fastInbox[_epoch] = claim.batchMerkleRoot;\\n emit BatchVerified(_epoch, true);\\n } else {\\n emit BatchVerified(_epoch, false);\\n }\\n claim.verificationAttempted = true;\\n }\\n\\n /**\\n * Note: Access restricted to the Safe Bridge.\\n * @dev Resolves any challenge of the optimistic claim for '_epoch'.\\n * @param _epoch The epoch to verify.\\n * @param _batchMerkleRoot The true batch merkle root for the epoch.\\n */\\n function verifySafeBatch(uint256 _epoch, bytes32 _batchMerkleRoot) external override onlyFromSafeBridge {\\n require(isSentBySafeBridge(), \\\"Access not allowed: SafeBridgeSender only.\\\");\\n\\n fastInbox[_epoch] = _batchMerkleRoot;\\n\\n // Corner cases:\\n // a) No claim submitted,\\n // b) Receiving the root of an empty batch,\\n // c) Batch root is zero.\\n if (claims[_epoch].bridger != address(0)) {\\n if (_batchMerkleRoot == claims[_epoch].batchMerkleRoot) {\\n claims[_epoch].honest = true;\\n } else {\\n claims[_epoch].honest = false;\\n challenges[_epoch].honest = true;\\n }\\n }\\n emit BatchSafeVerified(_epoch, claims[_epoch].honest, challenges[_epoch].honest);\\n }\\n\\n /**\\n * @dev Verifies merkle proof for the given message and associated nonce for the 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 override {\\n bytes32 batchMerkleRoot = fastInbox[_epoch];\\n require(batchMerkleRoot != bytes32(0), \\\"Invalid epoch.\\\");\\n\\n // Claim assessment if any\\n require(validateProof(_proof, sha256(_message), batchMerkleRoot) == true, \\\"Invalid proof.\\\");\\n require(_checkReplayAndRelay(_epoch, _message), \\\"Failed to call contract\\\"); // Checks-Effects-Interaction\\n }\\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 override {\\n Claim storage claim = claims[_epoch];\\n\\n require(claim.bridger != address(0), \\\"Claim does not exist\\\");\\n require(claim.honest == true, \\\"Claim failed.\\\");\\n require(claim.depositAndRewardWithdrawn == false, \\\"Claim deposit and any rewards already withdrawn.\\\");\\n\\n uint256 amount = deposit;\\n if (challenges[_epoch].challenger != address(0) && challenges[_epoch].honest == false) {\\n amount += deposit / 2; // half burnt\\n }\\n\\n claim.depositAndRewardWithdrawn = true;\\n emit ClaimDepositWithdrawn(_epoch, claim.bridger);\\n\\n payable(claim.bridger).send(amount); // Use of send to prevent reverting fallback. User is responsibility for accepting ETH.\\n // Checks-Effects-Interaction\\n }\\n\\n /**\\n * @dev Sends the deposit back to the Challenger if their 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 override {\\n Challenge storage challenge = challenges[_epoch];\\n\\n require(challenge.challenger != address(0), \\\"Challenge does not exist\\\");\\n require(challenge.honest == true, \\\"Challenge failed.\\\");\\n require(challenge.depositAndRewardWithdrawn == false, \\\"Challenge deposit and rewards already withdrawn.\\\");\\n\\n uint256 amount = deposit;\\n if (claims[_epoch].bridger != address(0) && claims[_epoch].honest == false) {\\n amount += deposit / 2; // half burnt\\n }\\n\\n challenge.depositAndRewardWithdrawn = true;\\n emit ChallengeDepositWithdrawn(_epoch, challenge.challenger);\\n\\n payable(challenge.challenger).send(amount); // Use of send to prevent reverting fallback. User is responsibility for accepting ETH.\\n // Checks-Effects-Interaction\\n }\\n\\n // ********************************** //\\n // * Merkle Proof * //\\n // ********************************** //\\n\\n /**\\n * @dev Validates membership of leaf in merkle tree with merkle proof.\\n * Note: Inlined from `merkle/MerkleProof.sol` for performance.\\n * @param proof The merkle proof.\\n * @param leaf The leaf to validate membership in merkle tree.\\n * @param merkleRoot The root of the merkle tree.\\n */\\n function validateProof(\\n bytes32[] memory proof,\\n bytes32 leaf,\\n bytes32 merkleRoot\\n ) internal pure returns (bool) {\\n return (merkleRoot == calculateRoot(proof, leaf));\\n }\\n\\n /**\\n * @dev Calculates merkle root from proof.\\n * @param proof The merkle proof.\\n * @param leaf The leaf to validate membership in merkle tree..\\n */\\n function calculateRoot(bytes32[] memory proof, bytes32 leaf) private pure returns (bytes32) {\\n uint256 proofLength = proof.length;\\n require(proofLength <= 32, \\\"Invalid Proof\\\");\\n bytes32 h = leaf;\\n for (uint256 i = 0; i < proofLength; i++) {\\n bytes32 proofElement = proof[i];\\n // effecient hash\\n if (proofElement > h)\\n assembly {\\n mstore(0x00, h)\\n mstore(0x20, proofElement)\\n h := keccak256(0x00, 0x40)\\n }\\n else\\n assembly {\\n mstore(0x00, proofElement)\\n mstore(0x20, h)\\n h := keccak256(0x00, 0x40)\\n }\\n }\\n return h;\\n }\\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 override returns (uint256 start, uint256 end) {\\n // start begins latest after the claim deadline expiry\\n // however can begin as soon as a claim is made\\n // can only challenge the only active claim, about the previous epoch\\n start = claims[_epoch].timestamp;\\n end = start + challengePeriod;\\n }\\n\\n // ************************ //\\n // * Internal * //\\n // ************************ //\\n\\n function _checkReplayAndRelay(uint256 _epoch, bytes calldata _messageData) internal returns (bool success) {\\n // Decode the receiver address from the data encoded by the IFastBridgeSender\\n (uint256 nonce, address receiver, bytes memory data) = abi.decode(_messageData, (uint256, address, bytes));\\n\\n uint256 index = nonce / 256;\\n uint256 offset = nonce % 256;\\n bytes32 replay = relayed[_epoch][index];\\n require(((replay >> offset) & bytes32(uint256(1))) == 0, \\\"Message already relayed\\\");\\n relayed[_epoch][index] = replay | bytes32(1 << offset);\\n emit MessageRelayed(_epoch, nonce);\\n\\n (success, ) = receiver.call(data);\\n // Checks-Effects-Interaction\\n }\\n}\\n\",\"keccak256\":\"0x12268e97d61b51c8fb276998e202e987c5f2e0950f8e3a0ee27c1f90598a996b\",\"license\":\"MIT\"},\"src/bridge/canonical/arbitrum/IInbox.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\n/*\\n * Copyright 2019-2021, Offchain Labs, Inc.\\n *\\n * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n * you may not use this file except in compliance with the License.\\n * You may obtain a copy of the License at\\n *\\n * http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n * See the License for the specific language governing permissions and\\n * limitations under the License.\\n */\\n\\npragma solidity >=0.7.0;\\n\\ninterface IInbox {\\n function sendL2Message(bytes calldata messageData) external returns (uint256);\\n\\n function sendUnsignedTransaction(\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n uint256 nonce,\\n address destAddr,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (uint256);\\n\\n function sendContractTransaction(\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n address destAddr,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (uint256);\\n\\n function sendL1FundedUnsignedTransaction(\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n uint256 nonce,\\n address destAddr,\\n bytes calldata data\\n ) external payable returns (uint256);\\n\\n function sendL1FundedContractTransaction(\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n address destAddr,\\n bytes calldata data\\n ) external payable returns (uint256);\\n\\n function createRetryableTicket(\\n address destAddr,\\n uint256 arbTxCallValue,\\n uint256 maxSubmissionCost,\\n address submissionRefundAddress,\\n address valueRefundAddress,\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n bytes calldata data\\n ) external payable returns (uint256);\\n\\n function depositEth(uint256 maxSubmissionCost) external payable returns (uint256);\\n\\n function bridge() external view returns (IBridge);\\n}\\n\\ninterface IBridge {\\n event MessageDelivered(\\n uint256 indexed messageIndex,\\n bytes32 indexed beforeInboxAcc,\\n address inbox,\\n uint8 kind,\\n address sender,\\n bytes32 messageDataHash\\n );\\n\\n function deliverMessageToInbox(\\n uint8 kind,\\n address sender,\\n bytes32 messageDataHash\\n ) external payable returns (uint256);\\n\\n function executeCall(\\n address destAddr,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (bool success, bytes memory returnData);\\n\\n // These are only callable by the admin\\n function setInbox(address inbox, bool enabled) external;\\n\\n function setOutbox(address inbox, bool enabled) external;\\n\\n // View functions\\n\\n function activeOutbox() external view returns (address);\\n\\n function allowedInboxes(address inbox) external view returns (bool);\\n\\n function allowedOutboxes(address outbox) external view returns (bool);\\n\\n function inboxAccs(uint256 index) external view returns (bytes32);\\n\\n function messageCount() external view returns (uint256);\\n}\\n\\ninterface IMessageProvider {\\n event InboxMessageDelivered(uint256 indexed messageNum, bytes data);\\n\\n event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum);\\n}\\n\",\"keccak256\":\"0xb567e54805f44ea8405231284583880a38e8a22bfe619528a4f8ec7550f11d1b\",\"license\":\"Apache-2.0\"},\"src/bridge/canonical/arbitrum/IOutbox.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\n/*\\n * Copyright 2021, Offchain Labs, Inc.\\n *\\n * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n * you may not use this file except in compliance with the License.\\n * You may obtain a copy of the License at\\n *\\n * http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n * See the License for the specific language governing permissions and\\n * limitations under the License.\\n */\\n\\npragma solidity >=0.7.0;\\n\\ninterface IOutbox {\\n event OutboxEntryCreated(uint256 indexed batchNum, uint256 outboxIndex, bytes32 outputRoot, uint256 numInBatch);\\n\\n function l2ToL1Sender() external view returns (address);\\n\\n function l2ToL1Block() external view returns (uint256);\\n\\n function l2ToL1EthBlock() external view returns (uint256);\\n\\n function l2ToL1Timestamp() external view returns (uint256);\\n\\n function processOutgoingMessages(bytes calldata sendsData, uint256[] calldata sendLengths) external;\\n}\\n\",\"keccak256\":\"0xdc4952b5238d6c6282595b2eab4058c86d2d232b99a2d67556c02d6c11eea94f\",\"license\":\"Apache-2.0\"},\"src/bridge/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\"},\"src/bridge/interfaces/ISafeBridgeReceiver.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\\nabstract contract ISafeBridgeReceiver {\\n /**\\n * Note: Access restricted to the Safe Bridge.\\n * @dev Resolves any challenge of the optimistic claim for '_epoch'.\\n * @param _epoch The epoch associated with the _batchmerkleRoot.\\n * @param _batchMerkleRoot The true batch merkle root for the epoch sent by the safe bridge.\\n */\\n function verifySafeBatch(uint256 _epoch, bytes32 _batchMerkleRoot) external virtual;\\n\\n function isSentBySafeBridge() internal view virtual returns (bool);\\n\\n modifier onlyFromSafeBridge() {\\n require(isSentBySafeBridge(), \\\"Safe Bridge only.\\\");\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xc4bee04423c73bf37e7d975fccab05767ba0e738cc753d293438c2d1ace9f804\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101206040523480156200001257600080fd5b5060405162001c9838038062001c9883398101604081905262000035916200007a565b60a09490945260c09290925260e0526001600160a01b039081166101005216608052620000cf565b80516001600160a01b03811681146200007557600080fd5b919050565b600080600080600060a086880312156200009357600080fd5b855194506020860151935060408601519250620000b3606087016200005d565b9150620000c3608087016200005d565b90509295509295909350565b60805160a05160c05160e05161010051611b3062000168600039600081816103a101526114d80152600081816104410152818161078e01528181610ca2015261103501526000818161034d01526105710152600081816103ed015281816104b9015281816108f00152818161094901528181610bba015281816112cc015261132901526000818161049501526113d50152611b306000f3fe6080604052600436106100fe5760003560e01c8063b141770311610095578063d0e30db011610064578063d0e30db0146103db578063dfe3a3ae1461040f578063f3f480d91461042f578063f4cf751b14610463578063fb0e722b1461048357600080fd5b8063b141770314610303578063b5b7a1841461033b578063ba7f4d761461036f578063c2ef14871461038f57600080fd5b80635bfe5f1a116100d15780635bfe5f1a146101ad5780638f1d3776146101cd578063a888c2cd14610240578063ab82d9a0146102f057600080fd5b80632a9700a11461010357806331d1445714610143578063383b90f91461015857806350b81dbe1461018d575b600080fd5b34801561010f57600080fd5b5061013061011e3660046117ab565b60006020819052908152604090205481565b6040519081526020015b60405180910390f35b6101566101513660046117c4565b6104b7565b005b34801561016457600080fd5b506101786101733660046117ab565b610769565b6040805192835260208301919091520161013a565b34801561019957600080fd5b506101566101a83660046117ab565b6107ba565b3480156101b957600080fd5b506101566101c83660046117c4565b6109f8565b3480156101d957600080fd5b506102196101e83660046117ab565b6002602052600090815260409020546001600160a01b0381169060ff600160a01b8204811691600160a81b90041683565b604080516001600160a01b039094168452911515602084015215159082015260600161013a565b34801561024c57600080fd5b506102ac61025b3660046117ab565b600160208190526000918252604090912080549101546001600160a01b0381169063ffffffff600160a01b8204169060ff600160c01b8204811691600160c81b8104821691600160d01b9091041686565b604080519687526001600160a01b03909516602087015263ffffffff90931693850193909352151560608401529015156080830152151560a082015260c00161013a565b6101566102fe3660046117ab565b610bb8565b34801561030f57600080fd5b5061013061031e3660046117c4565b600360209081526000928352604080842090915290825290205481565b34801561034757600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561037b57600080fd5b5061015661038a36600461182f565b610dbb565b34801561039b57600080fd5b506103c37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161013a565b3480156103e757600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561041b57600080fd5b5061015661042a3660046117ab565b610f38565b34801561043b57600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561046f57600080fd5b5061015661047e3660046117ab565b61118f565b34801561048f57600080fd5b506103c37f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000034101561052c5760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e7420636c61696d206465706f7369742e000000000060448201526064015b60405180910390fd5b8061056a5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b630b4b69760911b6044820152606401610523565b60006105967f000000000000000000000000000000000000000000000000000000000000000042611906565b9050808314806105af57506105ac81600161191a565b83145b6105eb5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420436c61696d60981b6044820152606401610523565b600083815260016020819052604090912001546001600160a01b0316156106705760405162461bcd60e51b815260206004820152603360248201527f436c61696d20616c7265616479206d61646520666f72206d6f73742072656365604482015272373a103334b730b634bd32b21032b837b1b41760691b6064820152608401610523565b6040805160c08101825283815233602080830191825263ffffffff4281168486019081526000606086018181526080870182815260a088018381528c845260019687905289842098518955965197909501805493519151955196511515600160d01b0260ff60d01b19971515600160c81b0260ff60c81b19971515600160c01b029790971661ffff60c01b1993909616600160a01b026001600160c01b03199095166001600160a01b0399909916989098179390931716929092179290921792909216929092179091559051839185917f7eb220572187462098b6d5192bbe907549f0614d7c3580735a7e5c357a6157999190a3505050565b600081815260016020819052604082200154600160a01b900463ffffffff16906107b37f00000000000000000000000000000000000000000000000000000000000000008361191a565b9050915091565b6000818152600160208190526040909120908101546001600160a01b031661081b5760405162461bcd60e51b815260206004820152601460248201527310db185a5b48191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610523565b600181810154600160c01b900460ff1615151461086a5760405162461bcd60e51b815260206004820152600d60248201526c21b630b4b6903330b4b632b21760991b6044820152606401610523565b6001810154600160d01b900460ff16156108df5760405162461bcd60e51b815260206004820152603060248201527f436c61696d206465706f73697420616e6420616e79207265776172647320616c60448201526f3932b0b23c903bb4ba34323930bbb71760811b6064820152608401610523565b6000828152600260205260409020547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03161580159061093d5750600083815260026020526040902054600160a01b900460ff16155b1561097a5761096d60027f0000000000000000000000000000000000000000000000000000000000000000611906565b610977908261191a565b90505b60018201805460ff60d01b198116600160d01b179091556040516001600160a01b039091169084907f3d8490b2b1cee24079fde68fd6a415c1f12e9a76e8090ac027dad29b6660261990600090a360018201546040516001600160a01b039091169082156108fc029083906000818181858888f15050505050505050565b610a006113d0565b610a405760405162461bcd60e51b815260206004820152601160248201527029b0b33290213934b233b29037b7363c9760791b6044820152606401610523565b610a486113d0565b610aa75760405162461bcd60e51b815260206004820152602a60248201527f416363657373206e6f7420616c6c6f7765643a20536166654272696467655365604482015269373232b91037b7363c9760b11b6064820152608401610523565b60008281526020818152604080832084905560019182905290912001546001600160a01b031615610b4757600082815260016020526040902054811415610b1057600082815260016020819052604090912001805460ff60c01b1916600160c01b179055610b47565b6000828152600160208181526040808420909201805460ff60c01b19169055600290529020805460ff60a01b1916600160a01b1790555b6000828152600160208181526040808420909201546002825292829020548251600160c01b90940460ff90811615158552600160a01b9091041615159083015283917f7451cfa583de6b2abaad934288f349736a4883acb348844352a320a1e1d38080910160405180910390a25050565b7f0000000000000000000000000000000000000000000000000000000000000000341015610c285760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636c61696d206465706f73697400000000000000006044820152606401610523565b600081815260016020819052604090912001546001600160a01b0316610c895760405162461bcd60e51b815260206004820152601660248201527527379031b630b4b6903a379031b430b63632b733b29760511b6044820152606401610523565b60008181526001602081905260409091200154610cd4907f000000000000000000000000000000000000000000000000000000000000000090600160a01b900463ffffffff1661191a565b4210610d225760405162461bcd60e51b815260206004820152601960248201527f4368616c6c656e676520706572696f6420656c61707365642e000000000000006044820152606401610523565b6040805160608101825233815260006020808301828152838501838152868452600290925284832093518454915192511515600160a81b0260ff60a81b19931515600160a01b026001600160a81b03199093166001600160a01b039290921691909117919091179190911617909155905182917fe7230bb507d3a19678a0138ccb36eec02510dd27f11e37e2c9644d597dbc693891a250565b60008581526020819052604090205480610e085760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21032b837b1b41760911b6044820152606401610523565b610e978585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060405160029250610e51915087908790611932565b602060405180830381855afa158015610e6e573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610e919190611942565b83611581565b1515600114610ed95760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b210383937b7b31760911b6044820152606401610523565b610ee4868484611597565b610f305760405162461bcd60e51b815260206004820152601760248201527f4661696c656420746f2063616c6c20636f6e74726163740000000000000000006044820152606401610523565b505050505050565b6000818152600160208190526040909120908101546001600160a01b0316610fad5760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642065706f63682c206e6f20636c61696d20746f2076657269666044820152613c9760f11b6064820152608401610523565b6001810154600160c81b900460ff161561101c5760405162461bcd60e51b815260206004820152602a60248201527f4f7074696d697374696320766572696669636174696f6e20616c72656164792060448201526930ba3a32b6b83a32b21760b11b6064820152608401610523565b60008281526001602081905260409091200154611067907f000000000000000000000000000000000000000000000000000000000000000090600160a01b900463ffffffff1661191a565b42116110c35760405162461bcd60e51b815260206004820152602560248201527f4368616c6c656e676520706572696f6420686173206e6f742079657420656c616044820152643839b2b21760d91b6064820152608401610523565b6000828152600260205260409020546001600160a01b0316611141576001818101805460ff60c01b1916600160c01b179055815460008481526020818152604091829020929092555191825283917f8fa19318c4280299918d1220c80ba5db06b26b8947b75384ce2d74ba043c0265910160405180910390a2611178565b6040516000815282907f8fa19318c4280299918d1220c80ba5db06b26b8947b75384ce2d74ba043c02659060200160405180910390a25b600101805460ff60c81b1916600160c81b17905550565b600081815260026020526040902080546001600160a01b03166111f45760405162461bcd60e51b815260206004820152601860248201527f4368616c6c656e676520646f6573206e6f7420657869737400000000000000006044820152606401610523565b8054600160a01b900460ff1615156001146112455760405162461bcd60e51b815260206004820152601160248201527021b430b63632b733b2903330b4b632b21760791b6044820152606401610523565b8054600160a81b900460ff16156112b75760405162461bcd60e51b815260206004820152603060248201527f4368616c6c656e6765206465706f73697420616e64207265776172647320616c60448201526f3932b0b23c903bb4ba34323930bbb71760811b6064820152608401610523565b600082815260016020819052604090912001547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03161580159061131d575060008381526001602081905260409091200154600160c01b900460ff16155b1561135a5761134d60027f0000000000000000000000000000000000000000000000000000000000000000611906565b611357908261191a565b90505b815460ff60a81b198116600160a81b1783556040516001600160a01b039091169084907f9e0ea87919796fe5ad8e4362a6a3ff07f6a73e0731b94f451d7184e4928f313b90600090a381546040516001600160a01b039091169082156108fc029083906000818181858888f15050505050505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e78cea926040518163ffffffff1660e01b815260040160206040518083038186803b15801561142c57600080fd5b505afa158015611440573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114649190611973565b6001600160a01b031663ab5d89436040518163ffffffff1660e01b815260040160206040518083038186803b15801561149c57600080fd5b505afa1580156114b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d49190611973565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03166380648b026040518163ffffffff1660e01b815260040160206040518083038186803b15801561153957600080fd5b505afa15801561154d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115719190611973565b6001600160a01b03161491505090565b600061158d84846116f3565b9091149392505050565b60008080806115a8858701876119ad565b9194509250905060006115bd61010085611906565b905060006115cd61010086611a7a565b60008a815260036020908152604080832086845290915290205490915080821c6001161561163d5760405162461bcd60e51b815260206004820152601760248201527f4d65737361676520616c72656164792072656c617965640000000000000000006044820152606401610523565b60008a81526003602090815260408083208684529091528082206001851b841790555187918c917f7f2ae957b8ae493c532b836f8a7e17178d402b24829677739558336424ae335f9190a3846001600160a01b0316846040516116a09190611a8e565b6000604051808303816000865af19150503d80600081146116dd576040519150601f19603f3d011682016040523d82523d6000602084013e6116e2565b606091505b50909b9a5050505050505050505050565b815160009060208111156117395760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210283937b7b360991b6044820152606401610523565b8260005b828110156117a257600086828151811061175957611759611ac9565b602002602001015190508281111561177f5782600052806020526040600020925061178f565b8060005282602052604060002092505b508061179a81611adf565b91505061173d565b50949350505050565b6000602082840312156117bd57600080fd5b5035919050565b600080604083850312156117d757600080fd5b50508035926020909101359150565b60008083601f8401126117f857600080fd5b50813567ffffffffffffffff81111561181057600080fd5b60208301915083602082850101111561182857600080fd5b9250929050565b60008060008060006060868803121561184757600080fd5b85359450602086013567ffffffffffffffff8082111561186657600080fd5b818801915088601f83011261187a57600080fd5b81358181111561188957600080fd5b8960208260051b850101111561189e57600080fd5b6020830196508095505060408801359150808211156118bc57600080fd5b506118c9888289016117e6565b969995985093965092949392505050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082611915576119156118da565b500490565b6000821982111561192d5761192d6118f0565b500190565b8183823760009101908152919050565b60006020828403121561195457600080fd5b5051919050565b6001600160a01b038116811461197057600080fd5b50565b60006020828403121561198557600080fd5b81516119908161195b565b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156119c257600080fd5b8335925060208401356119d48161195b565b9150604084013567ffffffffffffffff808211156119f157600080fd5b818601915086601f830112611a0557600080fd5b813581811115611a1757611a17611997565b604051601f8201601f19908116603f01168101908382118183101715611a3f57611a3f611997565b81604052828152896020848701011115611a5857600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600082611a8957611a896118da565b500690565b6000825160005b81811015611aaf5760208186018101518583015201611a95565b81811115611abe576000828501525b509190910192915050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611af357611af36118f0565b506001019056fea2646970667358221220a56590433e0dfda6714a96a98bf4689e981841c72d850ccac75cc788553712a864736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100fe5760003560e01c8063b141770311610095578063d0e30db011610064578063d0e30db0146103db578063dfe3a3ae1461040f578063f3f480d91461042f578063f4cf751b14610463578063fb0e722b1461048357600080fd5b8063b141770314610303578063b5b7a1841461033b578063ba7f4d761461036f578063c2ef14871461038f57600080fd5b80635bfe5f1a116100d15780635bfe5f1a146101ad5780638f1d3776146101cd578063a888c2cd14610240578063ab82d9a0146102f057600080fd5b80632a9700a11461010357806331d1445714610143578063383b90f91461015857806350b81dbe1461018d575b600080fd5b34801561010f57600080fd5b5061013061011e3660046117ab565b60006020819052908152604090205481565b6040519081526020015b60405180910390f35b6101566101513660046117c4565b6104b7565b005b34801561016457600080fd5b506101786101733660046117ab565b610769565b6040805192835260208301919091520161013a565b34801561019957600080fd5b506101566101a83660046117ab565b6107ba565b3480156101b957600080fd5b506101566101c83660046117c4565b6109f8565b3480156101d957600080fd5b506102196101e83660046117ab565b6002602052600090815260409020546001600160a01b0381169060ff600160a01b8204811691600160a81b90041683565b604080516001600160a01b039094168452911515602084015215159082015260600161013a565b34801561024c57600080fd5b506102ac61025b3660046117ab565b600160208190526000918252604090912080549101546001600160a01b0381169063ffffffff600160a01b8204169060ff600160c01b8204811691600160c81b8104821691600160d01b9091041686565b604080519687526001600160a01b03909516602087015263ffffffff90931693850193909352151560608401529015156080830152151560a082015260c00161013a565b6101566102fe3660046117ab565b610bb8565b34801561030f57600080fd5b5061013061031e3660046117c4565b600360209081526000928352604080842090915290825290205481565b34801561034757600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561037b57600080fd5b5061015661038a36600461182f565b610dbb565b34801561039b57600080fd5b506103c37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161013a565b3480156103e757600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561041b57600080fd5b5061015661042a3660046117ab565b610f38565b34801561043b57600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561046f57600080fd5b5061015661047e3660046117ab565b61118f565b34801561048f57600080fd5b506103c37f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000034101561052c5760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e7420636c61696d206465706f7369742e000000000060448201526064015b60405180910390fd5b8061056a5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b630b4b69760911b6044820152606401610523565b60006105967f000000000000000000000000000000000000000000000000000000000000000042611906565b9050808314806105af57506105ac81600161191a565b83145b6105eb5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420436c61696d60981b6044820152606401610523565b600083815260016020819052604090912001546001600160a01b0316156106705760405162461bcd60e51b815260206004820152603360248201527f436c61696d20616c7265616479206d61646520666f72206d6f73742072656365604482015272373a103334b730b634bd32b21032b837b1b41760691b6064820152608401610523565b6040805160c08101825283815233602080830191825263ffffffff4281168486019081526000606086018181526080870182815260a088018381528c845260019687905289842098518955965197909501805493519151955196511515600160d01b0260ff60d01b19971515600160c81b0260ff60c81b19971515600160c01b029790971661ffff60c01b1993909616600160a01b026001600160c01b03199095166001600160a01b0399909916989098179390931716929092179290921792909216929092179091559051839185917f7eb220572187462098b6d5192bbe907549f0614d7c3580735a7e5c357a6157999190a3505050565b600081815260016020819052604082200154600160a01b900463ffffffff16906107b37f00000000000000000000000000000000000000000000000000000000000000008361191a565b9050915091565b6000818152600160208190526040909120908101546001600160a01b031661081b5760405162461bcd60e51b815260206004820152601460248201527310db185a5b48191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610523565b600181810154600160c01b900460ff1615151461086a5760405162461bcd60e51b815260206004820152600d60248201526c21b630b4b6903330b4b632b21760991b6044820152606401610523565b6001810154600160d01b900460ff16156108df5760405162461bcd60e51b815260206004820152603060248201527f436c61696d206465706f73697420616e6420616e79207265776172647320616c60448201526f3932b0b23c903bb4ba34323930bbb71760811b6064820152608401610523565b6000828152600260205260409020547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03161580159061093d5750600083815260026020526040902054600160a01b900460ff16155b1561097a5761096d60027f0000000000000000000000000000000000000000000000000000000000000000611906565b610977908261191a565b90505b60018201805460ff60d01b198116600160d01b179091556040516001600160a01b039091169084907f3d8490b2b1cee24079fde68fd6a415c1f12e9a76e8090ac027dad29b6660261990600090a360018201546040516001600160a01b039091169082156108fc029083906000818181858888f15050505050505050565b610a006113d0565b610a405760405162461bcd60e51b815260206004820152601160248201527029b0b33290213934b233b29037b7363c9760791b6044820152606401610523565b610a486113d0565b610aa75760405162461bcd60e51b815260206004820152602a60248201527f416363657373206e6f7420616c6c6f7765643a20536166654272696467655365604482015269373232b91037b7363c9760b11b6064820152608401610523565b60008281526020818152604080832084905560019182905290912001546001600160a01b031615610b4757600082815260016020526040902054811415610b1057600082815260016020819052604090912001805460ff60c01b1916600160c01b179055610b47565b6000828152600160208181526040808420909201805460ff60c01b19169055600290529020805460ff60a01b1916600160a01b1790555b6000828152600160208181526040808420909201546002825292829020548251600160c01b90940460ff90811615158552600160a01b9091041615159083015283917f7451cfa583de6b2abaad934288f349736a4883acb348844352a320a1e1d38080910160405180910390a25050565b7f0000000000000000000000000000000000000000000000000000000000000000341015610c285760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636c61696d206465706f73697400000000000000006044820152606401610523565b600081815260016020819052604090912001546001600160a01b0316610c895760405162461bcd60e51b815260206004820152601660248201527527379031b630b4b6903a379031b430b63632b733b29760511b6044820152606401610523565b60008181526001602081905260409091200154610cd4907f000000000000000000000000000000000000000000000000000000000000000090600160a01b900463ffffffff1661191a565b4210610d225760405162461bcd60e51b815260206004820152601960248201527f4368616c6c656e676520706572696f6420656c61707365642e000000000000006044820152606401610523565b6040805160608101825233815260006020808301828152838501838152868452600290925284832093518454915192511515600160a81b0260ff60a81b19931515600160a01b026001600160a81b03199093166001600160a01b039290921691909117919091179190911617909155905182917fe7230bb507d3a19678a0138ccb36eec02510dd27f11e37e2c9644d597dbc693891a250565b60008581526020819052604090205480610e085760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21032b837b1b41760911b6044820152606401610523565b610e978585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060405160029250610e51915087908790611932565b602060405180830381855afa158015610e6e573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610e919190611942565b83611581565b1515600114610ed95760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b210383937b7b31760911b6044820152606401610523565b610ee4868484611597565b610f305760405162461bcd60e51b815260206004820152601760248201527f4661696c656420746f2063616c6c20636f6e74726163740000000000000000006044820152606401610523565b505050505050565b6000818152600160208190526040909120908101546001600160a01b0316610fad5760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642065706f63682c206e6f20636c61696d20746f2076657269666044820152613c9760f11b6064820152608401610523565b6001810154600160c81b900460ff161561101c5760405162461bcd60e51b815260206004820152602a60248201527f4f7074696d697374696320766572696669636174696f6e20616c72656164792060448201526930ba3a32b6b83a32b21760b11b6064820152608401610523565b60008281526001602081905260409091200154611067907f000000000000000000000000000000000000000000000000000000000000000090600160a01b900463ffffffff1661191a565b42116110c35760405162461bcd60e51b815260206004820152602560248201527f4368616c6c656e676520706572696f6420686173206e6f742079657420656c616044820152643839b2b21760d91b6064820152608401610523565b6000828152600260205260409020546001600160a01b0316611141576001818101805460ff60c01b1916600160c01b179055815460008481526020818152604091829020929092555191825283917f8fa19318c4280299918d1220c80ba5db06b26b8947b75384ce2d74ba043c0265910160405180910390a2611178565b6040516000815282907f8fa19318c4280299918d1220c80ba5db06b26b8947b75384ce2d74ba043c02659060200160405180910390a25b600101805460ff60c81b1916600160c81b17905550565b600081815260026020526040902080546001600160a01b03166111f45760405162461bcd60e51b815260206004820152601860248201527f4368616c6c656e676520646f6573206e6f7420657869737400000000000000006044820152606401610523565b8054600160a01b900460ff1615156001146112455760405162461bcd60e51b815260206004820152601160248201527021b430b63632b733b2903330b4b632b21760791b6044820152606401610523565b8054600160a81b900460ff16156112b75760405162461bcd60e51b815260206004820152603060248201527f4368616c6c656e6765206465706f73697420616e64207265776172647320616c60448201526f3932b0b23c903bb4ba34323930bbb71760811b6064820152608401610523565b600082815260016020819052604090912001547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03161580159061131d575060008381526001602081905260409091200154600160c01b900460ff16155b1561135a5761134d60027f0000000000000000000000000000000000000000000000000000000000000000611906565b611357908261191a565b90505b815460ff60a81b198116600160a81b1783556040516001600160a01b039091169084907f9e0ea87919796fe5ad8e4362a6a3ff07f6a73e0731b94f451d7184e4928f313b90600090a381546040516001600160a01b039091169082156108fc029083906000818181858888f15050505050505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e78cea926040518163ffffffff1660e01b815260040160206040518083038186803b15801561142c57600080fd5b505afa158015611440573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114649190611973565b6001600160a01b031663ab5d89436040518163ffffffff1660e01b815260040160206040518083038186803b15801561149c57600080fd5b505afa1580156114b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d49190611973565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03166380648b026040518163ffffffff1660e01b815260040160206040518083038186803b15801561153957600080fd5b505afa15801561154d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115719190611973565b6001600160a01b03161491505090565b600061158d84846116f3565b9091149392505050565b60008080806115a8858701876119ad565b9194509250905060006115bd61010085611906565b905060006115cd61010086611a7a565b60008a815260036020908152604080832086845290915290205490915080821c6001161561163d5760405162461bcd60e51b815260206004820152601760248201527f4d65737361676520616c72656164792072656c617965640000000000000000006044820152606401610523565b60008a81526003602090815260408083208684529091528082206001851b841790555187918c917f7f2ae957b8ae493c532b836f8a7e17178d402b24829677739558336424ae335f9190a3846001600160a01b0316846040516116a09190611a8e565b6000604051808303816000865af19150503d80600081146116dd576040519150601f19603f3d011682016040523d82523d6000602084013e6116e2565b606091505b50909b9a5050505050505050505050565b815160009060208111156117395760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210283937b7b360991b6044820152606401610523565b8260005b828110156117a257600086828151811061175957611759611ac9565b602002602001015190508281111561177f5782600052806020526040600020925061178f565b8060005282602052604060002092505b508061179a81611adf565b91505061173d565b50949350505050565b6000602082840312156117bd57600080fd5b5035919050565b600080604083850312156117d757600080fd5b50508035926020909101359150565b60008083601f8401126117f857600080fd5b50813567ffffffffffffffff81111561181057600080fd5b60208301915083602082850101111561182857600080fd5b9250929050565b60008060008060006060868803121561184757600080fd5b85359450602086013567ffffffffffffffff8082111561186657600080fd5b818801915088601f83011261187a57600080fd5b81358181111561188957600080fd5b8960208260051b850101111561189e57600080fd5b6020830196508095505060408801359150808211156118bc57600080fd5b506118c9888289016117e6565b969995985093965092949392505050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082611915576119156118da565b500490565b6000821982111561192d5761192d6118f0565b500190565b8183823760009101908152919050565b60006020828403121561195457600080fd5b5051919050565b6001600160a01b038116811461197057600080fd5b50565b60006020828403121561198557600080fd5b81516119908161195b565b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156119c257600080fd5b8335925060208401356119d48161195b565b9150604084013567ffffffffffffffff808211156119f157600080fd5b818601915086601f830112611a0557600080fd5b813581811115611a1757611a17611997565b604051601f8201601f19908116603f01168101908382118183101715611a3f57611a3f611997565b81604052828152896020848701011115611a5857600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600082611a8957611a896118da565b500690565b6000825160005b81811015611aaf5760208186018101518583015201611a95565b81811115611abe576000828501525b509190910192915050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611af357611af36118f0565b506001019056fea2646970667358221220a56590433e0dfda6714a96a98bf4689e981841c72d850ccac75cc788553712a864736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "challenge(uint256)": { + "details": "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.", + "params": { + "_epoch": "The epoch of the claim to challenge." + } + }, + "claim(uint256,bytes32)": { + "details": "Submit a claim about the `_batchMerkleRoot` for the last completed epoch from the Fast Bridge and submit a deposit. The `_batchMerkleRoot` should match the one on the sending side otherwise the sender will lose his deposit.", + "params": { + "_batchMerkleRoot": "The batch merkle root claimed for the last completed epoch.", + "_epoch": "The epoch in which the batch to claim." + } + }, + "claimChallengePeriod(uint256)": { + "details": "Returns the `start` and `end` time of challenge period for this `epoch`.", + "params": { + "_epoch": "The epoch of the claim to request the challenge period." + }, + "returns": { + "end": "The end time of the challenge period.", + "start": "The start time of the challenge period." + } + }, + "constructor": { + "details": "Constructor.", + "params": { + "_challengePeriod": "The duration of the period allowing to challenge a claim.", + "_deposit": "The deposit amount to submit a claim in wei.", + "_epochPeriod": "The duration of each epoch.", + "_inbox": "Ethereum receiver specific: The address of the inbox contract on Ethereum.", + "_safeBridgeSender": "The address of the Safe Bridge Sender on the connecting chain." + } + }, + "verifyAndRelayMessage(uint256,bytes32[],bytes)": { + "details": "Verifies merkle proof for the given message and associated nonce for the epoch and relays the message.", + "params": { + "_epoch": "The epoch in which the message was batched by the bridge.", + "_message": "The data on the cross-domain chain for the message.", + "_proof": "The merkle proof to prove the membership of the message and nonce in the merkle tree for the epoch." + } + }, + "verifyBatch(uint256)": { + "details": "Resolves the optimistic claim for '_epoch'.", + "params": { + "_epoch": "The epoch of the optimistic claim." + } + }, + "verifySafeBatch(uint256,bytes32)": { + "details": "Resolves any challenge of the optimistic claim for '_epoch'.", + "params": { + "_batchMerkleRoot": "The true batch merkle root for the epoch.", + "_epoch": "The epoch to verify." + } + }, + "withdrawChallengeDeposit(uint256)": { + "details": "Sends the deposit back to the Challenger if their challenge is successful. Includes a portion of the Bridger's deposit.", + "params": { + "_epoch": "The epoch associated with the challenge deposit to withraw." + } + }, + "withdrawClaimDeposit(uint256)": { + "details": "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.", + "params": { + "_epoch": "The epoch associated with the claim deposit to withraw." + } + } + }, + "stateVariables": { + "challengePeriod": { + "details": "Returns the challenge period." + }, + "epochPeriod": { + "details": "Returns the epoch period." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "verifySafeBatch(uint256,bytes32)": { + "notice": "Note: Access restricted to the Safe Bridge." + } + }, + "notice": "Fast Receiver On Ethereum Counterpart of `FastSenderFromArbitrum`", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 10588, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "fastInbox", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_uint256,t_bytes32)" + }, + { + "astId": 10593, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "claims", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_struct(Claim)10567_storage)" + }, + { + "astId": 10598, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "challenges", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_struct(Challenge)10574_storage)" + }, + { + "astId": 10604, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "relayed", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_bytes32))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_bytes32))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(uint256 => bytes32))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes32)" + }, + "t_mapping(t_uint256,t_struct(Challenge)10574_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct FastBridgeReceiverOnEthereum.Challenge)", + "numberOfBytes": "32", + "value": "t_struct(Challenge)10574_storage" + }, + "t_mapping(t_uint256,t_struct(Claim)10567_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct FastBridgeReceiverOnEthereum.Claim)", + "numberOfBytes": "32", + "value": "t_struct(Claim)10567_storage" + }, + "t_struct(Challenge)10574_storage": { + "encoding": "inplace", + "label": "struct FastBridgeReceiverOnEthereum.Challenge", + "members": [ + { + "astId": 10569, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "challenger", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 10571, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "honest", + "offset": 20, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 10573, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "depositAndRewardWithdrawn", + "offset": 21, + "slot": "0", + "type": "t_bool" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Claim)10567_storage": { + "encoding": "inplace", + "label": "struct FastBridgeReceiverOnEthereum.Claim", + "members": [ + { + "astId": 10556, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "batchMerkleRoot", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 10558, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "bridger", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 10560, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "timestamp", + "offset": 20, + "slot": "1", + "type": "t_uint32" + }, + { + "astId": 10562, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "honest", + "offset": 24, + "slot": "1", + "type": "t_bool" + }, + { + "astId": 10564, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "verificationAttempted", + "offset": 25, + "slot": "1", + "type": "t_bool" + }, + { + "astId": 10566, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "depositAndRewardWithdrawn", + "offset": 26, + "slot": "1", + "type": "t_bool" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + } + } + } +} diff --git a/contracts/deployments/goerli/ForeignGatewayOnEthereum.json b/contracts/deployments/goerli/ForeignGatewayOnEthereum.json new file mode 100644 index 000000000..36e0fcda7 --- /dev/null +++ b/contracts/deployments/goerli/ForeignGatewayOnEthereum.json @@ -0,0 +1,617 @@ +{ + "address": "0xf08273e2B35E78509B027f6FAa32485844EA7cCA", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract IFastBridgeReceiver", + "name": "_fastBridgeReceiver", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_feeForJuror", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "_senderGateway", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_senderChainID", + "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": "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" + }, + { + "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": "contract IFastBridgeReceiver", + "name": "_fastBridgeReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_gracePeriod", + "type": "uint256" + } + ], + "name": "changeFastbridge", + "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": "uint256", + "name": "_choices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "createDispute", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeID", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + } + ], + "name": "createSubcourtJurorFee", + "outputs": [], + "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": [], + "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": [ + { + "internalType": "bytes32", + "name": "_disputeHash", + "type": "bytes32" + } + ], + "name": "withdrawFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xd76a8ccc31aaeacfc39f0a25407bee70d9e6ed86de86f5dfab8ece4b67ab09d5", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0xf08273e2B35E78509B027f6FAa32485844EA7cCA", + "transactionIndex": 8, + "gasUsed": "994827", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x58139a9b1227e97ca899924bd671006def6dc35cc0739d01263bbae67a835bcd", + "transactionHash": "0xd76a8ccc31aaeacfc39f0a25407bee70d9e6ed86de86f5dfab8ece4b67ab09d5", + "logs": [], + "blockNumber": 7436908, + "cumulativeGasUsed": "5720357", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x87142b7E9C7D026776499120D902AF8896C07894", + [ + "100000000000000000" + ], + "0xc7e3BF90299f6BD9FA7c3703837A9CAbB5743636", + "0x0000000000000000000000000000000000000000000000000000000000066eed" + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\":\"uint256[]\",\"name\":\"_feeForJuror\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"_senderGateway\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_senderChainID\",\"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\":\"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\"},{\"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\":\"contract IFastBridgeReceiver\",\"name\":\"_fastBridgeReceiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gracePeriod\",\"type\":\"uint256\"}],\"name\":\"changeFastbridge\",\"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\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"createSubcourtJurorFee\",\"outputs\":[],\"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\":[],\"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\":[{\"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.\"}},\"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).\"}},\"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.\"}},\"createDispute(uint256,bytes)\":{\"details\":\"Create a dispute. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_choices\":\"Amount of choices the arbitrator can make in this dispute.\",\"_extraData\":\"Can be used to give additional info on the dispute to be created.\"},\"returns\":{\"disputeID\":\"ID of the dispute created.\"}},\"createSubcourtJurorFee(uint256)\":{\"details\":\"Creates the `feeForJuror` property value for a new subcourt.\",\"params\":{\"_feeForJuror\":\"The new value for the `feeForJuror` property value.\"}}},\"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/ForeignGateway.sol\":\"ForeignGateway\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"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/bridge/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\"},\"src/bridge/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 \\\"../../bridge/interfaces/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\":\"0x0c4a83b87e4810d2e9798a3df3876d0708171c25757c9a2e04c0b3360c9a0d3a\",\"license\":\"MIT\"},\"src/gateway/ForeignGateway.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 \\\"./interfaces/IForeignGateway.sol\\\";\\n\\n/**\\n * Foreign Gateway\\n * Counterpart of `HomeGateway`\\n */\\ncontract ForeignGateway is IForeignGateway {\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct DisputeData {\\n uint248 id;\\n bool ruled;\\n address arbitrable;\\n uint256 paid;\\n address relayer;\\n }\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event OutgoingDispute(\\n bytes32 disputeHash,\\n bytes32 blockhash,\\n uint256 localDisputeID,\\n uint256 _choices,\\n bytes _extraData,\\n address arbitrable\\n );\\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 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 uint256[] internal feeForJuror; // feeForJuror[subcourtID]\\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 uint256[] memory _feeForJuror,\\n address _senderGateway,\\n uint256 _senderChainID\\n ) {\\n governor = _governor;\\n fastBridgeReceiver = _fastBridgeReceiver;\\n feeForJuror = _feeForJuror;\\n senderGateway = _senderGateway;\\n senderChainID = _senderChainID;\\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 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 feeForJuror[_subcourtID] = _feeForJuror;\\n }\\n\\n /**\\n * @dev Creates the `feeForJuror` property value for a new subcourt.\\n * @param _feeForJuror The new value for the `feeForJuror` property value.\\n */\\n function createSubcourtJurorFee(uint256 _feeForJuror) external onlyByGovernor {\\n feeForJuror.push(_feeForJuror);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n function createDispute(uint256 _choices, bytes calldata _extraData)\\n external\\n payable\\n override\\n returns (uint256 disputeID)\\n {\\n require(msg.value >= arbitrationCost(_extraData), \\\"Not paid enough for arbitration\\\");\\n\\n disputeID = localDisputeID++;\\n uint256 chainID;\\n assembly {\\n chainID := chainid()\\n }\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n 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: msg.value,\\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 subcourtID, uint256 minJurors) = extraDataToSubcourtIDMinJurors(_extraData);\\n\\n cost = feeForJuror[subcourtID] * 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 payable(dispute.relayer).transfer(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 extraDataToSubcourtIDMinJurors(bytes memory _extraData)\\n internal\\n view\\n returns (uint96 subcourtID, uint256 minJurors)\\n {\\n // Note that here we ignore DisputeKitID\\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 >= feeForJuror.length) subcourtID = 0;\\n if (minJurors == 0) minJurors = MIN_JURORS;\\n } else {\\n subcourtID = 0;\\n minJurors = MIN_JURORS;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x68b4733e355a497e0f7eee6f4fb82dd8debefc6e8d0fb18ad25466993d5bd076\",\"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 \\\"../../bridge/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(\\n address _messageSender,\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _forwarder\\n ) 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\",\"keccak256\":\"0xef24b9fbfb1afcb5cd8ac01541dab1142c34e87e723f0d3355bf80d163136b38\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405260016000553480156200001657600080fd5b506040516200115838038062001158833981016040819052620000399162000142565b600280546001600160a01b038088166001600160a01b031992831617909255600380549287169290911691909117905582516200007e9060019060208601906200009a565b506001600160a01b0390911660a0526080525062000256915050565b828054828255906000526020600020908101928215620000d8579160200282015b82811115620000d8578251825591602001919060010190620000bb565b50620000e6929150620000ea565b5090565b5b80821115620000e65760008155600101620000eb565b6001600160a01b03811681146200011757600080fd5b50565b8051620001278162000101565b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a086880312156200015b57600080fd5b8551620001688162000101565b809550506020808701516200017d8162000101565b60408801519095506001600160401b03808211156200019b57600080fd5b818901915089601f830112620001b057600080fd5b815181811115620001c557620001c56200012c565b8060051b604051601f19603f83011681018181108582111715620001ed57620001ed6200012c565b60405291825284820192508381018501918c8311156200020c57600080fd5b938501935b828510156200022c5784518452938501939285019262000211565b80985050505050505062000243606087016200011a565b9150608086015190509295509295909350565b60805160a051610ed5620002836000396000818161026a0152610592015260006101ad0152610ed56000f3fe6080604052600436106100f35760003560e01c8063c13517e11161008a578063eaff425a11610059578063eaff425a1461034e578063ebb7119414610363578063f7434ea914610383578063f7f56752146103a357600080fd5b8063c13517e114610245578063ce0aaf9514610258578063d3c617ff1461028c578063d96a36ca1461032e57600080fd5b806359354c77116100c657806359354c77146101cf5780639ff66f64146101ef578063a60a4db514610205578063ab6f672e1461022557600080fd5b80630c340a24146100f85780632d5db96d146101355780632e1db890146101575780634def54551461019b575b600080fd5b34801561010457600080fd5b50600254610118906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014157600080fd5b50610155610150366004610b61565b6103c3565b005b34801561016357600080fd5b5061018d610172366004610b8d565b6000908152600660205260409020546001600160f81b031690565b60405190815260200161012c565b3480156101a757600080fd5b5061018d7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101db57600080fd5b506101556101ea366004610ba6565b6104b0565b3480156101fb57600080fd5b5061018d60055481565b34801561021157600080fd5b50610155610220366004610bd0565b610507565b34801561023157600080fd5b50610155610240366004610b8d565b61075c565b61018d610253366004610c63565b6107ba565b34801561026457600080fd5b506101187f000000000000000000000000000000000000000000000000000000000000000081565b34801561029857600080fd5b506102f06102a7366004610b8d565b60066020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a00161012c565b34801561033a57600080fd5b50600354610118906001600160a01b031681565b34801561035a57600080fd5b5061018d600381565b34801561036f57600080fd5b5061015561037e366004610b8d565b610988565b34801561038f57600080fd5b5061018d61039e366004610caf565b610a7d565b3480156103af57600080fd5b50600454610118906001600160a01b031681565b6002546001600160a01b031633146103f65760405162461bcd60e51b81526004016103ed90610cf1565b60405180910390fd5b80826001600160a01b031663b5b7a1846040518163ffffffff1660e01b815260040160206040518083038186803b15801561043057600080fd5b505afa158015610444573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104689190610d33565b6104729042610d62565b61047c9190610d62565b6005555060038054600480546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b031633146104da5760405162461bcd60e51b81526004016103ed90610cf1565b806001836001600160601b0316815481106104f7576104f7610d7a565b6000918252602090912001555050565b6003546001600160a01b031633148061053657506005544210801561053657506004546001600160a01b031633145b6105905760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2046617374204272696467652060448201526437b7363c9760d91b60648201526084016103ed565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146106115760405162461bcd60e51b815260206004820181905260248201527f4f6e6c792074686520686f6d656761746577617920697320616c6c6f7765642e60448201526064016103ed565b600083815260066020526040902080546001600160f81b031661066f5760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b60448201526064016103ed565b8054600160f81b900460ff16156106bc5760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b60448201526064016103ed565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038581166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018690521690819063311a6c5690604401600060405180830381600087803b15801561073c57600080fd5b505af1158015610750573d6000803e3d6000fd5b50505050505050505050565b6002546001600160a01b031633146107865760405162461bcd60e51b81526004016103ed90610cf1565b6001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60155565b60006107c68383610a7d565b3410156108155760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e0060448201526064016103ed565b60008054908061082483610d90565b90915550905046600081610839600143610dab565b4084888888336040516020016108559796959493929190610dc2565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b038088168552600085840181815233878701908152346060890190815260808901848152868552600690975296909220965190511515600160f81b02921691909117855551600185810180546001600160a01b039384166001600160a01b031991821617909155945160028701559251600390950180549590911694909316939093179091559091507f0d14de2c628befa6eb7dc5c0b952832c96822914f589200f72acb5d8869982469082906109319043610dab565b40858989893360405161094a9796959493929190610e22565b60405180910390a1604051339084907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350509392505050565b600081815260066020526040902080546001600160f81b03166109e65760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b60448201526064016103ed565b8054600160f81b900460ff16610a2e5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b60448201526064016103ed565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f19350505050158015610a77573d6000803e3d6000fd5b50505050565b6000806000610ac185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b0092505050565b91509150806001836001600160601b031681548110610ae257610ae2610d7a565b9060005260206000200154610af79190610e80565b95945050505050565b6000806040835110610b3d575050602081015160408201516001546001600160601b03831610610b2f57600091505b80610b38575060035b915091565b50600090506003915091565b6001600160a01b0381168114610b5e57600080fd5b50565b60008060408385031215610b7457600080fd5b8235610b7f81610b49565b946020939093013593505050565b600060208284031215610b9f57600080fd5b5035919050565b60008060408385031215610bb957600080fd5b82356001600160601b0381168114610b7f57600080fd5b60008060008060808587031215610be657600080fd5b8435610bf181610b49565b935060208501359250604085013591506060850135610c0f81610b49565b939692955090935050565b60008083601f840112610c2c57600080fd5b50813567ffffffffffffffff811115610c4457600080fd5b602083019150836020828501011115610c5c57600080fd5b9250929050565b600080600060408486031215610c7857600080fd5b83359250602084013567ffffffffffffffff811115610c9657600080fd5b610ca286828701610c1a565b9497909650939450505050565b60008060208385031215610cc257600080fd5b823567ffffffffffffffff811115610cd957600080fd5b610ce585828601610c1a565b90969095509350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600060208284031215610d4557600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610d7557610d75610d4c565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610da457610da4610d4c565b5060010190565b600082821015610dbd57610dbd610d4c565b500390565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b87815286602082015285604082015284606082015260c060808201528260c0820152828460e0830137600081840160e0908101919091526001600160a01b039290921660a0820152601f909201601f19169091010195945050505050565b6000816000190483118215151615610e9a57610e9a610d4c565b50029056fea264697066735822122009b3af15685a53211f786283eab12089a5aef4d10948fde906e1a9ca6c4069a564736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100f35760003560e01c8063c13517e11161008a578063eaff425a11610059578063eaff425a1461034e578063ebb7119414610363578063f7434ea914610383578063f7f56752146103a357600080fd5b8063c13517e114610245578063ce0aaf9514610258578063d3c617ff1461028c578063d96a36ca1461032e57600080fd5b806359354c77116100c657806359354c77146101cf5780639ff66f64146101ef578063a60a4db514610205578063ab6f672e1461022557600080fd5b80630c340a24146100f85780632d5db96d146101355780632e1db890146101575780634def54551461019b575b600080fd5b34801561010457600080fd5b50600254610118906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014157600080fd5b50610155610150366004610b61565b6103c3565b005b34801561016357600080fd5b5061018d610172366004610b8d565b6000908152600660205260409020546001600160f81b031690565b60405190815260200161012c565b3480156101a757600080fd5b5061018d7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101db57600080fd5b506101556101ea366004610ba6565b6104b0565b3480156101fb57600080fd5b5061018d60055481565b34801561021157600080fd5b50610155610220366004610bd0565b610507565b34801561023157600080fd5b50610155610240366004610b8d565b61075c565b61018d610253366004610c63565b6107ba565b34801561026457600080fd5b506101187f000000000000000000000000000000000000000000000000000000000000000081565b34801561029857600080fd5b506102f06102a7366004610b8d565b60066020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a00161012c565b34801561033a57600080fd5b50600354610118906001600160a01b031681565b34801561035a57600080fd5b5061018d600381565b34801561036f57600080fd5b5061015561037e366004610b8d565b610988565b34801561038f57600080fd5b5061018d61039e366004610caf565b610a7d565b3480156103af57600080fd5b50600454610118906001600160a01b031681565b6002546001600160a01b031633146103f65760405162461bcd60e51b81526004016103ed90610cf1565b60405180910390fd5b80826001600160a01b031663b5b7a1846040518163ffffffff1660e01b815260040160206040518083038186803b15801561043057600080fd5b505afa158015610444573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104689190610d33565b6104729042610d62565b61047c9190610d62565b6005555060038054600480546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b031633146104da5760405162461bcd60e51b81526004016103ed90610cf1565b806001836001600160601b0316815481106104f7576104f7610d7a565b6000918252602090912001555050565b6003546001600160a01b031633148061053657506005544210801561053657506004546001600160a01b031633145b6105905760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2046617374204272696467652060448201526437b7363c9760d91b60648201526084016103ed565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146106115760405162461bcd60e51b815260206004820181905260248201527f4f6e6c792074686520686f6d656761746577617920697320616c6c6f7765642e60448201526064016103ed565b600083815260066020526040902080546001600160f81b031661066f5760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b60448201526064016103ed565b8054600160f81b900460ff16156106bc5760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b60448201526064016103ed565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038581166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018690521690819063311a6c5690604401600060405180830381600087803b15801561073c57600080fd5b505af1158015610750573d6000803e3d6000fd5b50505050505050505050565b6002546001600160a01b031633146107865760405162461bcd60e51b81526004016103ed90610cf1565b6001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60155565b60006107c68383610a7d565b3410156108155760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e0060448201526064016103ed565b60008054908061082483610d90565b90915550905046600081610839600143610dab565b4084888888336040516020016108559796959493929190610dc2565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b038088168552600085840181815233878701908152346060890190815260808901848152868552600690975296909220965190511515600160f81b02921691909117855551600185810180546001600160a01b039384166001600160a01b031991821617909155945160028701559251600390950180549590911694909316939093179091559091507f0d14de2c628befa6eb7dc5c0b952832c96822914f589200f72acb5d8869982469082906109319043610dab565b40858989893360405161094a9796959493929190610e22565b60405180910390a1604051339084907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350509392505050565b600081815260066020526040902080546001600160f81b03166109e65760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b60448201526064016103ed565b8054600160f81b900460ff16610a2e5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b60448201526064016103ed565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f19350505050158015610a77573d6000803e3d6000fd5b50505050565b6000806000610ac185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b0092505050565b91509150806001836001600160601b031681548110610ae257610ae2610d7a565b9060005260206000200154610af79190610e80565b95945050505050565b6000806040835110610b3d575050602081015160408201516001546001600160601b03831610610b2f57600091505b80610b38575060035b915091565b50600090506003915091565b6001600160a01b0381168114610b5e57600080fd5b50565b60008060408385031215610b7457600080fd5b8235610b7f81610b49565b946020939093013593505050565b600060208284031215610b9f57600080fd5b5035919050565b60008060408385031215610bb957600080fd5b82356001600160601b0381168114610b7f57600080fd5b60008060008060808587031215610be657600080fd5b8435610bf181610b49565b935060208501359250604085013591506060850135610c0f81610b49565b939692955090935050565b60008083601f840112610c2c57600080fd5b50813567ffffffffffffffff811115610c4457600080fd5b602083019150836020828501011115610c5c57600080fd5b9250929050565b600080600060408486031215610c7857600080fd5b83359250602084013567ffffffffffffffff811115610c9657600080fd5b610ca286828701610c1a565b9497909650939450505050565b60008060208385031215610cc257600080fd5b823567ffffffffffffffff811115610cd957600080fd5b610ce585828601610c1a565b90969095509350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600060208284031215610d4557600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610d7557610d75610d4c565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610da457610da4610d4c565b5060010190565b600082821015610dbd57610dbd610d4c565b500390565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b87815286602082015285604082015284606082015260c060808201528260c0820152828460e0830137600081840160e0908101919091526001600160a01b039290921660a0820152601f909201601f19169091010195945050505050565b6000816000190483118215151615610e9a57610e9a610d4c565b50029056fea264697066735822122009b3af15685a53211f786283eab12089a5aef4d10948fde906e1a9ca6c4069a564736f6c63430008090033", + "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." + } + }, + "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)." + } + }, + "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." + } + }, + "createDispute(uint256,bytes)": { + "details": "Create a dispute. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", + "params": { + "_choices": "Amount of choices the arbitrator can make in this dispute.", + "_extraData": "Can be used to give additional info on the dispute to be created." + }, + "returns": { + "disputeID": "ID of the dispute created." + } + }, + "createSubcourtJurorFee(uint256)": { + "details": "Creates the `feeForJuror` property value for a new subcourt.", + "params": { + "_feeForJuror": "The new value for the `feeForJuror` property value." + } + } + }, + "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": 21762, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "localDisputeID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 21765, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "feeForJuror", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 21767, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "governor", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 21770, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "fastBridgeReceiver", + "offset": 0, + "slot": "3", + "type": "t_contract(IFastBridgeReceiver)16758" + }, + { + "astId": 21773, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "depreciatedFastbridge", + "offset": 0, + "slot": "4", + "type": "t_contract(IFastBridgeReceiver)16758" + }, + { + "astId": 21775, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "depreciatedFastBridgeExpiration", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 21780, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "disputeHashtoDisputeData", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_struct(DisputeData)21736_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IFastBridgeReceiver)16758": { + "encoding": "inplace", + "label": "contract IFastBridgeReceiver", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_struct(DisputeData)21736_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct ForeignGateway.DisputeData)", + "numberOfBytes": "32", + "value": "t_struct(DisputeData)21736_storage" + }, + "t_struct(DisputeData)21736_storage": { + "encoding": "inplace", + "label": "struct ForeignGateway.DisputeData", + "members": [ + { + "astId": 21727, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "id", + "offset": 0, + "slot": "0", + "type": "t_uint248" + }, + { + "astId": 21729, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "ruled", + "offset": 31, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 21731, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "arbitrable", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 21733, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "paid", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 21735, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "relayer", + "offset": 0, + "slot": "3", + "type": "t_address" + } + ], + "numberOfBytes": "128" + }, + "t_uint248": { + "encoding": "inplace", + "label": "uint248", + "numberOfBytes": "31" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/deployments/rinkeby/ArbitrableExample.json b/contracts/deployments/rinkeby/ArbitrableExample.json index eed7c7fcb..ae9f2fbe1 100644 --- a/contracts/deployments/rinkeby/ArbitrableExample.json +++ b/contracts/deployments/rinkeby/ArbitrableExample.json @@ -1,5 +1,5 @@ { - "address": "0xf2a59723c5d625D646668E0B615B5764c3F81540", + "address": "0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b", "abi": [ { "inputs": [ @@ -232,45 +232,45 @@ "type": "function" } ], - "transactionHash": "0x406582131f309fb50052581bc73096da106295ee90ecc87de51e5e8d7d89d08d", + "transactionHash": "0x98a4d714037f858a2cda8a431d7964605de79832c8f7dc459df09464876cbaaa", "receipt": { "to": null, "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xf2a59723c5d625D646668E0B615B5764c3F81540", - "transactionIndex": 17, - "gasUsed": "436046", - "logsBloom": "0x00000000000000000000000000010000000000200000000000000004000000000000000000000008000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xa268edbb4988b83fb267b8c94aa089bde23da30f079397fa7666e6ea7877fce8", - "transactionHash": "0x406582131f309fb50052581bc73096da106295ee90ecc87de51e5e8d7d89d08d", + "contractAddress": "0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b", + "transactionIndex": 9, + "gasUsed": "439280", + "logsBloom": "0x00000000002000000000000000000000000000000000000001000004000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000800000000000000000000000000000000000000000000020000000000000000000800000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd220d2856c8917c1408b5bd3fb0992f6801b74d9e2770bbe04103129f5b04808", + "transactionHash": "0x98a4d714037f858a2cda8a431d7964605de79832c8f7dc459df09464876cbaaa", "logs": [ { - "transactionIndex": 17, - "blockNumber": 10190113, - "transactionHash": "0x406582131f309fb50052581bc73096da106295ee90ecc87de51e5e8d7d89d08d", - "address": "0xf2a59723c5d625D646668E0B615B5764c3F81540", + "transactionIndex": 9, + "blockNumber": 11233404, + "transactionHash": "0x98a4d714037f858a2cda8a431d7964605de79832c8f7dc459df09464876cbaaa", + "address": "0xc0fcc96BFd78e36550FCaB434A9EE1210B57225b", "topics": [ "0x61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d", "0x0000000000000000000000000000000000000000000000000000000000000000" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000007b68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f6b6c65726f732f6b6c65726f732d76322f6d61737465722f636f6e7472616374732f6465706c6f796d656e74732f72696e6b6562792f4d65746145766964656e63655f41726269747261626c654578616d706c652e6a736f6e0000000000", - "logIndex": 22, - "blockHash": "0xa268edbb4988b83fb267b8c94aa089bde23da30f079397fa7666e6ea7877fce8" + "logIndex": 34, + "blockHash": "0xd220d2856c8917c1408b5bd3fb0992f6801b74d9e2770bbe04103129f5b04808" } ], - "blockNumber": 10190113, - "cumulativeGasUsed": "8543318", + "blockNumber": 11233404, + "cumulativeGasUsed": "1583166", "status": 1, "byzantium": true }, "args": [ - "0xf02733d9e5CbfE67B54F165b0277E1995106D526", + "0x8681CE0CA5706Cf4732d9060e8eC9f865F7d546a", "https://raw.githubusercontent.com/kleros/kleros-v2/master/contracts/deployments/rinkeby/MetaEvidence_ArbitrableExample.json" ], - "numDeployments": 3, - "solcInputHash": "0a1ec2a631b00a23a4a92b2eaceb36a5", - "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_metaEvidence\",\"type\":\"string\"}],\"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\":\"uint256\",\"name\":\"_numberOfRulingOptions\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"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\":[{\"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\":\"The arbitrator to rule on created disputes.\",\"_metaEvidence\":\"The URI of the meta evidence object for evidence submissions requests.\"}},\"createDispute(uint256,bytes,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.\",\"_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/ArbitrableExample.sol\":\"ArbitrableExample\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/arbitration/ArbitrableExample.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\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 uint256 constant META_EVIDENCE_ID = 0;\\n\\n IArbitrator public immutable arbitrator; // Arbitrator is set in constructor and never changed.\\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 _metaEvidence The URI of the meta evidence object for evidence submissions requests.\\n */\\n constructor(IArbitrator _arbitrator, string memory _metaEvidence) {\\n arbitrator = _arbitrator;\\n\\n emit MetaEvidence(META_EVIDENCE_ID, _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 _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.\\n * @return disputeID Dispute id (on arbitrator side) of the dispute created.\\n */\\n function createDispute(uint256 _numberOfRulingOptions, bytes calldata _arbitratorExtraData, uint256 _evidenceGroupID)\\n external\\n payable\\n returns (uint256 disputeID)\\n {\\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 disputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData);\\n\\n externalIDtoLocalID[disputeID] = localDisputeID;\\n\\n emit Dispute(arbitrator, disputeID, META_EVIDENCE_ID, _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\",\"keccak256\":\"0x9143e8d6540935e1dd73d36b145440b3fb29d5e4b2afa43ecf3faa3c9ecd9e5f\",\"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/evidence/IEvidence.sol\":{\"content\":\"pragma 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\":\"0xbd6a3d07e2e192f521340f62965aae59e0ece36cf4ae6918d461725e6a51b70c\"},\"src/evidence/IMetaEvidence.sol\":{\"content\":\"pragma 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\":\"0x18ad77e96ca1592f7833c4d3a93a8a7de55bff137d357d66040f99ac13bf1f88\"}},\"version\":1}", - "bytecode": "0x60a060405234801561001057600080fd5b506040516108a73803806108a783398101604081905261002f916100c4565b6001600160a01b0382166080526040516000907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d9061006f908490610192565b60405180910390a250506101c5565b634e487b7160e01b600052604160045260246000fd5b60005b838110156100af578181015183820152602001610097565b838111156100be576000848401525b50505050565b600080604083850312156100d757600080fd5b82516001600160a01b03811681146100ee57600080fd5b60208401519092506001600160401b038082111561010b57600080fd5b818501915085601f83011261011f57600080fd5b8151818111156101315761013161007e565b604051601f8201601f19908116603f011681019083821181831017156101595761015961007e565b8160405282815288602084870101111561017257600080fd5b610183836020830160208801610094565b80955050505050509250929050565b60208152600082518060208401526101b1816040850160208701610094565b601f01601f19169190910160400192915050565b6080516106b36101f46000396000818160e6015281816101850152818161045401526104fe01526106b36000f3fe60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636137048c146100b35780636cc6cde1146100d4578063c21ae06114610120575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461055b565b61014d565b005b34801561007d57600080fd5b5061009161008c36600461057d565b61030a565b6040805193151584526020840192909252908201526060015b60405180910390f35b6100c66100c1366004610596565b610341565b6040519081526020016100aa565b3480156100e057600080fd5b506101087f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100aa565b34801561012c57600080fd5b506100c661013b36600461057d565b60006020819052908152604090205481565b600082815260208190526040812054600180549192918390811061017357610173610618565b906000526020600020906003020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b0316146102175760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b806002015483111561025d5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b604482015260640161020e565b805460ff16156102bb5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b606482015260840161020e565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6001818154811061031a57600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b6000600185116103935760405162461bcd60e51b815260206004820152601b60248201527f496e636f7272656374206e756d626572206f662063686f696365730000000000604482015260640161020e565b60018054604080516060810182526000808252602082018181528284018b815285870187559590915290517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf660038502908101805460ff19169215159290921790915590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf782015592517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf890930192909255905163c13517e160e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c13517e1903490610497908a908a908a9060040161062e565b60206040518083038185885af11580156104b5573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104da9190610664565b600081815260208181526040808320859055805192835290820186905291935083917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350949350505050565b6000806040838503121561056e57600080fd5b50508035926020909101359150565b60006020828403121561058f57600080fd5b5035919050565b600080600080606085870312156105ac57600080fd5b84359350602085013567ffffffffffffffff808211156105cb57600080fd5b818701915087601f8301126105df57600080fd5b8135818111156105ee57600080fd5b88602082850101111561060057600080fd5b95986020929092019750949560400135945092505050565b634e487b7160e01b600052603260045260246000fd5b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b60006020828403121561067657600080fd5b505191905056fea264697066735822122050c354a55dfdcbdc85fe9f5328450b0f078566ba2a66414be12209ccb90f11b464736f6c634300080a0033", - "deployedBytecode": "0x60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636137048c146100b35780636cc6cde1146100d4578063c21ae06114610120575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461055b565b61014d565b005b34801561007d57600080fd5b5061009161008c36600461057d565b61030a565b6040805193151584526020840192909252908201526060015b60405180910390f35b6100c66100c1366004610596565b610341565b6040519081526020016100aa565b3480156100e057600080fd5b506101087f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100aa565b34801561012c57600080fd5b506100c661013b36600461057d565b60006020819052908152604090205481565b600082815260208190526040812054600180549192918390811061017357610173610618565b906000526020600020906003020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b0316146102175760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b806002015483111561025d5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b604482015260640161020e565b805460ff16156102bb5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b606482015260840161020e565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6001818154811061031a57600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b6000600185116103935760405162461bcd60e51b815260206004820152601b60248201527f496e636f7272656374206e756d626572206f662063686f696365730000000000604482015260640161020e565b60018054604080516060810182526000808252602082018181528284018b815285870187559590915290517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf660038502908101805460ff19169215159290921790915590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf782015592517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf890930192909255905163c13517e160e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c13517e1903490610497908a908a908a9060040161062e565b60206040518083038185885af11580156104b5573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104da9190610664565b600081815260208181526040808320859055805192835290820186905291935083917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350949350505050565b6000806040838503121561056e57600080fd5b50508035926020909101359150565b60006020828403121561058f57600080fd5b5035919050565b600080600080606085870312156105ac57600080fd5b84359350602085013567ffffffffffffffff808211156105cb57600080fd5b818701915087601f8301126105df57600080fd5b8135818111156105ee57600080fd5b88602082850101111561060057600080fd5b95986020929092019750949560400135945092505050565b634e487b7160e01b600052603260045260246000fd5b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b60006020828403121561067657600080fd5b505191905056fea264697066735822122050c354a55dfdcbdc85fe9f5328450b0f078566ba2a66414be12209ccb90f11b464736f6c634300080a0033", + "numDeployments": 4, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IArbitrator\",\"name\":\"_arbitrator\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"_metaEvidence\",\"type\":\"string\"}],\"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\":\"uint256\",\"name\":\"_numberOfRulingOptions\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_arbitratorExtraData\",\"type\":\"bytes\"},{\"internalType\":\"uint256\",\"name\":\"_evidenceGroupID\",\"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\":[{\"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\":\"The arbitrator to rule on created disputes.\",\"_metaEvidence\":\"The URI of the meta evidence object for evidence submissions requests.\"}},\"createDispute(uint256,bytes,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.\",\"_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\":200},\"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/ArbitrableExample.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8;\\n\\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 uint256 constant META_EVIDENCE_ID = 0;\\n\\n IArbitrator public immutable arbitrator; // Arbitrator is set in constructor and never changed.\\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 _metaEvidence The URI of the meta evidence object for evidence submissions requests.\\n */\\n constructor(IArbitrator _arbitrator, string memory _metaEvidence) {\\n arbitrator = _arbitrator;\\n\\n emit MetaEvidence(META_EVIDENCE_ID, _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 _evidenceGroupID Unique identifier of the evidence group that is linked to this dispute.\\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 _evidenceGroupID\\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 disputeID = arbitrator.createDispute{value: msg.value}(_numberOfRulingOptions, _arbitratorExtraData);\\n\\n externalIDtoLocalID[disputeID] = localDisputeID;\\n\\n emit Dispute(arbitrator, disputeID, META_EVIDENCE_ID, _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\",\"keccak256\":\"0x320f8cc4a8331891c01b6f844422de6a82164d9f45d283e309e7633183ecfd99\",\"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": "0x60a060405234801561001057600080fd5b506040516108b63803806108b683398101604081905261002f916100c4565b6001600160a01b0382166080526040516000907f61606860eb6c87306811e2695215385101daab53bd6ab4e9f9049aead9363c7d9061006f908490610192565b60405180910390a250506101c5565b634e487b7160e01b600052604160045260246000fd5b60005b838110156100af578181015183820152602001610097565b838111156100be576000848401525b50505050565b600080604083850312156100d757600080fd5b82516001600160a01b03811681146100ee57600080fd5b60208401519092506001600160401b038082111561010b57600080fd5b818501915085601f83011261011f57600080fd5b8151818111156101315761013161007e565b604051601f8201601f19908116603f011681019083821181831017156101595761015961007e565b8160405282815288602084870101111561017257600080fd5b610183836020830160208801610094565b80955050505050509250929050565b60208152600082518060208401526101b1816040850160208701610094565b601f01601f19169190910160400192915050565b6080516106c26101f46000396000818160e60152818161018501528181610454015261050d01526106c26000f3fe60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636137048c146100b35780636cc6cde1146100d4578063c21ae06114610120575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461056a565b61014d565b005b34801561007d57600080fd5b5061009161008c36600461058c565b61030a565b6040805193151584526020840192909252908201526060015b60405180910390f35b6100c66100c13660046105a5565b610341565b6040519081526020016100aa565b3480156100e057600080fd5b506101087f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100aa565b34801561012c57600080fd5b506100c661013b36600461058c565b60006020819052908152604090205481565b600082815260208190526040812054600180549192918390811061017357610173610627565b906000526020600020906003020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b0316146102175760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b806002015483111561025d5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b604482015260640161020e565b805460ff16156102bb5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b606482015260840161020e565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6001818154811061031a57600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b6000600185116103935760405162461bcd60e51b815260206004820152601b60248201527f496e636f7272656374206e756d626572206f662063686f696365730000000000604482015260640161020e565b60018054604080516060810182526000808252602082018181528284018b815285870187559590915290517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf660038502908101805460ff19169215159290921790915590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf782015592517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf890930192909255905163c13517e160e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c13517e1903490610497908a908a908a9060040161063d565b6020604051808303818588803b1580156104b057600080fd5b505af11580156104c4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104e99190610673565b600081815260208181526040808320859055805192835290820186905291935083917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350949350505050565b6000806040838503121561057d57600080fd5b50508035926020909101359150565b60006020828403121561059e57600080fd5b5035919050565b600080600080606085870312156105bb57600080fd5b84359350602085013567ffffffffffffffff808211156105da57600080fd5b818701915087601f8301126105ee57600080fd5b8135818111156105fd57600080fd5b88602082850101111561060f57600080fd5b95986020929092019750949560400135945092505050565b634e487b7160e01b600052603260045260246000fd5b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b60006020828403121561068557600080fd5b505191905056fea2646970667358221220009cf64d82ef5b990193ecc07de054a16c92c1096aa712e760d7826d67cfd99364736f6c63430008090033", + "deployedBytecode": "0x60806040526004361061004a5760003560e01c8063311a6c561461004f578063564a565d146100715780636137048c146100b35780636cc6cde1146100d4578063c21ae06114610120575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461056a565b61014d565b005b34801561007d57600080fd5b5061009161008c36600461058c565b61030a565b6040805193151584526020840192909252908201526060015b60405180910390f35b6100c66100c13660046105a5565b610341565b6040519081526020016100aa565b3480156100e057600080fd5b506101087f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100aa565b34801561012c57600080fd5b506100c661013b36600461058c565b60006020819052908152604090205481565b600082815260208190526040812054600180549192918390811061017357610173610627565b906000526020600020906003020190507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316336001600160a01b0316146102175760405162461bcd60e51b815260206004820152602560248201527f4f6e6c79207468652061726269747261746f722063616e2065786563757465206044820152643a3434b99760d91b60648201526084015b60405180910390fd5b806002015483111561025d5760405162461bcd60e51b815260206004820152600f60248201526e24b73b30b634b210393ab634b7339760891b604482015260640161020e565b805460ff16156102bb5760405162461bcd60e51b8152602060048201526024808201527f54686973206469737075746520686173206265656e2072756c656420616c726560448201526330b23c9760e11b606482015260840161020e565b805460ff1916600190811782558101839055604051838152849033907f394027a5fa6e098a1191094d1719d6929b9abc535fcc0c8f448d6a4e756222769060200160405180910390a350505050565b6001818154811061031a57600080fd5b600091825260209091206003909102018054600182015460029092015460ff909116925083565b6000600185116103935760405162461bcd60e51b815260206004820152601b60248201527f496e636f7272656374206e756d626572206f662063686f696365730000000000604482015260640161020e565b60018054604080516060810182526000808252602082018181528284018b815285870187559590915290517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf660038502908101805460ff19169215159290921790915590517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf782015592517fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf890930192909255905163c13517e160e01b81527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c13517e1903490610497908a908a908a9060040161063d565b6020604051808303818588803b1580156104b057600080fd5b505af11580156104c4573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906104e99190610673565b600081815260208181526040808320859055805192835290820186905291935083917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316917f74baab670a4015ab2f1b467c5252a96141a2573f2908e58a92081e80d3cfde3d910160405180910390a350949350505050565b6000806040838503121561057d57600080fd5b50508035926020909101359150565b60006020828403121561059e57600080fd5b5035919050565b600080600080606085870312156105bb57600080fd5b84359350602085013567ffffffffffffffff808211156105da57600080fd5b818701915087601f8301126105ee57600080fd5b8135818111156105fd57600080fd5b88602082850101111561060f57600080fd5b95986020929092019750949560400135945092505050565b634e487b7160e01b600052603260045260246000fd5b83815260406020820152816040820152818360608301376000818301606090810191909152601f909201601f1916010192915050565b60006020828403121561068557600080fd5b505191905056fea2646970667358221220009cf64d82ef5b990193ecc07de054a16c92c1096aa712e760d7826d67cfd99364736f6c63430008090033", "devdoc": { "kind": "dev", "methods": { @@ -311,25 +311,25 @@ "storageLayout": { "storage": [ { - "astId": 696, - "contract": "src/arbitration/ArbitrableExample.sol:ArbitrableExample", + "astId": 5859, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "externalIDtoLocalID", "offset": 0, "slot": "0", "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 700, - "contract": "src/arbitration/ArbitrableExample.sol:ArbitrableExample", + "astId": 5863, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "disputes", "offset": 0, "slot": "1", - "type": "t_array(t_struct(DisputeStruct)686_storage)dyn_storage" + "type": "t_array(t_struct(DisputeStruct)5849_storage)dyn_storage" } ], "types": { - "t_array(t_struct(DisputeStruct)686_storage)dyn_storage": { - "base": "t_struct(DisputeStruct)686_storage", + "t_array(t_struct(DisputeStruct)5849_storage)dyn_storage": { + "base": "t_struct(DisputeStruct)5849_storage", "encoding": "dynamic_array", "label": "struct ArbitrableExample.DisputeStruct[]", "numberOfBytes": "32" @@ -346,29 +346,29 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(DisputeStruct)686_storage": { + "t_struct(DisputeStruct)5849_storage": { "encoding": "inplace", "label": "struct ArbitrableExample.DisputeStruct", "members": [ { - "astId": 681, - "contract": "src/arbitration/ArbitrableExample.sol:ArbitrableExample", + "astId": 5844, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "isRuled", "offset": 0, "slot": "0", "type": "t_bool" }, { - "astId": 683, - "contract": "src/arbitration/ArbitrableExample.sol:ArbitrableExample", + "astId": 5846, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "ruling", "offset": 0, "slot": "1", "type": "t_uint256" }, { - "astId": 685, - "contract": "src/arbitration/ArbitrableExample.sol:ArbitrableExample", + "astId": 5848, + "contract": "src/arbitration/arbitrables/ArbitrableExample.sol:ArbitrableExample", "label": "numberOfRulingOptions", "offset": 0, "slot": "2", diff --git a/contracts/deployments/rinkeby/FastBridgeReceiver.json b/contracts/deployments/rinkeby/FastBridgeReceiver.json deleted file mode 100644 index 47b7bccf5..000000000 --- a/contracts/deployments/rinkeby/FastBridgeReceiver.json +++ /dev/null @@ -1,335 +0,0 @@ -{ - "address": "0xD78DCddE2C5a2Bd4BB246Bc7dB6994b95f7c442C", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_governor", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_claimDeposit", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_challengeDuration", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "messageHash", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "claimedAt", - "type": "uint256" - } - ], - "name": "ClaimReceived", - "type": "event" - }, - { - "inputs": [], - "name": "challenge", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "challengeDuration", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_messageHash", - "type": "bytes32" - } - ], - "name": "claim", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "claimDeposit", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "claims", - "outputs": [ - { - "internalType": "address", - "name": "bridger", - "type": "address" - }, - { - "internalType": "uint256", - "name": "claimedAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "claimDeposit", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "relayed", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "governor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_challengeDuration", - "type": "uint256" - } - ], - "name": "setChallengePeriodDuration", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_claimDeposit", - "type": "uint256" - } - ], - "name": "setClaimDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_messageHash", - "type": "bytes32" - }, - { - "internalType": "bytes", - "name": "_encodedData", - "type": "bytes" - } - ], - "name": "verifyAndRelay", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_messageHash", - "type": "bytes32" - } - ], - "name": "withdrawClaimDeposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x15b12d9a11d91679f1ec9360ba1e410a110114f34334ac362efcd36d5eb812ea", - "receipt": { - "to": null, - "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xD78DCddE2C5a2Bd4BB246Bc7dB6994b95f7c442C", - "transactionIndex": 5, - "gasUsed": "667272", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x070121f019f299b0e1b45539454cf8e31fc1fb4b0add90d2f9836a3f5562efb1", - "transactionHash": "0x15b12d9a11d91679f1ec9360ba1e410a110114f34334ac362efcd36d5eb812ea", - "logs": [], - "blockNumber": 10190111, - "cumulativeGasUsed": "1083833", - "status": 1, - "byzantium": true - }, - "args": [ - "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "100000000000000000", - 3600 - ], - "numDeployments": 1, - "solcInputHash": "0a1ec2a631b00a23a4a92b2eaceb36a5", - "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_claimDeposit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_challengeDuration\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"messageHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"claimedAt\",\"type\":\"uint256\"}],\"name\":\"ClaimReceived\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"challenge\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"challengeDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_messageHash\",\"type\":\"bytes32\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"claimDeposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"claims\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"bridger\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"claimedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"claimDeposit\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"relayed\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_challengeDuration\",\"type\":\"uint256\"}],\"name\":\"setChallengePeriodDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_claimDeposit\",\"type\":\"uint256\"}],\"name\":\"setClaimDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_messageHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes\",\"name\":\"_encodedData\",\"type\":\"bytes\"}],\"name\":\"verifyAndRelay\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_messageHash\",\"type\":\"bytes32\"}],\"name\":\"withdrawClaimDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/bridge/FastBridgeReceiver.sol\":\"FastBridgeReceiver\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/bridge/FastBridgeReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./interfaces/IFastBridgeReceiver.sol\\\";\\n\\ncontract FastBridgeReceiver is IFastBridgeReceiver {\\n address public governor;\\n uint256 public claimDeposit;\\n uint256 public challengeDuration;\\n\\n struct Claim {\\n address bridger;\\n uint256 claimedAt;\\n uint256 claimDeposit;\\n bool relayed;\\n }\\n\\n // messageHash => Claim\\n mapping(bytes32 => Claim) public claims;\\n\\n event ClaimReceived(bytes32 messageHash, uint256 claimedAt);\\n\\n modifier onlyByGovernor() {\\n require(governor == msg.sender, \\\"Access not allowed: Governor only.\\\");\\n _;\\n }\\n\\n constructor(\\n address _governor,\\n uint256 _claimDeposit,\\n uint256 _challengeDuration\\n ) {\\n governor = _governor;\\n claimDeposit = _claimDeposit;\\n challengeDuration = _challengeDuration;\\n }\\n\\n function claim(bytes32 _messageHash) external payable {\\n require(msg.value >= claimDeposit, \\\"Not enough claim deposit\\\");\\n require(claims[_messageHash].bridger == address(0), \\\"Claimed already made\\\");\\n\\n claims[_messageHash] = Claim({\\n bridger: msg.sender,\\n claimedAt: block.timestamp,\\n claimDeposit: msg.value,\\n relayed: false\\n });\\n\\n emit ClaimReceived(_messageHash, block.timestamp);\\n }\\n\\n function verifyAndRelay(bytes32 _messageHash, bytes memory _encodedData) external {\\n require(keccak256(_encodedData) == _messageHash, \\\"Invalid hash\\\");\\n\\n Claim storage claim = claims[_messageHash];\\n require(claim.bridger != address(0), \\\"Claim does not exist\\\");\\n require(claim.claimedAt + challengeDuration < block.timestamp, \\\"Challenge period not over\\\");\\n require(claim.relayed == false, \\\"Message already relayed\\\");\\n\\n // Decode the receiver address from the data encoded by the IFastBridgeSender\\n (address receiver, bytes memory data) = abi.decode(_encodedData, (address, bytes));\\n (bool success, ) = address(receiver).call(data);\\n require(success, \\\"Failed to call contract\\\");\\n\\n claim.relayed = true;\\n }\\n\\n function withdrawClaimDeposit(bytes32 _messageHash) external {\\n Claim storage claim = claims[_messageHash];\\n require(claim.bridger != address(0), \\\"Claim does not exist\\\");\\n require(claim.claimedAt + challengeDuration < block.timestamp, \\\"Challenge period not over\\\");\\n\\n uint256 amount = claim.claimDeposit;\\n claim.claimDeposit = 0;\\n payable(claim.bridger).send(amount);\\n }\\n\\n function challenge() external {\\n revert(\\\"Not Implemented\\\");\\n }\\n\\n //**** Governor functions ****//\\n\\n function setClaimDeposit(uint256 _claimDeposit) external onlyByGovernor {\\n claimDeposit = _claimDeposit;\\n }\\n\\n function setChallengePeriodDuration(uint256 _challengeDuration) external onlyByGovernor {\\n challengeDuration = _challengeDuration;\\n }\\n}\\n\",\"keccak256\":\"0xf84287907e7101b142dddf2fd1b0357eb9d289a8dd7affbe9b7163238088cfc7\",\"license\":\"MIT\"},\"src/bridge/interfaces/IFastBridgeReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IFastBridgeReceiver {\\n function claim(bytes32 _messageHash) external payable;\\n\\n function verifyAndRelay(bytes32 _messageHash, bytes memory _calldata) external;\\n\\n function withdrawClaimDeposit(bytes32 _messageHash) external;\\n\\n function claimDeposit() external view returns (uint256 amount);\\n}\\n\",\"keccak256\":\"0x1d7f6a6ed2c2b88f51833cba6091c57a43af2915a265395ad11aad08b1f7285d\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b50604051610a88380380610a8883398101604081905261002f9161005b565b600080546001600160a01b0319166001600160a01b03949094169390931790925560015560025561009e565b60008060006060848603121561007057600080fd5b83516001600160a01b038116811461008757600080fd5b602085015160409095015190969495509392505050565b6109db806100ad6000396000f3fe6080604052600436106100915760003560e01c8063bc43b86511610059578063bc43b8651461014f578063bd66528a1461016f578063d2ef739814610182578063ee32cceb14610197578063eff0f592146101b757600080fd5b80630c340a241461009657806323d631ac146100d3578063292f2e0e146100f557806329d07a51146101195780634458e6091461012f575b600080fd5b3480156100a257600080fd5b506000546100b6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100df57600080fd5b506100f36100ee366004610746565b610234565b005b34801561010157600080fd5b5061010b60025481565b6040519081526020016100ca565b34801561012557600080fd5b5061010b60015481565b34801561013b57600080fd5b506100f361014a366004610746565b61032b565b34801561015b57600080fd5b506100f361016a366004610746565b61035a565b6100f361017d366004610746565b610389565b34801561018e57600080fd5b506100f36104de565b3480156101a357600080fd5b506100f36101b23660046107ce565b610518565b3480156101c357600080fd5b506102086101d2366004610746565b600360208190526000918252604090912080546001820154600283015492909301546001600160a01b0390911692919060ff1684565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016100ca565b600081815260036020526040902080546001600160a01b03166102955760405162461bcd60e51b815260206004820152601460248201527310db185a5b48191bd95cc81b9bdd08195e1a5cdd60621b60448201526064015b60405180910390fd5b4260025482600101546102a89190610858565b106102f15760405162461bcd60e51b815260206004820152601960248201527821b430b63632b733b2903832b934b7b2103737ba1037bb32b960391b604482015260640161028c565b600281018054600091829055825460405191926001600160a01b039091169183156108fc0291849190818181858888f15050505050505050565b6000546001600160a01b031633146103555760405162461bcd60e51b815260040161028c9061087e565b600255565b6000546001600160a01b031633146103845760405162461bcd60e51b815260040161028c9061087e565b600155565b6001543410156103db5760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636c61696d206465706f7369740000000000000000604482015260640161028c565b6000818152600360205260409020546001600160a01b0316156104375760405162461bcd60e51b8152602060048201526014602482015273436c61696d656420616c7265616479206d61646560601b604482015260640161028c565b6040805160808101825233815242602080830182815234848601908152600060608601818152888252600380865291889020965187546001600160a01b0319166001600160a01b03909116178755925160018701559051600286015590519301805460ff1916931515939093179092558251848152918201527f32899d160dbf80374e3a2eacfc04011027c1542248d33c4cd7b80d61176c0463910160405180910390a150565b60405162461bcd60e51b815260206004820152600f60248201526e139bdd08125b5c1b195b595b9d1959608a1b604482015260640161028c565b80516020820120821461055c5760405162461bcd60e51b815260206004820152600c60248201526b092dcecc2d8d2c840d0c2e6d60a31b604482015260640161028c565b600082815260036020526040902080546001600160a01b03166105b85760405162461bcd60e51b815260206004820152601460248201527310db185a5b48191bd95cc81b9bdd08195e1a5cdd60621b604482015260640161028c565b4260025482600101546105cb9190610858565b106106145760405162461bcd60e51b815260206004820152601960248201527821b430b63632b733b2903832b934b7b2103737ba1037bb32b960391b604482015260640161028c565b600381015460ff16156106695760405162461bcd60e51b815260206004820152601760248201527f4d65737361676520616c72656164792072656c61796564000000000000000000604482015260640161028c565b6000808380602001905181019061068091906108f0565b915091506000826001600160a01b03168260405161069e9190610989565b6000604051808303816000865af19150503d80600081146106db576040519150601f19603f3d011682016040523d82523d6000602084013e6106e0565b606091505b50509050806107315760405162461bcd60e51b815260206004820152601760248201527f4661696c656420746f2063616c6c20636f6e7472616374000000000000000000604482015260640161028c565b505050600301805460ff191660011790555050565b60006020828403121561075857600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561079e5761079e61075f565b604052919050565b600067ffffffffffffffff8211156107c0576107c061075f565b50601f01601f191660200190565b600080604083850312156107e157600080fd5b82359150602083013567ffffffffffffffff8111156107ff57600080fd5b8301601f8101851361081057600080fd5b803561082361081e826107a6565b610775565b81815286602083850101111561083857600080fd5b816020840160208301376000602083830101528093505050509250929050565b6000821982111561087957634e487b7160e01b600052601160045260246000fd5b500190565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b60005b838110156108db5781810151838201526020016108c3565b838111156108ea576000848401525b50505050565b6000806040838503121561090357600080fd5b82516001600160a01b038116811461091a57600080fd5b602084015190925067ffffffffffffffff81111561093757600080fd5b8301601f8101851361094857600080fd5b805161095661081e826107a6565b81815286602083850101111561096b57600080fd5b61097c8260208301602086016108c0565b8093505050509250929050565b6000825161099b8184602087016108c0565b919091019291505056fea2646970667358221220b68116d29aea33bc3a2cc26b85b6677740b9b028cfa86a109ebbcb6b98615f7c64736f6c634300080a0033", - "deployedBytecode": "0x6080604052600436106100915760003560e01c8063bc43b86511610059578063bc43b8651461014f578063bd66528a1461016f578063d2ef739814610182578063ee32cceb14610197578063eff0f592146101b757600080fd5b80630c340a241461009657806323d631ac146100d3578063292f2e0e146100f557806329d07a51146101195780634458e6091461012f575b600080fd5b3480156100a257600080fd5b506000546100b6906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156100df57600080fd5b506100f36100ee366004610746565b610234565b005b34801561010157600080fd5b5061010b60025481565b6040519081526020016100ca565b34801561012557600080fd5b5061010b60015481565b34801561013b57600080fd5b506100f361014a366004610746565b61032b565b34801561015b57600080fd5b506100f361016a366004610746565b61035a565b6100f361017d366004610746565b610389565b34801561018e57600080fd5b506100f36104de565b3480156101a357600080fd5b506100f36101b23660046107ce565b610518565b3480156101c357600080fd5b506102086101d2366004610746565b600360208190526000918252604090912080546001820154600283015492909301546001600160a01b0390911692919060ff1684565b604080516001600160a01b039095168552602085019390935291830152151560608201526080016100ca565b600081815260036020526040902080546001600160a01b03166102955760405162461bcd60e51b815260206004820152601460248201527310db185a5b48191bd95cc81b9bdd08195e1a5cdd60621b60448201526064015b60405180910390fd5b4260025482600101546102a89190610858565b106102f15760405162461bcd60e51b815260206004820152601960248201527821b430b63632b733b2903832b934b7b2103737ba1037bb32b960391b604482015260640161028c565b600281018054600091829055825460405191926001600160a01b039091169183156108fc0291849190818181858888f15050505050505050565b6000546001600160a01b031633146103555760405162461bcd60e51b815260040161028c9061087e565b600255565b6000546001600160a01b031633146103845760405162461bcd60e51b815260040161028c9061087e565b600155565b6001543410156103db5760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636c61696d206465706f7369740000000000000000604482015260640161028c565b6000818152600360205260409020546001600160a01b0316156104375760405162461bcd60e51b8152602060048201526014602482015273436c61696d656420616c7265616479206d61646560601b604482015260640161028c565b6040805160808101825233815242602080830182815234848601908152600060608601818152888252600380865291889020965187546001600160a01b0319166001600160a01b03909116178755925160018701559051600286015590519301805460ff1916931515939093179092558251848152918201527f32899d160dbf80374e3a2eacfc04011027c1542248d33c4cd7b80d61176c0463910160405180910390a150565b60405162461bcd60e51b815260206004820152600f60248201526e139bdd08125b5c1b195b595b9d1959608a1b604482015260640161028c565b80516020820120821461055c5760405162461bcd60e51b815260206004820152600c60248201526b092dcecc2d8d2c840d0c2e6d60a31b604482015260640161028c565b600082815260036020526040902080546001600160a01b03166105b85760405162461bcd60e51b815260206004820152601460248201527310db185a5b48191bd95cc81b9bdd08195e1a5cdd60621b604482015260640161028c565b4260025482600101546105cb9190610858565b106106145760405162461bcd60e51b815260206004820152601960248201527821b430b63632b733b2903832b934b7b2103737ba1037bb32b960391b604482015260640161028c565b600381015460ff16156106695760405162461bcd60e51b815260206004820152601760248201527f4d65737361676520616c72656164792072656c61796564000000000000000000604482015260640161028c565b6000808380602001905181019061068091906108f0565b915091506000826001600160a01b03168260405161069e9190610989565b6000604051808303816000865af19150503d80600081146106db576040519150601f19603f3d011682016040523d82523d6000602084013e6106e0565b606091505b50509050806107315760405162461bcd60e51b815260206004820152601760248201527f4661696c656420746f2063616c6c20636f6e7472616374000000000000000000604482015260640161028c565b505050600301805460ff191660011790555050565b60006020828403121561075857600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561079e5761079e61075f565b604052919050565b600067ffffffffffffffff8211156107c0576107c061075f565b50601f01601f191660200190565b600080604083850312156107e157600080fd5b82359150602083013567ffffffffffffffff8111156107ff57600080fd5b8301601f8101851361081057600080fd5b803561082361081e826107a6565b610775565b81815286602083850101111561083857600080fd5b816020840160208301376000602083830101528093505050509250929050565b6000821982111561087957634e487b7160e01b600052601160045260246000fd5b500190565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b60005b838110156108db5781810151838201526020016108c3565b838111156108ea576000848401525b50505050565b6000806040838503121561090357600080fd5b82516001600160a01b038116811461091a57600080fd5b602084015190925067ffffffffffffffff81111561093757600080fd5b8301601f8101851361094857600080fd5b805161095661081e826107a6565b81815286602083850101111561096b57600080fd5b61097c8260208301602086016108c0565b8093505050509250929050565b6000825161099b8184602087016108c0565b919091019291505056fea2646970667358221220b68116d29aea33bc3a2cc26b85b6677740b9b028cfa86a109ebbcb6b98615f7c64736f6c634300080a0033", - "devdoc": { - "kind": "dev", - "methods": {}, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": {}, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 7957, - "contract": "src/bridge/FastBridgeReceiver.sol:FastBridgeReceiver", - "label": "governor", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 7959, - "contract": "src/bridge/FastBridgeReceiver.sol:FastBridgeReceiver", - "label": "claimDeposit", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 7961, - "contract": "src/bridge/FastBridgeReceiver.sol:FastBridgeReceiver", - "label": "challengeDuration", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 7975, - "contract": "src/bridge/FastBridgeReceiver.sol:FastBridgeReceiver", - "label": "claims", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_bytes32,t_struct(Claim)7970_storage)" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_mapping(t_bytes32,t_struct(Claim)7970_storage)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => struct FastBridgeReceiver.Claim)", - "numberOfBytes": "32", - "value": "t_struct(Claim)7970_storage" - }, - "t_struct(Claim)7970_storage": { - "encoding": "inplace", - "label": "struct FastBridgeReceiver.Claim", - "members": [ - { - "astId": 7963, - "contract": "src/bridge/FastBridgeReceiver.sol:FastBridgeReceiver", - "label": "bridger", - "offset": 0, - "slot": "0", - "type": "t_address" - }, - { - "astId": 7965, - "contract": "src/bridge/FastBridgeReceiver.sol:FastBridgeReceiver", - "label": "claimedAt", - "offset": 0, - "slot": "1", - "type": "t_uint256" - }, - { - "astId": 7967, - "contract": "src/bridge/FastBridgeReceiver.sol:FastBridgeReceiver", - "label": "claimDeposit", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 7969, - "contract": "src/bridge/FastBridgeReceiver.sol:FastBridgeReceiver", - "label": "relayed", - "offset": 0, - "slot": "3", - "type": "t_bool" - } - ], - "numberOfBytes": "128" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} diff --git a/contracts/deployments/rinkeby/FastBridgeReceiverOnEthereum.json b/contracts/deployments/rinkeby/FastBridgeReceiverOnEthereum.json new file mode 100644 index 000000000..341ffdb2d --- /dev/null +++ b/contracts/deployments/rinkeby/FastBridgeReceiverOnEthereum.json @@ -0,0 +1,780 @@ +{ + "address": "0x545C731e84c0034d58e57E476A3b7C3929d070CC", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_deposit", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_epochPeriod", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_challengePeriod", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_safeBridgeSender", + "type": "address" + }, + { + "internalType": "address", + "name": "_inbox", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isBridgerHonest", + "type": "bool" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_isChallengerHonest", + "type": "bool" + } + ], + "name": "BatchSafeVerified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bool", + "name": "_success", + "type": "bool" + } + ], + "name": "BatchVerified", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_challenger", + "type": "address" + } + ], + "name": "ChallengeDepositWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "ClaimChallenged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "_bridger", + "type": "address" + } + ], + "name": "ClaimDepositWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "_batchMerkleRoot", + "type": "bytes32" + } + ], + "name": "ClaimReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "_nonce", + "type": "uint256" + } + ], + "name": "MessageRelayed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "challenge", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "challengePeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "challenges", + "outputs": [ + { + "internalType": "address", + "name": "challenger", + "type": "address" + }, + { + "internalType": "bool", + "name": "honest", + "type": "bool" + }, + { + "internalType": "bool", + "name": "depositAndRewardWithdrawn", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_batchMerkleRoot", + "type": "bytes32" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "claimChallengePeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "start", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "end", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "claims", + "outputs": [ + { + "internalType": "bytes32", + "name": "batchMerkleRoot", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "bridger", + "type": "address" + }, + { + "internalType": "uint32", + "name": "timestamp", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "honest", + "type": "bool" + }, + { + "internalType": "bool", + "name": "verificationAttempted", + "type": "bool" + }, + { + "internalType": "bool", + "name": "depositAndRewardWithdrawn", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "deposit", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "fastInbox", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "inbox", + "outputs": [ + { + "internalType": "contract IInbox", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "relayed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "safeBridgeSender", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "_proof", + "type": "bytes32[]" + }, + { + "internalType": "bytes", + "name": "_message", + "type": "bytes" + } + ], + "name": "verifyAndRelayMessage", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "verifyBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "_batchMerkleRoot", + "type": "bytes32" + } + ], + "name": "verifySafeBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "withdrawChallengeDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "withdrawClaimDeposit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xfa30b922382ab2a66014d8506449f74457b822815745042fa0428fed3ce2440a", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x545C731e84c0034d58e57E476A3b7C3929d070CC", + "transactionIndex": 16, + "gasUsed": "1556362", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xfe887999f2319983bb6a3dd2c6f0e609879291830d7731de8d46f3279fd67b52", + "transactionHash": "0xfa30b922382ab2a66014d8506449f74457b822815745042fa0428fed3ce2440a", + "logs": [], + "blockNumber": 11233402, + "cumulativeGasUsed": "7417615", + "status": 1, + "byzantium": true + }, + "args": [ + "100000000000000000", + 86400, + 14400, + "0xf8A4a85e7153374A1b9BDA763a84252eC286843b", + "0x578BAde599406A8fE3d24Fd7f7211c0911F5B29e" + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "metadata": "{\"compiler\":{\"version\":\"0.8.9+commit.e5eed63a\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_deposit\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_epochPeriod\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_challengePeriod\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_safeBridgeSender\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_inbox\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isBridgerHonest\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_isChallengerHonest\",\"type\":\"bool\"}],\"name\":\"BatchSafeVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"}],\"name\":\"BatchVerified\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_challenger\",\"type\":\"address\"}],\"name\":\"ChallengeDepositWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"ClaimChallenged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"_bridger\",\"type\":\"address\"}],\"name\":\"ClaimDepositWithdrawn\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"_batchMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"ClaimReceived\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"_nonce\",\"type\":\"uint256\"}],\"name\":\"MessageRelayed\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"challenge\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"challengePeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"challenges\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"challenger\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"honest\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"depositAndRewardWithdrawn\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_batchMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"claim\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"claimChallengePeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"start\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"end\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"claims\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"batchMerkleRoot\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"bridger\",\"type\":\"address\"},{\"internalType\":\"uint32\",\"name\":\"timestamp\",\"type\":\"uint32\"},{\"internalType\":\"bool\",\"name\":\"honest\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"verificationAttempted\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"depositAndRewardWithdrawn\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"deposit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"epochPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"fastInbox\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"inbox\",\"outputs\":[{\"internalType\":\"contract IInbox\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"relayed\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"safeBridgeSender\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes32[]\",\"name\":\"_proof\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes\",\"name\":\"_message\",\"type\":\"bytes\"}],\"name\":\"verifyAndRelayMessage\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"verifyBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"bytes32\",\"name\":\"_batchMerkleRoot\",\"type\":\"bytes32\"}],\"name\":\"verifySafeBatch\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"withdrawChallengeDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"withdrawClaimDeposit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"challenge(uint256)\":{\"details\":\"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.\",\"params\":{\"_epoch\":\"The epoch of the claim to challenge.\"}},\"claim(uint256,bytes32)\":{\"details\":\"Submit a claim about the `_batchMerkleRoot` for the last completed epoch from the Fast Bridge and submit a deposit. The `_batchMerkleRoot` should match the one on the sending side otherwise the sender will lose his deposit.\",\"params\":{\"_batchMerkleRoot\":\"The batch merkle root claimed for the last completed epoch.\",\"_epoch\":\"The epoch in which the batch to claim.\"}},\"claimChallengePeriod(uint256)\":{\"details\":\"Returns the `start` and `end` time of challenge period for this `epoch`.\",\"params\":{\"_epoch\":\"The epoch of the claim to request the challenge period.\"},\"returns\":{\"end\":\"The end time of the challenge period.\",\"start\":\"The start time of the challenge period.\"}},\"constructor\":{\"details\":\"Constructor.\",\"params\":{\"_challengePeriod\":\"The duration of the period allowing to challenge a claim.\",\"_deposit\":\"The deposit amount to submit a claim in wei.\",\"_epochPeriod\":\"The duration of each epoch.\",\"_inbox\":\"Ethereum receiver specific: The address of the inbox contract on Ethereum.\",\"_safeBridgeSender\":\"The address of the Safe Bridge Sender on the connecting chain.\"}},\"verifyAndRelayMessage(uint256,bytes32[],bytes)\":{\"details\":\"Verifies merkle proof for the given message and associated nonce for the epoch and relays the message.\",\"params\":{\"_epoch\":\"The epoch in which the message was batched by the bridge.\",\"_message\":\"The data on the cross-domain chain for the message.\",\"_proof\":\"The merkle proof to prove the membership of the message and nonce in the merkle tree for the epoch.\"}},\"verifyBatch(uint256)\":{\"details\":\"Resolves the optimistic claim for '_epoch'.\",\"params\":{\"_epoch\":\"The epoch of the optimistic claim.\"}},\"verifySafeBatch(uint256,bytes32)\":{\"details\":\"Resolves any challenge of the optimistic claim for '_epoch'.\",\"params\":{\"_batchMerkleRoot\":\"The true batch merkle root for the epoch.\",\"_epoch\":\"The epoch to verify.\"}},\"withdrawChallengeDeposit(uint256)\":{\"details\":\"Sends the deposit back to the Challenger if their challenge is successful. Includes a portion of the Bridger's deposit.\",\"params\":{\"_epoch\":\"The epoch associated with the challenge deposit to withraw.\"}},\"withdrawClaimDeposit(uint256)\":{\"details\":\"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.\",\"params\":{\"_epoch\":\"The epoch associated with the claim deposit to withraw.\"}}},\"stateVariables\":{\"challengePeriod\":{\"details\":\"Returns the challenge period.\"},\"epochPeriod\":{\"details\":\"Returns the epoch period.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"verifySafeBatch(uint256,bytes32)\":{\"notice\":\"Note: Access restricted to the Safe Bridge.\"}},\"notice\":\"Fast Receiver On Ethereum Counterpart of `FastSenderFromArbitrum`\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/bridge/FastBridgeReceiverOnEthereum.sol\":\"FastBridgeReceiverOnEthereum\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/bridge/FastBridgeReceiverOnEthereum.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\\nimport \\\"./interfaces/IFastBridgeReceiver.sol\\\";\\nimport \\\"./interfaces/ISafeBridgeReceiver.sol\\\";\\nimport \\\"./canonical/arbitrum/IInbox.sol\\\";\\nimport \\\"./canonical/arbitrum/IOutbox.sol\\\";\\n\\n/**\\n * Fast Receiver On Ethereum\\n * Counterpart of `FastSenderFromArbitrum`\\n */\\ncontract FastBridgeReceiverOnEthereum is IFastBridgeReceiver, ISafeBridgeReceiver {\\n // **************************************** //\\n // * * //\\n // * Ethereum Receiver Specific * //\\n // * * //\\n // **************************************** //\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n IInbox public immutable inbox; // The address of the Arbitrum Inbox contract.\\n\\n // ************************************* //\\n // * Views * //\\n // ************************************* //\\n\\n function isSentBySafeBridge() internal view override returns (bool) {\\n IOutbox outbox = IOutbox(inbox.bridge().activeOutbox());\\n return outbox.l2ToL1Sender() == safeBridgeSender;\\n }\\n\\n /**\\n * @dev Constructor.\\n * @param _deposit The deposit amount to submit a claim in wei.\\n * @param _epochPeriod The duration of each epoch.\\n * @param _challengePeriod The duration of the period allowing to challenge a claim.\\n * @param _safeBridgeSender The address of the Safe Bridge Sender on the connecting chain.\\n * @param _inbox Ethereum receiver specific: The address of the inbox contract on Ethereum.\\n */\\n constructor(\\n uint256 _deposit,\\n uint256 _epochPeriod,\\n uint256 _challengePeriod,\\n address _safeBridgeSender,\\n address _inbox // Ethereum receiver specific\\n ) {\\n deposit = _deposit;\\n epochPeriod = _epochPeriod;\\n challengePeriod = _challengePeriod;\\n safeBridgeSender = _safeBridgeSender;\\n inbox = IInbox(_inbox); // Ethereum receiver specific\\n }\\n\\n // ************************************** //\\n // * * //\\n // * General Receiver * //\\n // * * //\\n // ************************************** //\\n\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct Claim {\\n bytes32 batchMerkleRoot;\\n address bridger;\\n uint32 timestamp;\\n bool honest;\\n bool verificationAttempted;\\n bool depositAndRewardWithdrawn;\\n }\\n\\n struct Challenge {\\n address challenger;\\n bool honest;\\n bool depositAndRewardWithdrawn;\\n }\\n\\n // ************************************* //\\n // * Storage * //\\n // ************************************* //\\n\\n uint256 public immutable deposit; // The deposit required to submit a claim or challenge\\n uint256 public immutable override epochPeriod; // Epochs mark the period between potential batches of messages.\\n uint256 public immutable override challengePeriod; // Epochs mark the period between potential batches of messages.\\n address public immutable safeBridgeSender; // The address of the Safe Bridge Sender on the connecting chain.\\n\\n mapping(uint256 => bytes32) public fastInbox; // epoch => validated batch merkle root(optimistically, or challenged and verified with the safe bridge)\\n mapping(uint256 => Claim) public claims; // epoch => claim\\n mapping(uint256 => Challenge) public challenges; // epoch => challenge\\n mapping(uint256 => mapping(uint256 => bytes32)) public relayed; // epoch => packed replay bitmap\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n /**\\n * @dev Submit a claim about the `_batchMerkleRoot` for the last completed epoch from the Fast Bridge 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 in which the batch to claim.\\n * @param _batchMerkleRoot The batch merkle root claimed for the last completed epoch.\\n */\\n function claim(uint256 _epoch, bytes32 _batchMerkleRoot) external payable override {\\n require(msg.value >= deposit, \\\"Insufficient claim deposit.\\\");\\n require(_batchMerkleRoot != bytes32(0), \\\"Invalid claim.\\\");\\n\\n uint256 epochNow = block.timestamp / epochPeriod;\\n // allow claim about current or previous epoch\\n require(_epoch == epochNow || _epoch == epochNow + 1, \\\"Invalid Claim\\\");\\n require(claims[_epoch].bridger == address(0), \\\"Claim already made for most recent finalized epoch.\\\");\\n\\n claims[_epoch] = Claim({\\n batchMerkleRoot: _batchMerkleRoot,\\n bridger: msg.sender,\\n timestamp: uint32(block.timestamp),\\n honest: false,\\n verificationAttempted: false,\\n depositAndRewardWithdrawn: false\\n });\\n emit ClaimReceived(_epoch, _batchMerkleRoot);\\n }\\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 override {\\n require(msg.value >= deposit, \\\"Not enough claim deposit\\\");\\n\\n // Can only challenge the only active claim, about the previous epoch\\n require(claims[_epoch].bridger != address(0), \\\"No claim to challenge.\\\");\\n require(block.timestamp < uint256(claims[_epoch].timestamp) + challengePeriod, \\\"Challenge period elapsed.\\\");\\n\\n challenges[_epoch] = Challenge({challenger: msg.sender, honest: false, depositAndRewardWithdrawn: false});\\n emit ClaimChallenged(_epoch);\\n }\\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 override {\\n Claim storage claim = claims[_epoch];\\n require(claim.bridger != address(0), \\\"Invalid epoch, no claim to verify.\\\");\\n require(claim.verificationAttempted == false, \\\"Optimistic verification already attempted.\\\");\\n require(\\n block.timestamp > uint256(claims[_epoch].timestamp) + challengePeriod,\\n \\\"Challenge period has not yet elapsed.\\\"\\n );\\n\\n if (challenges[_epoch].challenger == address(0)) {\\n // Optimistic happy path\\n claim.honest = true;\\n fastInbox[_epoch] = claim.batchMerkleRoot;\\n emit BatchVerified(_epoch, true);\\n } else {\\n emit BatchVerified(_epoch, false);\\n }\\n claim.verificationAttempted = true;\\n }\\n\\n /**\\n * Note: Access restricted to the Safe Bridge.\\n * @dev Resolves any challenge of the optimistic claim for '_epoch'.\\n * @param _epoch The epoch to verify.\\n * @param _batchMerkleRoot The true batch merkle root for the epoch.\\n */\\n function verifySafeBatch(uint256 _epoch, bytes32 _batchMerkleRoot) external override onlyFromSafeBridge {\\n require(isSentBySafeBridge(), \\\"Access not allowed: SafeBridgeSender only.\\\");\\n\\n fastInbox[_epoch] = _batchMerkleRoot;\\n\\n // Corner cases:\\n // a) No claim submitted,\\n // b) Receiving the root of an empty batch,\\n // c) Batch root is zero.\\n if (claims[_epoch].bridger != address(0)) {\\n if (_batchMerkleRoot == claims[_epoch].batchMerkleRoot) {\\n claims[_epoch].honest = true;\\n } else {\\n claims[_epoch].honest = false;\\n challenges[_epoch].honest = true;\\n }\\n }\\n emit BatchSafeVerified(_epoch, claims[_epoch].honest, challenges[_epoch].honest);\\n }\\n\\n /**\\n * @dev Verifies merkle proof for the given message and associated nonce for the 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 override {\\n bytes32 batchMerkleRoot = fastInbox[_epoch];\\n require(batchMerkleRoot != bytes32(0), \\\"Invalid epoch.\\\");\\n\\n // Claim assessment if any\\n require(validateProof(_proof, sha256(_message), batchMerkleRoot) == true, \\\"Invalid proof.\\\");\\n require(_checkReplayAndRelay(_epoch, _message), \\\"Failed to call contract\\\"); // Checks-Effects-Interaction\\n }\\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 override {\\n Claim storage claim = claims[_epoch];\\n\\n require(claim.bridger != address(0), \\\"Claim does not exist\\\");\\n require(claim.honest == true, \\\"Claim failed.\\\");\\n require(claim.depositAndRewardWithdrawn == false, \\\"Claim deposit and any rewards already withdrawn.\\\");\\n\\n uint256 amount = deposit;\\n if (challenges[_epoch].challenger != address(0) && challenges[_epoch].honest == false) {\\n amount += deposit / 2; // half burnt\\n }\\n\\n claim.depositAndRewardWithdrawn = true;\\n emit ClaimDepositWithdrawn(_epoch, claim.bridger);\\n\\n payable(claim.bridger).send(amount); // Use of send to prevent reverting fallback. User is responsibility for accepting ETH.\\n // Checks-Effects-Interaction\\n }\\n\\n /**\\n * @dev Sends the deposit back to the Challenger if their 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 override {\\n Challenge storage challenge = challenges[_epoch];\\n\\n require(challenge.challenger != address(0), \\\"Challenge does not exist\\\");\\n require(challenge.honest == true, \\\"Challenge failed.\\\");\\n require(challenge.depositAndRewardWithdrawn == false, \\\"Challenge deposit and rewards already withdrawn.\\\");\\n\\n uint256 amount = deposit;\\n if (claims[_epoch].bridger != address(0) && claims[_epoch].honest == false) {\\n amount += deposit / 2; // half burnt\\n }\\n\\n challenge.depositAndRewardWithdrawn = true;\\n emit ChallengeDepositWithdrawn(_epoch, challenge.challenger);\\n\\n payable(challenge.challenger).send(amount); // Use of send to prevent reverting fallback. User is responsibility for accepting ETH.\\n // Checks-Effects-Interaction\\n }\\n\\n // ********************************** //\\n // * Merkle Proof * //\\n // ********************************** //\\n\\n /**\\n * @dev Validates membership of leaf in merkle tree with merkle proof.\\n * Note: Inlined from `merkle/MerkleProof.sol` for performance.\\n * @param proof The merkle proof.\\n * @param leaf The leaf to validate membership in merkle tree.\\n * @param merkleRoot The root of the merkle tree.\\n */\\n function validateProof(\\n bytes32[] memory proof,\\n bytes32 leaf,\\n bytes32 merkleRoot\\n ) internal pure returns (bool) {\\n return (merkleRoot == calculateRoot(proof, leaf));\\n }\\n\\n /**\\n * @dev Calculates merkle root from proof.\\n * @param proof The merkle proof.\\n * @param leaf The leaf to validate membership in merkle tree..\\n */\\n function calculateRoot(bytes32[] memory proof, bytes32 leaf) private pure returns (bytes32) {\\n uint256 proofLength = proof.length;\\n require(proofLength <= 32, \\\"Invalid Proof\\\");\\n bytes32 h = leaf;\\n for (uint256 i = 0; i < proofLength; i++) {\\n bytes32 proofElement = proof[i];\\n // effecient hash\\n if (proofElement > h)\\n assembly {\\n mstore(0x00, h)\\n mstore(0x20, proofElement)\\n h := keccak256(0x00, 0x40)\\n }\\n else\\n assembly {\\n mstore(0x00, proofElement)\\n mstore(0x20, h)\\n h := keccak256(0x00, 0x40)\\n }\\n }\\n return h;\\n }\\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 override returns (uint256 start, uint256 end) {\\n // start begins latest after the claim deadline expiry\\n // however can begin as soon as a claim is made\\n // can only challenge the only active claim, about the previous epoch\\n start = claims[_epoch].timestamp;\\n end = start + challengePeriod;\\n }\\n\\n // ************************ //\\n // * Internal * //\\n // ************************ //\\n\\n function _checkReplayAndRelay(uint256 _epoch, bytes calldata _messageData) internal returns (bool success) {\\n // Decode the receiver address from the data encoded by the IFastBridgeSender\\n (uint256 nonce, address receiver, bytes memory data) = abi.decode(_messageData, (uint256, address, bytes));\\n\\n uint256 index = nonce / 256;\\n uint256 offset = nonce % 256;\\n bytes32 replay = relayed[_epoch][index];\\n require(((replay >> offset) & bytes32(uint256(1))) == 0, \\\"Message already relayed\\\");\\n relayed[_epoch][index] = replay | bytes32(1 << offset);\\n emit MessageRelayed(_epoch, nonce);\\n\\n (success, ) = receiver.call(data);\\n // Checks-Effects-Interaction\\n }\\n}\\n\",\"keccak256\":\"0x12268e97d61b51c8fb276998e202e987c5f2e0950f8e3a0ee27c1f90598a996b\",\"license\":\"MIT\"},\"src/bridge/canonical/arbitrum/IInbox.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\n/*\\n * Copyright 2019-2021, Offchain Labs, Inc.\\n *\\n * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n * you may not use this file except in compliance with the License.\\n * You may obtain a copy of the License at\\n *\\n * http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n * See the License for the specific language governing permissions and\\n * limitations under the License.\\n */\\n\\npragma solidity >=0.7.0;\\n\\ninterface IInbox {\\n function sendL2Message(bytes calldata messageData) external returns (uint256);\\n\\n function sendUnsignedTransaction(\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n uint256 nonce,\\n address destAddr,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (uint256);\\n\\n function sendContractTransaction(\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n address destAddr,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (uint256);\\n\\n function sendL1FundedUnsignedTransaction(\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n uint256 nonce,\\n address destAddr,\\n bytes calldata data\\n ) external payable returns (uint256);\\n\\n function sendL1FundedContractTransaction(\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n address destAddr,\\n bytes calldata data\\n ) external payable returns (uint256);\\n\\n function createRetryableTicket(\\n address destAddr,\\n uint256 arbTxCallValue,\\n uint256 maxSubmissionCost,\\n address submissionRefundAddress,\\n address valueRefundAddress,\\n uint256 maxGas,\\n uint256 gasPriceBid,\\n bytes calldata data\\n ) external payable returns (uint256);\\n\\n function depositEth(uint256 maxSubmissionCost) external payable returns (uint256);\\n\\n function bridge() external view returns (IBridge);\\n}\\n\\ninterface IBridge {\\n event MessageDelivered(\\n uint256 indexed messageIndex,\\n bytes32 indexed beforeInboxAcc,\\n address inbox,\\n uint8 kind,\\n address sender,\\n bytes32 messageDataHash\\n );\\n\\n function deliverMessageToInbox(\\n uint8 kind,\\n address sender,\\n bytes32 messageDataHash\\n ) external payable returns (uint256);\\n\\n function executeCall(\\n address destAddr,\\n uint256 amount,\\n bytes calldata data\\n ) external returns (bool success, bytes memory returnData);\\n\\n // These are only callable by the admin\\n function setInbox(address inbox, bool enabled) external;\\n\\n function setOutbox(address inbox, bool enabled) external;\\n\\n // View functions\\n\\n function activeOutbox() external view returns (address);\\n\\n function allowedInboxes(address inbox) external view returns (bool);\\n\\n function allowedOutboxes(address outbox) external view returns (bool);\\n\\n function inboxAccs(uint256 index) external view returns (bytes32);\\n\\n function messageCount() external view returns (uint256);\\n}\\n\\ninterface IMessageProvider {\\n event InboxMessageDelivered(uint256 indexed messageNum, bytes data);\\n\\n event InboxMessageDeliveredFromOrigin(uint256 indexed messageNum);\\n}\\n\",\"keccak256\":\"0xb567e54805f44ea8405231284583880a38e8a22bfe619528a4f8ec7550f11d1b\",\"license\":\"Apache-2.0\"},\"src/bridge/canonical/arbitrum/IOutbox.sol\":{\"content\":\"// SPDX-License-Identifier: Apache-2.0\\n\\n/*\\n * Copyright 2021, Offchain Labs, Inc.\\n *\\n * Licensed under the Apache License, Version 2.0 (the \\\"License\\\");\\n * you may not use this file except in compliance with the License.\\n * You may obtain a copy of the License at\\n *\\n * http://www.apache.org/licenses/LICENSE-2.0\\n *\\n * Unless required by applicable law or agreed to in writing, software\\n * distributed under the License is distributed on an \\\"AS IS\\\" BASIS,\\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\\n * See the License for the specific language governing permissions and\\n * limitations under the License.\\n */\\n\\npragma solidity >=0.7.0;\\n\\ninterface IOutbox {\\n event OutboxEntryCreated(uint256 indexed batchNum, uint256 outboxIndex, bytes32 outputRoot, uint256 numInBatch);\\n\\n function l2ToL1Sender() external view returns (address);\\n\\n function l2ToL1Block() external view returns (uint256);\\n\\n function l2ToL1EthBlock() external view returns (uint256);\\n\\n function l2ToL1Timestamp() external view returns (uint256);\\n\\n function processOutgoingMessages(bytes calldata sendsData, uint256[] calldata sendLengths) external;\\n}\\n\",\"keccak256\":\"0xdc4952b5238d6c6282595b2eab4058c86d2d232b99a2d67556c02d6c11eea94f\",\"license\":\"Apache-2.0\"},\"src/bridge/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\"},\"src/bridge/interfaces/ISafeBridgeReceiver.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\\nabstract contract ISafeBridgeReceiver {\\n /**\\n * Note: Access restricted to the Safe Bridge.\\n * @dev Resolves any challenge of the optimistic claim for '_epoch'.\\n * @param _epoch The epoch associated with the _batchmerkleRoot.\\n * @param _batchMerkleRoot The true batch merkle root for the epoch sent by the safe bridge.\\n */\\n function verifySafeBatch(uint256 _epoch, bytes32 _batchMerkleRoot) external virtual;\\n\\n function isSentBySafeBridge() internal view virtual returns (bool);\\n\\n modifier onlyFromSafeBridge() {\\n require(isSentBySafeBridge(), \\\"Safe Bridge only.\\\");\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xc4bee04423c73bf37e7d975fccab05767ba0e738cc753d293438c2d1ace9f804\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x6101206040523480156200001257600080fd5b5060405162001c9838038062001c9883398101604081905262000035916200007a565b60a09490945260c09290925260e0526001600160a01b039081166101005216608052620000cf565b80516001600160a01b03811681146200007557600080fd5b919050565b600080600080600060a086880312156200009357600080fd5b855194506020860151935060408601519250620000b3606087016200005d565b9150620000c3608087016200005d565b90509295509295909350565b60805160a05160c05160e05161010051611b3062000168600039600081816103a101526114d80152600081816104410152818161078e01528181610ca2015261103501526000818161034d01526105710152600081816103ed015281816104b9015281816108f00152818161094901528181610bba015281816112cc015261132901526000818161049501526113d50152611b306000f3fe6080604052600436106100fe5760003560e01c8063b141770311610095578063d0e30db011610064578063d0e30db0146103db578063dfe3a3ae1461040f578063f3f480d91461042f578063f4cf751b14610463578063fb0e722b1461048357600080fd5b8063b141770314610303578063b5b7a1841461033b578063ba7f4d761461036f578063c2ef14871461038f57600080fd5b80635bfe5f1a116100d15780635bfe5f1a146101ad5780638f1d3776146101cd578063a888c2cd14610240578063ab82d9a0146102f057600080fd5b80632a9700a11461010357806331d1445714610143578063383b90f91461015857806350b81dbe1461018d575b600080fd5b34801561010f57600080fd5b5061013061011e3660046117ab565b60006020819052908152604090205481565b6040519081526020015b60405180910390f35b6101566101513660046117c4565b6104b7565b005b34801561016457600080fd5b506101786101733660046117ab565b610769565b6040805192835260208301919091520161013a565b34801561019957600080fd5b506101566101a83660046117ab565b6107ba565b3480156101b957600080fd5b506101566101c83660046117c4565b6109f8565b3480156101d957600080fd5b506102196101e83660046117ab565b6002602052600090815260409020546001600160a01b0381169060ff600160a01b8204811691600160a81b90041683565b604080516001600160a01b039094168452911515602084015215159082015260600161013a565b34801561024c57600080fd5b506102ac61025b3660046117ab565b600160208190526000918252604090912080549101546001600160a01b0381169063ffffffff600160a01b8204169060ff600160c01b8204811691600160c81b8104821691600160d01b9091041686565b604080519687526001600160a01b03909516602087015263ffffffff90931693850193909352151560608401529015156080830152151560a082015260c00161013a565b6101566102fe3660046117ab565b610bb8565b34801561030f57600080fd5b5061013061031e3660046117c4565b600360209081526000928352604080842090915290825290205481565b34801561034757600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561037b57600080fd5b5061015661038a36600461182f565b610dbb565b34801561039b57600080fd5b506103c37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161013a565b3480156103e757600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561041b57600080fd5b5061015661042a3660046117ab565b610f38565b34801561043b57600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561046f57600080fd5b5061015661047e3660046117ab565b61118f565b34801561048f57600080fd5b506103c37f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000034101561052c5760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e7420636c61696d206465706f7369742e000000000060448201526064015b60405180910390fd5b8061056a5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b630b4b69760911b6044820152606401610523565b60006105967f000000000000000000000000000000000000000000000000000000000000000042611906565b9050808314806105af57506105ac81600161191a565b83145b6105eb5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420436c61696d60981b6044820152606401610523565b600083815260016020819052604090912001546001600160a01b0316156106705760405162461bcd60e51b815260206004820152603360248201527f436c61696d20616c7265616479206d61646520666f72206d6f73742072656365604482015272373a103334b730b634bd32b21032b837b1b41760691b6064820152608401610523565b6040805160c08101825283815233602080830191825263ffffffff4281168486019081526000606086018181526080870182815260a088018381528c845260019687905289842098518955965197909501805493519151955196511515600160d01b0260ff60d01b19971515600160c81b0260ff60c81b19971515600160c01b029790971661ffff60c01b1993909616600160a01b026001600160c01b03199095166001600160a01b0399909916989098179390931716929092179290921792909216929092179091559051839185917f7eb220572187462098b6d5192bbe907549f0614d7c3580735a7e5c357a6157999190a3505050565b600081815260016020819052604082200154600160a01b900463ffffffff16906107b37f00000000000000000000000000000000000000000000000000000000000000008361191a565b9050915091565b6000818152600160208190526040909120908101546001600160a01b031661081b5760405162461bcd60e51b815260206004820152601460248201527310db185a5b48191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610523565b600181810154600160c01b900460ff1615151461086a5760405162461bcd60e51b815260206004820152600d60248201526c21b630b4b6903330b4b632b21760991b6044820152606401610523565b6001810154600160d01b900460ff16156108df5760405162461bcd60e51b815260206004820152603060248201527f436c61696d206465706f73697420616e6420616e79207265776172647320616c60448201526f3932b0b23c903bb4ba34323930bbb71760811b6064820152608401610523565b6000828152600260205260409020547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03161580159061093d5750600083815260026020526040902054600160a01b900460ff16155b1561097a5761096d60027f0000000000000000000000000000000000000000000000000000000000000000611906565b610977908261191a565b90505b60018201805460ff60d01b198116600160d01b179091556040516001600160a01b039091169084907f3d8490b2b1cee24079fde68fd6a415c1f12e9a76e8090ac027dad29b6660261990600090a360018201546040516001600160a01b039091169082156108fc029083906000818181858888f15050505050505050565b610a006113d0565b610a405760405162461bcd60e51b815260206004820152601160248201527029b0b33290213934b233b29037b7363c9760791b6044820152606401610523565b610a486113d0565b610aa75760405162461bcd60e51b815260206004820152602a60248201527f416363657373206e6f7420616c6c6f7765643a20536166654272696467655365604482015269373232b91037b7363c9760b11b6064820152608401610523565b60008281526020818152604080832084905560019182905290912001546001600160a01b031615610b4757600082815260016020526040902054811415610b1057600082815260016020819052604090912001805460ff60c01b1916600160c01b179055610b47565b6000828152600160208181526040808420909201805460ff60c01b19169055600290529020805460ff60a01b1916600160a01b1790555b6000828152600160208181526040808420909201546002825292829020548251600160c01b90940460ff90811615158552600160a01b9091041615159083015283917f7451cfa583de6b2abaad934288f349736a4883acb348844352a320a1e1d38080910160405180910390a25050565b7f0000000000000000000000000000000000000000000000000000000000000000341015610c285760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636c61696d206465706f73697400000000000000006044820152606401610523565b600081815260016020819052604090912001546001600160a01b0316610c895760405162461bcd60e51b815260206004820152601660248201527527379031b630b4b6903a379031b430b63632b733b29760511b6044820152606401610523565b60008181526001602081905260409091200154610cd4907f000000000000000000000000000000000000000000000000000000000000000090600160a01b900463ffffffff1661191a565b4210610d225760405162461bcd60e51b815260206004820152601960248201527f4368616c6c656e676520706572696f6420656c61707365642e000000000000006044820152606401610523565b6040805160608101825233815260006020808301828152838501838152868452600290925284832093518454915192511515600160a81b0260ff60a81b19931515600160a01b026001600160a81b03199093166001600160a01b039290921691909117919091179190911617909155905182917fe7230bb507d3a19678a0138ccb36eec02510dd27f11e37e2c9644d597dbc693891a250565b60008581526020819052604090205480610e085760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21032b837b1b41760911b6044820152606401610523565b610e978585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060405160029250610e51915087908790611932565b602060405180830381855afa158015610e6e573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610e919190611942565b83611581565b1515600114610ed95760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b210383937b7b31760911b6044820152606401610523565b610ee4868484611597565b610f305760405162461bcd60e51b815260206004820152601760248201527f4661696c656420746f2063616c6c20636f6e74726163740000000000000000006044820152606401610523565b505050505050565b6000818152600160208190526040909120908101546001600160a01b0316610fad5760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642065706f63682c206e6f20636c61696d20746f2076657269666044820152613c9760f11b6064820152608401610523565b6001810154600160c81b900460ff161561101c5760405162461bcd60e51b815260206004820152602a60248201527f4f7074696d697374696320766572696669636174696f6e20616c72656164792060448201526930ba3a32b6b83a32b21760b11b6064820152608401610523565b60008281526001602081905260409091200154611067907f000000000000000000000000000000000000000000000000000000000000000090600160a01b900463ffffffff1661191a565b42116110c35760405162461bcd60e51b815260206004820152602560248201527f4368616c6c656e676520706572696f6420686173206e6f742079657420656c616044820152643839b2b21760d91b6064820152608401610523565b6000828152600260205260409020546001600160a01b0316611141576001818101805460ff60c01b1916600160c01b179055815460008481526020818152604091829020929092555191825283917f8fa19318c4280299918d1220c80ba5db06b26b8947b75384ce2d74ba043c0265910160405180910390a2611178565b6040516000815282907f8fa19318c4280299918d1220c80ba5db06b26b8947b75384ce2d74ba043c02659060200160405180910390a25b600101805460ff60c81b1916600160c81b17905550565b600081815260026020526040902080546001600160a01b03166111f45760405162461bcd60e51b815260206004820152601860248201527f4368616c6c656e676520646f6573206e6f7420657869737400000000000000006044820152606401610523565b8054600160a01b900460ff1615156001146112455760405162461bcd60e51b815260206004820152601160248201527021b430b63632b733b2903330b4b632b21760791b6044820152606401610523565b8054600160a81b900460ff16156112b75760405162461bcd60e51b815260206004820152603060248201527f4368616c6c656e6765206465706f73697420616e64207265776172647320616c60448201526f3932b0b23c903bb4ba34323930bbb71760811b6064820152608401610523565b600082815260016020819052604090912001547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03161580159061131d575060008381526001602081905260409091200154600160c01b900460ff16155b1561135a5761134d60027f0000000000000000000000000000000000000000000000000000000000000000611906565b611357908261191a565b90505b815460ff60a81b198116600160a81b1783556040516001600160a01b039091169084907f9e0ea87919796fe5ad8e4362a6a3ff07f6a73e0731b94f451d7184e4928f313b90600090a381546040516001600160a01b039091169082156108fc029083906000818181858888f15050505050505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e78cea926040518163ffffffff1660e01b815260040160206040518083038186803b15801561142c57600080fd5b505afa158015611440573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114649190611973565b6001600160a01b031663ab5d89436040518163ffffffff1660e01b815260040160206040518083038186803b15801561149c57600080fd5b505afa1580156114b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d49190611973565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03166380648b026040518163ffffffff1660e01b815260040160206040518083038186803b15801561153957600080fd5b505afa15801561154d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115719190611973565b6001600160a01b03161491505090565b600061158d84846116f3565b9091149392505050565b60008080806115a8858701876119ad565b9194509250905060006115bd61010085611906565b905060006115cd61010086611a7a565b60008a815260036020908152604080832086845290915290205490915080821c6001161561163d5760405162461bcd60e51b815260206004820152601760248201527f4d65737361676520616c72656164792072656c617965640000000000000000006044820152606401610523565b60008a81526003602090815260408083208684529091528082206001851b841790555187918c917f7f2ae957b8ae493c532b836f8a7e17178d402b24829677739558336424ae335f9190a3846001600160a01b0316846040516116a09190611a8e565b6000604051808303816000865af19150503d80600081146116dd576040519150601f19603f3d011682016040523d82523d6000602084013e6116e2565b606091505b50909b9a5050505050505050505050565b815160009060208111156117395760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210283937b7b360991b6044820152606401610523565b8260005b828110156117a257600086828151811061175957611759611ac9565b602002602001015190508281111561177f5782600052806020526040600020925061178f565b8060005282602052604060002092505b508061179a81611adf565b91505061173d565b50949350505050565b6000602082840312156117bd57600080fd5b5035919050565b600080604083850312156117d757600080fd5b50508035926020909101359150565b60008083601f8401126117f857600080fd5b50813567ffffffffffffffff81111561181057600080fd5b60208301915083602082850101111561182857600080fd5b9250929050565b60008060008060006060868803121561184757600080fd5b85359450602086013567ffffffffffffffff8082111561186657600080fd5b818801915088601f83011261187a57600080fd5b81358181111561188957600080fd5b8960208260051b850101111561189e57600080fd5b6020830196508095505060408801359150808211156118bc57600080fd5b506118c9888289016117e6565b969995985093965092949392505050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082611915576119156118da565b500490565b6000821982111561192d5761192d6118f0565b500190565b8183823760009101908152919050565b60006020828403121561195457600080fd5b5051919050565b6001600160a01b038116811461197057600080fd5b50565b60006020828403121561198557600080fd5b81516119908161195b565b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156119c257600080fd5b8335925060208401356119d48161195b565b9150604084013567ffffffffffffffff808211156119f157600080fd5b818601915086601f830112611a0557600080fd5b813581811115611a1757611a17611997565b604051601f8201601f19908116603f01168101908382118183101715611a3f57611a3f611997565b81604052828152896020848701011115611a5857600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600082611a8957611a896118da565b500690565b6000825160005b81811015611aaf5760208186018101518583015201611a95565b81811115611abe576000828501525b509190910192915050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611af357611af36118f0565b506001019056fea2646970667358221220a56590433e0dfda6714a96a98bf4689e981841c72d850ccac75cc788553712a864736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100fe5760003560e01c8063b141770311610095578063d0e30db011610064578063d0e30db0146103db578063dfe3a3ae1461040f578063f3f480d91461042f578063f4cf751b14610463578063fb0e722b1461048357600080fd5b8063b141770314610303578063b5b7a1841461033b578063ba7f4d761461036f578063c2ef14871461038f57600080fd5b80635bfe5f1a116100d15780635bfe5f1a146101ad5780638f1d3776146101cd578063a888c2cd14610240578063ab82d9a0146102f057600080fd5b80632a9700a11461010357806331d1445714610143578063383b90f91461015857806350b81dbe1461018d575b600080fd5b34801561010f57600080fd5b5061013061011e3660046117ab565b60006020819052908152604090205481565b6040519081526020015b60405180910390f35b6101566101513660046117c4565b6104b7565b005b34801561016457600080fd5b506101786101733660046117ab565b610769565b6040805192835260208301919091520161013a565b34801561019957600080fd5b506101566101a83660046117ab565b6107ba565b3480156101b957600080fd5b506101566101c83660046117c4565b6109f8565b3480156101d957600080fd5b506102196101e83660046117ab565b6002602052600090815260409020546001600160a01b0381169060ff600160a01b8204811691600160a81b90041683565b604080516001600160a01b039094168452911515602084015215159082015260600161013a565b34801561024c57600080fd5b506102ac61025b3660046117ab565b600160208190526000918252604090912080549101546001600160a01b0381169063ffffffff600160a01b8204169060ff600160c01b8204811691600160c81b8104821691600160d01b9091041686565b604080519687526001600160a01b03909516602087015263ffffffff90931693850193909352151560608401529015156080830152151560a082015260c00161013a565b6101566102fe3660046117ab565b610bb8565b34801561030f57600080fd5b5061013061031e3660046117c4565b600360209081526000928352604080842090915290825290205481565b34801561034757600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561037b57600080fd5b5061015661038a36600461182f565b610dbb565b34801561039b57600080fd5b506103c37f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161013a565b3480156103e757600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561041b57600080fd5b5061015661042a3660046117ab565b610f38565b34801561043b57600080fd5b506101307f000000000000000000000000000000000000000000000000000000000000000081565b34801561046f57600080fd5b5061015661047e3660046117ab565b61118f565b34801561048f57600080fd5b506103c37f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000034101561052c5760405162461bcd60e51b815260206004820152601b60248201527f496e73756666696369656e7420636c61696d206465706f7369742e000000000060448201526064015b60405180910390fd5b8061056a5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21031b630b4b69760911b6044820152606401610523565b60006105967f000000000000000000000000000000000000000000000000000000000000000042611906565b9050808314806105af57506105ac81600161191a565b83145b6105eb5760405162461bcd60e51b815260206004820152600d60248201526c496e76616c696420436c61696d60981b6044820152606401610523565b600083815260016020819052604090912001546001600160a01b0316156106705760405162461bcd60e51b815260206004820152603360248201527f436c61696d20616c7265616479206d61646520666f72206d6f73742072656365604482015272373a103334b730b634bd32b21032b837b1b41760691b6064820152608401610523565b6040805160c08101825283815233602080830191825263ffffffff4281168486019081526000606086018181526080870182815260a088018381528c845260019687905289842098518955965197909501805493519151955196511515600160d01b0260ff60d01b19971515600160c81b0260ff60c81b19971515600160c01b029790971661ffff60c01b1993909616600160a01b026001600160c01b03199095166001600160a01b0399909916989098179390931716929092179290921792909216929092179091559051839185917f7eb220572187462098b6d5192bbe907549f0614d7c3580735a7e5c357a6157999190a3505050565b600081815260016020819052604082200154600160a01b900463ffffffff16906107b37f00000000000000000000000000000000000000000000000000000000000000008361191a565b9050915091565b6000818152600160208190526040909120908101546001600160a01b031661081b5760405162461bcd60e51b815260206004820152601460248201527310db185a5b48191bd95cc81b9bdd08195e1a5cdd60621b6044820152606401610523565b600181810154600160c01b900460ff1615151461086a5760405162461bcd60e51b815260206004820152600d60248201526c21b630b4b6903330b4b632b21760991b6044820152606401610523565b6001810154600160d01b900460ff16156108df5760405162461bcd60e51b815260206004820152603060248201527f436c61696d206465706f73697420616e6420616e79207265776172647320616c60448201526f3932b0b23c903bb4ba34323930bbb71760811b6064820152608401610523565b6000828152600260205260409020547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03161580159061093d5750600083815260026020526040902054600160a01b900460ff16155b1561097a5761096d60027f0000000000000000000000000000000000000000000000000000000000000000611906565b610977908261191a565b90505b60018201805460ff60d01b198116600160d01b179091556040516001600160a01b039091169084907f3d8490b2b1cee24079fde68fd6a415c1f12e9a76e8090ac027dad29b6660261990600090a360018201546040516001600160a01b039091169082156108fc029083906000818181858888f15050505050505050565b610a006113d0565b610a405760405162461bcd60e51b815260206004820152601160248201527029b0b33290213934b233b29037b7363c9760791b6044820152606401610523565b610a486113d0565b610aa75760405162461bcd60e51b815260206004820152602a60248201527f416363657373206e6f7420616c6c6f7765643a20536166654272696467655365604482015269373232b91037b7363c9760b11b6064820152608401610523565b60008281526020818152604080832084905560019182905290912001546001600160a01b031615610b4757600082815260016020526040902054811415610b1057600082815260016020819052604090912001805460ff60c01b1916600160c01b179055610b47565b6000828152600160208181526040808420909201805460ff60c01b19169055600290529020805460ff60a01b1916600160a01b1790555b6000828152600160208181526040808420909201546002825292829020548251600160c01b90940460ff90811615158552600160a01b9091041615159083015283917f7451cfa583de6b2abaad934288f349736a4883acb348844352a320a1e1d38080910160405180910390a25050565b7f0000000000000000000000000000000000000000000000000000000000000000341015610c285760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636c61696d206465706f73697400000000000000006044820152606401610523565b600081815260016020819052604090912001546001600160a01b0316610c895760405162461bcd60e51b815260206004820152601660248201527527379031b630b4b6903a379031b430b63632b733b29760511b6044820152606401610523565b60008181526001602081905260409091200154610cd4907f000000000000000000000000000000000000000000000000000000000000000090600160a01b900463ffffffff1661191a565b4210610d225760405162461bcd60e51b815260206004820152601960248201527f4368616c6c656e676520706572696f6420656c61707365642e000000000000006044820152606401610523565b6040805160608101825233815260006020808301828152838501838152868452600290925284832093518454915192511515600160a81b0260ff60a81b19931515600160a01b026001600160a81b03199093166001600160a01b039290921691909117919091179190911617909155905182917fe7230bb507d3a19678a0138ccb36eec02510dd27f11e37e2c9644d597dbc693891a250565b60008581526020819052604090205480610e085760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21032b837b1b41760911b6044820152606401610523565b610e978585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060405160029250610e51915087908790611932565b602060405180830381855afa158015610e6e573d6000803e3d6000fd5b5050506040513d601f19601f82011682018060405250810190610e919190611942565b83611581565b1515600114610ed95760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b210383937b7b31760911b6044820152606401610523565b610ee4868484611597565b610f305760405162461bcd60e51b815260206004820152601760248201527f4661696c656420746f2063616c6c20636f6e74726163740000000000000000006044820152606401610523565b505050505050565b6000818152600160208190526040909120908101546001600160a01b0316610fad5760405162461bcd60e51b815260206004820152602260248201527f496e76616c69642065706f63682c206e6f20636c61696d20746f2076657269666044820152613c9760f11b6064820152608401610523565b6001810154600160c81b900460ff161561101c5760405162461bcd60e51b815260206004820152602a60248201527f4f7074696d697374696320766572696669636174696f6e20616c72656164792060448201526930ba3a32b6b83a32b21760b11b6064820152608401610523565b60008281526001602081905260409091200154611067907f000000000000000000000000000000000000000000000000000000000000000090600160a01b900463ffffffff1661191a565b42116110c35760405162461bcd60e51b815260206004820152602560248201527f4368616c6c656e676520706572696f6420686173206e6f742079657420656c616044820152643839b2b21760d91b6064820152608401610523565b6000828152600260205260409020546001600160a01b0316611141576001818101805460ff60c01b1916600160c01b179055815460008481526020818152604091829020929092555191825283917f8fa19318c4280299918d1220c80ba5db06b26b8947b75384ce2d74ba043c0265910160405180910390a2611178565b6040516000815282907f8fa19318c4280299918d1220c80ba5db06b26b8947b75384ce2d74ba043c02659060200160405180910390a25b600101805460ff60c81b1916600160c81b17905550565b600081815260026020526040902080546001600160a01b03166111f45760405162461bcd60e51b815260206004820152601860248201527f4368616c6c656e676520646f6573206e6f7420657869737400000000000000006044820152606401610523565b8054600160a01b900460ff1615156001146112455760405162461bcd60e51b815260206004820152601160248201527021b430b63632b733b2903330b4b632b21760791b6044820152606401610523565b8054600160a81b900460ff16156112b75760405162461bcd60e51b815260206004820152603060248201527f4368616c6c656e6765206465706f73697420616e64207265776172647320616c60448201526f3932b0b23c903bb4ba34323930bbb71760811b6064820152608401610523565b600082815260016020819052604090912001547f0000000000000000000000000000000000000000000000000000000000000000906001600160a01b03161580159061131d575060008381526001602081905260409091200154600160c01b900460ff16155b1561135a5761134d60027f0000000000000000000000000000000000000000000000000000000000000000611906565b611357908261191a565b90505b815460ff60a81b198116600160a81b1783556040516001600160a01b039091169084907f9e0ea87919796fe5ad8e4362a6a3ff07f6a73e0731b94f451d7184e4928f313b90600090a381546040516001600160a01b039091169082156108fc029083906000818181858888f15050505050505050565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e78cea926040518163ffffffff1660e01b815260040160206040518083038186803b15801561142c57600080fd5b505afa158015611440573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114649190611973565b6001600160a01b031663ab5d89436040518163ffffffff1660e01b815260040160206040518083038186803b15801561149c57600080fd5b505afa1580156114b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114d49190611973565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b03166380648b026040518163ffffffff1660e01b815260040160206040518083038186803b15801561153957600080fd5b505afa15801561154d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115719190611973565b6001600160a01b03161491505090565b600061158d84846116f3565b9091149392505050565b60008080806115a8858701876119ad565b9194509250905060006115bd61010085611906565b905060006115cd61010086611a7a565b60008a815260036020908152604080832086845290915290205490915080821c6001161561163d5760405162461bcd60e51b815260206004820152601760248201527f4d65737361676520616c72656164792072656c617965640000000000000000006044820152606401610523565b60008a81526003602090815260408083208684529091528082206001851b841790555187918c917f7f2ae957b8ae493c532b836f8a7e17178d402b24829677739558336424ae335f9190a3846001600160a01b0316846040516116a09190611a8e565b6000604051808303816000865af19150503d80600081146116dd576040519150601f19603f3d011682016040523d82523d6000602084013e6116e2565b606091505b50909b9a5050505050505050505050565b815160009060208111156117395760405162461bcd60e51b815260206004820152600d60248201526c24b73b30b634b210283937b7b360991b6044820152606401610523565b8260005b828110156117a257600086828151811061175957611759611ac9565b602002602001015190508281111561177f5782600052806020526040600020925061178f565b8060005282602052604060002092505b508061179a81611adf565b91505061173d565b50949350505050565b6000602082840312156117bd57600080fd5b5035919050565b600080604083850312156117d757600080fd5b50508035926020909101359150565b60008083601f8401126117f857600080fd5b50813567ffffffffffffffff81111561181057600080fd5b60208301915083602082850101111561182857600080fd5b9250929050565b60008060008060006060868803121561184757600080fd5b85359450602086013567ffffffffffffffff8082111561186657600080fd5b818801915088601f83011261187a57600080fd5b81358181111561188957600080fd5b8960208260051b850101111561189e57600080fd5b6020830196508095505060408801359150808211156118bc57600080fd5b506118c9888289016117e6565b969995985093965092949392505050565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082611915576119156118da565b500490565b6000821982111561192d5761192d6118f0565b500190565b8183823760009101908152919050565b60006020828403121561195457600080fd5b5051919050565b6001600160a01b038116811461197057600080fd5b50565b60006020828403121561198557600080fd5b81516119908161195b565b9392505050565b634e487b7160e01b600052604160045260246000fd5b6000806000606084860312156119c257600080fd5b8335925060208401356119d48161195b565b9150604084013567ffffffffffffffff808211156119f157600080fd5b818601915086601f830112611a0557600080fd5b813581811115611a1757611a17611997565b604051601f8201601f19908116603f01168101908382118183101715611a3f57611a3f611997565b81604052828152896020848701011115611a5857600080fd5b8260208601602083013760006020848301015280955050505050509250925092565b600082611a8957611a896118da565b500690565b6000825160005b81811015611aaf5760208186018101518583015201611a95565b81811115611abe576000828501525b509190910192915050565b634e487b7160e01b600052603260045260246000fd5b6000600019821415611af357611af36118f0565b506001019056fea2646970667358221220a56590433e0dfda6714a96a98bf4689e981841c72d850ccac75cc788553712a864736f6c63430008090033", + "devdoc": { + "kind": "dev", + "methods": { + "challenge(uint256)": { + "details": "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.", + "params": { + "_epoch": "The epoch of the claim to challenge." + } + }, + "claim(uint256,bytes32)": { + "details": "Submit a claim about the `_batchMerkleRoot` for the last completed epoch from the Fast Bridge and submit a deposit. The `_batchMerkleRoot` should match the one on the sending side otherwise the sender will lose his deposit.", + "params": { + "_batchMerkleRoot": "The batch merkle root claimed for the last completed epoch.", + "_epoch": "The epoch in which the batch to claim." + } + }, + "claimChallengePeriod(uint256)": { + "details": "Returns the `start` and `end` time of challenge period for this `epoch`.", + "params": { + "_epoch": "The epoch of the claim to request the challenge period." + }, + "returns": { + "end": "The end time of the challenge period.", + "start": "The start time of the challenge period." + } + }, + "constructor": { + "details": "Constructor.", + "params": { + "_challengePeriod": "The duration of the period allowing to challenge a claim.", + "_deposit": "The deposit amount to submit a claim in wei.", + "_epochPeriod": "The duration of each epoch.", + "_inbox": "Ethereum receiver specific: The address of the inbox contract on Ethereum.", + "_safeBridgeSender": "The address of the Safe Bridge Sender on the connecting chain." + } + }, + "verifyAndRelayMessage(uint256,bytes32[],bytes)": { + "details": "Verifies merkle proof for the given message and associated nonce for the epoch and relays the message.", + "params": { + "_epoch": "The epoch in which the message was batched by the bridge.", + "_message": "The data on the cross-domain chain for the message.", + "_proof": "The merkle proof to prove the membership of the message and nonce in the merkle tree for the epoch." + } + }, + "verifyBatch(uint256)": { + "details": "Resolves the optimistic claim for '_epoch'.", + "params": { + "_epoch": "The epoch of the optimistic claim." + } + }, + "verifySafeBatch(uint256,bytes32)": { + "details": "Resolves any challenge of the optimistic claim for '_epoch'.", + "params": { + "_batchMerkleRoot": "The true batch merkle root for the epoch.", + "_epoch": "The epoch to verify." + } + }, + "withdrawChallengeDeposit(uint256)": { + "details": "Sends the deposit back to the Challenger if their challenge is successful. Includes a portion of the Bridger's deposit.", + "params": { + "_epoch": "The epoch associated with the challenge deposit to withraw." + } + }, + "withdrawClaimDeposit(uint256)": { + "details": "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.", + "params": { + "_epoch": "The epoch associated with the claim deposit to withraw." + } + } + }, + "stateVariables": { + "challengePeriod": { + "details": "Returns the challenge period." + }, + "epochPeriod": { + "details": "Returns the epoch period." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "verifySafeBatch(uint256,bytes32)": { + "notice": "Note: Access restricted to the Safe Bridge." + } + }, + "notice": "Fast Receiver On Ethereum Counterpart of `FastSenderFromArbitrum`", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 10588, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "fastInbox", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_uint256,t_bytes32)" + }, + { + "astId": 10593, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "claims", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_uint256,t_struct(Claim)10567_storage)" + }, + { + "astId": 10598, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "challenges", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_uint256,t_struct(Challenge)10574_storage)" + }, + { + "astId": 10604, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "relayed", + "offset": 0, + "slot": "3", + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_bytes32))" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_mapping(t_uint256,t_bytes32)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => bytes32)", + "numberOfBytes": "32", + "value": "t_bytes32" + }, + "t_mapping(t_uint256,t_mapping(t_uint256,t_bytes32))": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => mapping(uint256 => bytes32))", + "numberOfBytes": "32", + "value": "t_mapping(t_uint256,t_bytes32)" + }, + "t_mapping(t_uint256,t_struct(Challenge)10574_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct FastBridgeReceiverOnEthereum.Challenge)", + "numberOfBytes": "32", + "value": "t_struct(Challenge)10574_storage" + }, + "t_mapping(t_uint256,t_struct(Claim)10567_storage)": { + "encoding": "mapping", + "key": "t_uint256", + "label": "mapping(uint256 => struct FastBridgeReceiverOnEthereum.Claim)", + "numberOfBytes": "32", + "value": "t_struct(Claim)10567_storage" + }, + "t_struct(Challenge)10574_storage": { + "encoding": "inplace", + "label": "struct FastBridgeReceiverOnEthereum.Challenge", + "members": [ + { + "astId": 10569, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "challenger", + "offset": 0, + "slot": "0", + "type": "t_address" + }, + { + "astId": 10571, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "honest", + "offset": 20, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 10573, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "depositAndRewardWithdrawn", + "offset": 21, + "slot": "0", + "type": "t_bool" + } + ], + "numberOfBytes": "32" + }, + "t_struct(Claim)10567_storage": { + "encoding": "inplace", + "label": "struct FastBridgeReceiverOnEthereum.Claim", + "members": [ + { + "astId": 10556, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "batchMerkleRoot", + "offset": 0, + "slot": "0", + "type": "t_bytes32" + }, + { + "astId": 10558, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "bridger", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 10560, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "timestamp", + "offset": 20, + "slot": "1", + "type": "t_uint32" + }, + { + "astId": 10562, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "honest", + "offset": 24, + "slot": "1", + "type": "t_bool" + }, + { + "astId": 10564, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "verificationAttempted", + "offset": 25, + "slot": "1", + "type": "t_bool" + }, + { + "astId": 10566, + "contract": "src/bridge/FastBridgeReceiverOnEthereum.sol:FastBridgeReceiverOnEthereum", + "label": "depositAndRewardWithdrawn", + "offset": 26, + "slot": "1", + "type": "t_bool" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint32": { + "encoding": "inplace", + "label": "uint32", + "numberOfBytes": "4" + } + } + } +} diff --git a/contracts/deployments/rinkeby/ForeignGateway.json b/contracts/deployments/rinkeby/ForeignGateway.json deleted file mode 100644 index 943cbac36..000000000 --- a/contracts/deployments/rinkeby/ForeignGateway.json +++ /dev/null @@ -1,563 +0,0 @@ -{ - "address": "0xf02733d9e5CbfE67B54F165b0277E1995106D526", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_governor", - "type": "address" - }, - { - "internalType": "contract IFastBridgeReceiver", - "name": "_fastbridge", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "_feeForJuror", - "type": "uint256[]" - }, - { - "internalType": "address", - "name": "_homeGateway", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_homeChainID", - "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": "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" - }, - { - "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": [], - "name": "chainID", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint96", - "name": "_subcourtID", - "type": "uint96" - }, - { - "internalType": "uint256", - "name": "_feeForJuror", - "type": "uint256" - } - ], - "name": "changeSubcourtJurorFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_choices", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_extraData", - "type": "bytes" - } - ], - "name": "createDispute", - "outputs": [ - { - "internalType": "uint256", - "name": "disputeID", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "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": "fastbridge", - "outputs": [ - { - "internalType": "contract IFastBridgeReceiver", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "governor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "homeChainID", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "homeGateway", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "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": [ - { - "internalType": "bytes32", - "name": "_disputeHash", - "type": "bytes32" - } - ], - "name": "withdrawFees", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "transactionHash": "0x753a229ddbd008b59a418de840909137f658f38943d62e7bf4f9b8bc28617fe2", - "receipt": { - "to": null, - "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "contractAddress": "0xf02733d9e5CbfE67B54F165b0277E1995106D526", - "transactionIndex": 25, - "gasUsed": "946391", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb23f10e1a9fea1fcf5602c0e133ff739bd0c51fe1cae20e5550c84a37883f3e0", - "transactionHash": "0x753a229ddbd008b59a418de840909137f658f38943d62e7bf4f9b8bc28617fe2", - "logs": [], - "blockNumber": 10190112, - "cumulativeGasUsed": "5563687", - "status": 1, - "byzantium": true - }, - "args": [ - "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", - "0xD78DCddE2C5a2Bd4BB246Bc7dB6994b95f7c442C", - [ - "1000", - "10000" - ], - "0x2Aa1f82d363f79c1E7a4CcF955Fb7E4306b9B260", - "0x0000000000000000000000000000000000000000000000000000000000066eeb" - ], - "numDeployments": 1, - "solcInputHash": "0a1ec2a631b00a23a4a92b2eaceb36a5", - "metadata": "{\"compiler\":{\"version\":\"0.8.10+commit.fc410830\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"},{\"internalType\":\"contract IFastBridgeReceiver\",\"name\":\"_fastbridge\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"_feeForJuror\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"_homeGateway\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_homeChainID\",\"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\":\"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\"},{\"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\":[],\"name\":\"chainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint96\",\"name\":\"_subcourtID\",\"type\":\"uint96\"},{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"changeSubcourtJurorFee\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"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\":\"fastbridge\",\"outputs\":[{\"internalType\":\"contract IFastBridgeReceiver\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"governor\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"homeChainID\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"homeGateway\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"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\":[{\"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.\"}},\"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.\"}},\"createDispute(uint256,bytes)\":{\"details\":\"Create a dispute. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_choices\":\"Amount of choices the arbitrator can make in this dispute.\",\"_extraData\":\"Can be used to give additional info on the dispute to be created.\"},\"returns\":{\"disputeID\":\"ID of the dispute created.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"relayRule(bytes32,uint256,address)\":{\"notice\":\"Relay the rule call from the home gateway to the arbitrable.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/gateway/ForeignGateway.sol\":\"ForeignGateway\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"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/bridge/interfaces/IFastBridgeReceiver.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\ninterface IFastBridgeReceiver {\\n function claim(bytes32 _messageHash) external payable;\\n\\n function verifyAndRelay(bytes32 _messageHash, bytes memory _calldata) external;\\n\\n function withdrawClaimDeposit(bytes32 _messageHash) external;\\n\\n function claimDeposit() external view returns (uint256 amount);\\n}\\n\",\"keccak256\":\"0x1d7f6a6ed2c2b88f51833cba6091c57a43af2915a265395ad11aad08b1f7285d\",\"license\":\"MIT\"},\"src/gateway/ForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\n/**\\n * @authors: [@shalzz]\\n * @reviewers: []\\n * @auditors: []\\n * @bounties: []\\n * @deployments: []\\n */\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../arbitration/IArbitrable.sol\\\";\\nimport \\\"../bridge/interfaces/IFastBridgeReceiver.sol\\\";\\n\\nimport \\\"./interfaces/IForeignGateway.sol\\\";\\n\\ncontract ForeignGateway is IForeignGateway {\\n // The global default minimum number of jurors in a dispute.\\n uint256 public constant MIN_JURORS = 3;\\n\\n // @dev Note the disputeID needs to start from one as\\n // the KlerosV1 proxy governor depends on this implementation.\\n // We now also depend on localDisputeID not being zero\\n // at any point.\\n uint256 internal localDisputeID = 1;\\n\\n // feeForJuror by subcourtID\\n uint256[] internal feeForJuror;\\n uint256 public chainID;\\n uint256 public homeChainID;\\n\\n struct DisputeData {\\n uint248 id;\\n bool ruled;\\n address arbitrable;\\n uint256 paid;\\n address relayer;\\n }\\n mapping(bytes32 => DisputeData) public disputeHashtoDisputeData;\\n\\n address public governor;\\n IFastBridgeReceiver public fastbridge;\\n address public homeGateway;\\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 modifier onlyFromFastBridge() {\\n require(address(fastbridge) == msg.sender, \\\"Access not allowed: Fast Bridge only.\\\");\\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 _fastbridge,\\n uint256[] memory _feeForJuror,\\n address _homeGateway,\\n uint256 _homeChainID\\n ) {\\n governor = _governor;\\n fastbridge = _fastbridge;\\n feeForJuror = _feeForJuror;\\n homeGateway = _homeGateway;\\n homeChainID = _homeChainID;\\n\\n assembly {\\n sstore(chainID.slot, chainid())\\n }\\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 feeForJuror[_subcourtID] = _feeForJuror;\\n }\\n\\n function createDispute(uint256 _choices, bytes calldata _extraData) external payable returns (uint256 disputeID) {\\n require(msg.value >= arbitrationCost(_extraData), \\\"Not paid enough for arbitration\\\");\\n\\n (uint96 subcourtID, ) = extraDataToSubcourtIDMinJurors(_extraData);\\n uint256 nbVotes = msg.value / feeForJuror[subcourtID];\\n\\n disputeID = localDisputeID++;\\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 // TODO: actual arbitration Cost\\n // nbVotes * feeForJuror[subcourtID] // we calculate the min amount required for nbVotes\\n )\\n );\\n\\n disputeHashtoDisputeData[disputeHash] = DisputeData({\\n id: uint248(disputeID),\\n arbitrable: msg.sender,\\n paid: msg.value,\\n relayer: address(0),\\n ruled: false\\n });\\n\\n emit 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 returns (uint256 cost) {\\n (uint96 subcourtID, uint256 minJurors) = extraDataToSubcourtIDMinJurors(_extraData);\\n\\n cost = feeForJuror[subcourtID] * minJurors;\\n }\\n\\n /**\\n * Relay the rule call from the home gateway to the arbitrable.\\n */\\n function relayRule(\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _relayer\\n ) external onlyFromFastBridge {\\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 {\\n DisputeData storage dispute = disputeHashtoDisputeData[_disputeHash];\\n require(dispute.id != 0, \\\"Dispute does not exist\\\");\\n require(dispute.ruled, \\\"Not ruled yet\\\");\\n\\n uint256 amount = dispute.paid;\\n dispute.paid = 0;\\n payable(dispute.relayer).transfer(amount);\\n }\\n\\n function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256) {\\n return disputeHashtoDisputeData[_disputeHash].id;\\n }\\n\\n function extraDataToSubcourtIDMinJurors(bytes memory _extraData)\\n internal\\n view\\n returns (uint96 subcourtID, uint256 minJurors)\\n {\\n // Note that here we ignore DisputeKitID\\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 >= feeForJuror.length) subcourtID = 0;\\n if (minJurors == 0) minJurors = MIN_JURORS;\\n } else {\\n subcourtID = 0;\\n minJurors = MIN_JURORS;\\n }\\n }\\n}\\n\",\"keccak256\":\"0xce68be8c82fe08b2b9f0361f549b4f022140209a22d66ab0c3f86b8062940c82\",\"license\":\"MIT\"},\"src/gateway/interfaces/IForeignGateway.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../arbitration/IArbitrator.sol\\\";\\n\\ninterface IForeignGateway is IArbitrator {\\n function chainID() external view returns (uint256);\\n\\n /**\\n * Relay the rule call from the home gateway to the arbitrable.\\n */\\n function relayRule(\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _forwarder\\n ) external;\\n\\n function withdrawFees(bytes32 _disputeHash) external;\\n\\n // For cross-chain Evidence standard\\n\\n function disputeHashToForeignID(bytes32 _disputeHash) external view returns (uint256);\\n\\n function homeChainID() external view returns (uint256);\\n\\n function homeGateway() external view returns (address);\\n}\\n\",\"keccak256\":\"0x9142bf9265b4399468f833c69e2f72896103e63f643ca186c9000424c2aa100a\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405260016000553480156200001657600080fd5b5060405162000ed238038062000ed2833981016040819052620000399162000158565b600580546001600160a01b038088166001600160a01b031992831617909255600680549287169290911691909117905582516200007e906001906020860190620000b0565b50600780546001600160a01b0319166001600160a01b039390931692909217909155600355505046600255506200026c565b828054828255906000526020600020908101928215620000ee579160200282015b82811115620000ee578251825591602001919060010190620000d1565b50620000fc92915062000100565b5090565b5b80821115620000fc576000815560010162000101565b6001600160a01b03811681146200012d57600080fd5b50565b80516200013d8162000117565b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a086880312156200017157600080fd5b85516200017e8162000117565b80955050602080870151620001938162000117565b60408801519095506001600160401b0380821115620001b157600080fd5b818901915089601f830112620001c657600080fd5b815181811115620001db57620001db62000142565b8060051b604051601f19603f8301168101818110858211171562000203576200020362000142565b60405291825284820192508381018501918c8311156200022257600080fd5b938501935b82851015620002425784518452938501939285019262000227565b809850505050505050620002596060870162000130565b9150608086015190509295509295909350565b610c56806200027c6000396000f3fe6080604052600436106100c25760003560e01c8063adc879e91161007f578063d3c617ff11610059578063d3c617ff14610209578063eaff425a146102ab578063ebb71194146102c0578063f7434ea9146102e057600080fd5b8063adc879e9146101c0578063c13517e1146101d6578063d1d559c5146101e957600080fd5b80630c340a24146100c75780631fc6b556146101045780632e1db89014610128578063349698791461015e5780634d53c2a51461018057806359354c77146101a0575b600080fd5b3480156100d357600080fd5b506005546100e7906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561011057600080fd5b5061011a60035481565b6040519081526020016100fb565b34801561013457600080fd5b5061011a610143366004610956565b6000908152600460205260409020546001600160f81b031690565b34801561016a57600080fd5b5061017e61017936600461096f565b610300565b005b34801561018c57600080fd5b506007546100e7906001600160a01b031681565b3480156101ac57600080fd5b5061017e6101bb3660046109b4565b6104b7565b3480156101cc57600080fd5b5061011a60025481565b61011a6101e4366004610a35565b610549565b3480156101f557600080fd5b506006546100e7906001600160a01b031681565b34801561021557600080fd5b5061026d610224366004610956565b60046020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a0016100fb565b3480156102b757600080fd5b5061011a600381565b3480156102cc57600080fd5b5061017e6102db366004610956565b610795565b3480156102ec57600080fd5b5061011a6102fb366004610a81565b61088a565b6006546001600160a01b0316331461036d5760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2046617374204272696467652060448201526437b7363c9760d91b60648201526084015b60405180910390fd5b600083815260046020526040902080546001600160f81b03166103cb5760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b6044820152606401610364565b8054600160f81b900460ff16156104185760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b6044820152606401610364565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038581166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018690521690819063311a6c5690604401600060405180830381600087803b15801561049857600080fd5b505af11580156104ac573d6000803e3d6000fd5b505050505050505050565b6005546001600160a01b0316331461051c5760405162461bcd60e51b815260206004820152602260248201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6044820152613c9760f11b6064820152608401610364565b806001836001600160601b03168154811061053957610539610ac3565b6000918252602090912001555050565b6000610555838361088a565b3410156105a45760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e006044820152606401610364565b60006105e584848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061090d92505050565b50905060006001826001600160601b03168154811061060657610606610ac3565b90600052602060002001543461061c9190610aef565b600080549192508061062d83610b11565b91905055925060006002546001436106459190610b2c565b4085898989336040516020016106619796959493929190610b43565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b038089168552600085840181815233878701908152346060890190815260808901848152868552600490975296909220965190511515600160f81b02921691909117855551600185810180546001600160a01b039384166001600160a01b031991821617909155945160028701559251600390950180549590911694909316939093179091559091507f0d14de2c628befa6eb7dc5c0b952832c96822914f589200f72acb5d88699824690829061073d9043610b2c565b40868a8a8a336040516107569796959493929190610ba3565b60405180910390a1604051339085907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a35050509392505050565b600081815260046020526040902080546001600160f81b03166107f35760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b6044820152606401610364565b8054600160f81b900460ff1661083b5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b6044820152606401610364565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f19350505050158015610884573d6000803e3d6000fd5b50505050565b60008060006108ce85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061090d92505050565b91509150806001836001600160601b0316815481106108ef576108ef610ac3565b90600052602060002001546109049190610c01565b95945050505050565b600080604083511061094a575050602081015160408201516001546001600160601b0383161061093c57600091505b80610945575060035b915091565b50600090506003915091565b60006020828403121561096857600080fd5b5035919050565b60008060006060848603121561098457600080fd5b833592506020840135915060408401356001600160a01b03811681146109a957600080fd5b809150509250925092565b600080604083850312156109c757600080fd5b82356001600160601b03811681146109de57600080fd5b946020939093013593505050565b60008083601f8401126109fe57600080fd5b50813567ffffffffffffffff811115610a1657600080fd5b602083019150836020828501011115610a2e57600080fd5b9250929050565b600080600060408486031215610a4a57600080fd5b83359250602084013567ffffffffffffffff811115610a6857600080fd5b610a74868287016109ec565b9497909650939450505050565b60008060208385031215610a9457600080fd5b823567ffffffffffffffff811115610aab57600080fd5b610ab7858286016109ec565b90969095509350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082610b0c57634e487b7160e01b600052601260045260246000fd5b500490565b6000600019821415610b2557610b25610ad9565b5060010190565b600082821015610b3e57610b3e610ad9565b500390565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b87815286602082015285604082015284606082015260c060808201528260c0820152828460e0830137600081840160e0908101919091526001600160a01b039290921660a0820152601f909201601f19169091010195945050505050565b6000816000190483118215151615610c1b57610c1b610ad9565b50029056fea264697066735822122030062d64f772d29638f563564e2f95fd618feffca8f904764e78cd95f09c137c64736f6c634300080a0033", - "deployedBytecode": "0x6080604052600436106100c25760003560e01c8063adc879e91161007f578063d3c617ff11610059578063d3c617ff14610209578063eaff425a146102ab578063ebb71194146102c0578063f7434ea9146102e057600080fd5b8063adc879e9146101c0578063c13517e1146101d6578063d1d559c5146101e957600080fd5b80630c340a24146100c75780631fc6b556146101045780632e1db89014610128578063349698791461015e5780634d53c2a51461018057806359354c77146101a0575b600080fd5b3480156100d357600080fd5b506005546100e7906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561011057600080fd5b5061011a60035481565b6040519081526020016100fb565b34801561013457600080fd5b5061011a610143366004610956565b6000908152600460205260409020546001600160f81b031690565b34801561016a57600080fd5b5061017e61017936600461096f565b610300565b005b34801561018c57600080fd5b506007546100e7906001600160a01b031681565b3480156101ac57600080fd5b5061017e6101bb3660046109b4565b6104b7565b3480156101cc57600080fd5b5061011a60025481565b61011a6101e4366004610a35565b610549565b3480156101f557600080fd5b506006546100e7906001600160a01b031681565b34801561021557600080fd5b5061026d610224366004610956565b60046020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a0016100fb565b3480156102b757600080fd5b5061011a600381565b3480156102cc57600080fd5b5061017e6102db366004610956565b610795565b3480156102ec57600080fd5b5061011a6102fb366004610a81565b61088a565b6006546001600160a01b0316331461036d5760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2046617374204272696467652060448201526437b7363c9760d91b60648201526084015b60405180910390fd5b600083815260046020526040902080546001600160f81b03166103cb5760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b6044820152606401610364565b8054600160f81b900460ff16156104185760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b6044820152606401610364565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038581166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018690521690819063311a6c5690604401600060405180830381600087803b15801561049857600080fd5b505af11580156104ac573d6000803e3d6000fd5b505050505050505050565b6005546001600160a01b0316331461051c5760405162461bcd60e51b815260206004820152602260248201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6044820152613c9760f11b6064820152608401610364565b806001836001600160601b03168154811061053957610539610ac3565b6000918252602090912001555050565b6000610555838361088a565b3410156105a45760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e006044820152606401610364565b60006105e584848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061090d92505050565b50905060006001826001600160601b03168154811061060657610606610ac3565b90600052602060002001543461061c9190610aef565b600080549192508061062d83610b11565b91905055925060006002546001436106459190610b2c565b4085898989336040516020016106619796959493929190610b43565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b038089168552600085840181815233878701908152346060890190815260808901848152868552600490975296909220965190511515600160f81b02921691909117855551600185810180546001600160a01b039384166001600160a01b031991821617909155945160028701559251600390950180549590911694909316939093179091559091507f0d14de2c628befa6eb7dc5c0b952832c96822914f589200f72acb5d88699824690829061073d9043610b2c565b40868a8a8a336040516107569796959493929190610ba3565b60405180910390a1604051339085907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a35050509392505050565b600081815260046020526040902080546001600160f81b03166107f35760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b6044820152606401610364565b8054600160f81b900460ff1661083b5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b6044820152606401610364565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f19350505050158015610884573d6000803e3d6000fd5b50505050565b60008060006108ce85858080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061090d92505050565b91509150806001836001600160601b0316815481106108ef576108ef610ac3565b90600052602060002001546109049190610c01565b95945050505050565b600080604083511061094a575050602081015160408201516001546001600160601b0383161061093c57600091505b80610945575060035b915091565b50600090506003915091565b60006020828403121561096857600080fd5b5035919050565b60008060006060848603121561098457600080fd5b833592506020840135915060408401356001600160a01b03811681146109a957600080fd5b809150509250925092565b600080604083850312156109c757600080fd5b82356001600160601b03811681146109de57600080fd5b946020939093013593505050565b60008083601f8401126109fe57600080fd5b50813567ffffffffffffffff811115610a1657600080fd5b602083019150836020828501011115610a2e57600080fd5b9250929050565b600080600060408486031215610a4a57600080fd5b83359250602084013567ffffffffffffffff811115610a6857600080fd5b610a74868287016109ec565b9497909650939450505050565b60008060208385031215610a9457600080fd5b823567ffffffffffffffff811115610aab57600080fd5b610ab7858286016109ec565b90969095509350505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600082610b0c57634e487b7160e01b600052601260045260246000fd5b500490565b6000600019821415610b2557610b25610ad9565b5060010190565b600082821015610b3e57610b3e610ad9565b500390565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b87815286602082015285604082015284606082015260c060808201528260c0820152828460e0830137600081840160e0908101919091526001600160a01b039290921660a0820152601f909201601f19169091010195945050505050565b6000816000190483118215151615610c1b57610c1b610ad9565b50029056fea264697066735822122030062d64f772d29638f563564e2f95fd618feffca8f904764e78cd95f09c137c64736f6c634300080a0033", - "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." - } - }, - "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." - } - }, - "createDispute(uint256,bytes)": { - "details": "Create a dispute. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", - "params": { - "_choices": "Amount of choices the arbitrator can make in this dispute.", - "_extraData": "Can be used to give additional info on the dispute to be created." - }, - "returns": { - "disputeID": "ID of the dispute created." - } - } - }, - "version": 1 - }, - "userdoc": { - "kind": "user", - "methods": { - "relayRule(bytes32,uint256,address)": { - "notice": "Relay the rule call from the home gateway to the arbitrable." - } - }, - "version": 1 - }, - "storageLayout": { - "storage": [ - { - "astId": 10620, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "localDisputeID", - "offset": 0, - "slot": "0", - "type": "t_uint256" - }, - { - "astId": 10623, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "feeForJuror", - "offset": 0, - "slot": "1", - "type": "t_array(t_uint256)dyn_storage" - }, - { - "astId": 10625, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "chainID", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 10627, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "homeChainID", - "offset": 0, - "slot": "3", - "type": "t_uint256" - }, - { - "astId": 10643, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "disputeHashtoDisputeData", - "offset": 0, - "slot": "4", - "type": "t_mapping(t_bytes32,t_struct(DisputeData)10638_storage)" - }, - { - "astId": 10645, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "governor", - "offset": 0, - "slot": "5", - "type": "t_address" - }, - { - "astId": 10648, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "fastbridge", - "offset": 0, - "slot": "6", - "type": "t_contract(IFastBridgeReceiver)8483" - }, - { - "astId": 10650, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "homeGateway", - "offset": 0, - "slot": "7", - "type": "t_address" - } - ], - "types": { - "t_address": { - "encoding": "inplace", - "label": "address", - "numberOfBytes": "20" - }, - "t_array(t_uint256)dyn_storage": { - "base": "t_uint256", - "encoding": "dynamic_array", - "label": "uint256[]", - "numberOfBytes": "32" - }, - "t_bool": { - "encoding": "inplace", - "label": "bool", - "numberOfBytes": "1" - }, - "t_bytes32": { - "encoding": "inplace", - "label": "bytes32", - "numberOfBytes": "32" - }, - "t_contract(IFastBridgeReceiver)8483": { - "encoding": "inplace", - "label": "contract IFastBridgeReceiver", - "numberOfBytes": "20" - }, - "t_mapping(t_bytes32,t_struct(DisputeData)10638_storage)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => struct ForeignGateway.DisputeData)", - "numberOfBytes": "32", - "value": "t_struct(DisputeData)10638_storage" - }, - "t_struct(DisputeData)10638_storage": { - "encoding": "inplace", - "label": "struct ForeignGateway.DisputeData", - "members": [ - { - "astId": 10629, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "id", - "offset": 0, - "slot": "0", - "type": "t_uint248" - }, - { - "astId": 10631, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "ruled", - "offset": 31, - "slot": "0", - "type": "t_bool" - }, - { - "astId": 10633, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "arbitrable", - "offset": 0, - "slot": "1", - "type": "t_address" - }, - { - "astId": 10635, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "paid", - "offset": 0, - "slot": "2", - "type": "t_uint256" - }, - { - "astId": 10637, - "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", - "label": "relayer", - "offset": 0, - "slot": "3", - "type": "t_address" - } - ], - "numberOfBytes": "128" - }, - "t_uint248": { - "encoding": "inplace", - "label": "uint248", - "numberOfBytes": "31" - }, - "t_uint256": { - "encoding": "inplace", - "label": "uint256", - "numberOfBytes": "32" - } - } - } -} diff --git a/contracts/deployments/rinkeby/ForeignGatewayOnEthereum.json b/contracts/deployments/rinkeby/ForeignGatewayOnEthereum.json new file mode 100644 index 000000000..c933d99ce --- /dev/null +++ b/contracts/deployments/rinkeby/ForeignGatewayOnEthereum.json @@ -0,0 +1,617 @@ +{ + "address": "0x8681CE0CA5706Cf4732d9060e8eC9f865F7d546a", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_governor", + "type": "address" + }, + { + "internalType": "contract IFastBridgeReceiver", + "name": "_fastBridgeReceiver", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_feeForJuror", + "type": "uint256[]" + }, + { + "internalType": "address", + "name": "_senderGateway", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_senderChainID", + "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": "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" + }, + { + "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": "contract IFastBridgeReceiver", + "name": "_fastBridgeReceiver", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_gracePeriod", + "type": "uint256" + } + ], + "name": "changeFastbridge", + "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": "uint256", + "name": "_choices", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "_extraData", + "type": "bytes" + } + ], + "name": "createDispute", + "outputs": [ + { + "internalType": "uint256", + "name": "disputeID", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_feeForJuror", + "type": "uint256" + } + ], + "name": "createSubcourtJurorFee", + "outputs": [], + "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": [], + "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": [ + { + "internalType": "bytes32", + "name": "_disputeHash", + "type": "bytes32" + } + ], + "name": "withdrawFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0x97904b817ecf2fdaa34b7307b081e385a93eaffda65d37e7bbca76f522e77ddc", + "receipt": { + "to": null, + "from": "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "contractAddress": "0x8681CE0CA5706Cf4732d9060e8eC9f865F7d546a", + "transactionIndex": 24, + "gasUsed": "994827", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x2af42246c5793b9c704bfc116c59429c77bb91b810a14e088c220fa36ab511e7", + "transactionHash": "0x97904b817ecf2fdaa34b7307b081e385a93eaffda65d37e7bbca76f522e77ddc", + "logs": [], + "blockNumber": 11233403, + "cumulativeGasUsed": "4613526", + "status": 1, + "byzantium": true + }, + "args": [ + "0xF50E77f2A2B6138D16c6c7511562E5C33c4B15A3", + "0x545C731e84c0034d58e57E476A3b7C3929d070CC", + [ + "100000000000000000" + ], + "0x4e894c2B60214beC53B60D09F39544518296C07B", + "0x0000000000000000000000000000000000000000000000000000000000066eeb" + ], + "numDeployments": 1, + "solcInputHash": "344957ae5857246fac5b346f78fc8116", + "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\":\"uint256[]\",\"name\":\"_feeForJuror\",\"type\":\"uint256[]\"},{\"internalType\":\"address\",\"name\":\"_senderGateway\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_senderChainID\",\"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\":\"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\"},{\"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\":\"contract IFastBridgeReceiver\",\"name\":\"_fastBridgeReceiver\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_gracePeriod\",\"type\":\"uint256\"}],\"name\":\"changeFastbridge\",\"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\":\"uint256\",\"name\":\"_choices\",\"type\":\"uint256\"},{\"internalType\":\"bytes\",\"name\":\"_extraData\",\"type\":\"bytes\"}],\"name\":\"createDispute\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"disputeID\",\"type\":\"uint256\"}],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_feeForJuror\",\"type\":\"uint256\"}],\"name\":\"createSubcourtJurorFee\",\"outputs\":[],\"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\":[],\"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\":[{\"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.\"}},\"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).\"}},\"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.\"}},\"createDispute(uint256,bytes)\":{\"details\":\"Create a dispute. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).\",\"params\":{\"_choices\":\"Amount of choices the arbitrator can make in this dispute.\",\"_extraData\":\"Can be used to give additional info on the dispute to be created.\"},\"returns\":{\"disputeID\":\"ID of the dispute created.\"}},\"createSubcourtJurorFee(uint256)\":{\"details\":\"Creates the `feeForJuror` property value for a new subcourt.\",\"params\":{\"_feeForJuror\":\"The new value for the `feeForJuror` property value.\"}}},\"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/ForeignGateway.sol\":\"ForeignGateway\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"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/bridge/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\"},\"src/bridge/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 \\\"../../bridge/interfaces/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\":\"0x0c4a83b87e4810d2e9798a3df3876d0708171c25757c9a2e04c0b3360c9a0d3a\",\"license\":\"MIT\"},\"src/gateway/ForeignGateway.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 \\\"./interfaces/IForeignGateway.sol\\\";\\n\\n/**\\n * Foreign Gateway\\n * Counterpart of `HomeGateway`\\n */\\ncontract ForeignGateway is IForeignGateway {\\n // ************************************* //\\n // * Enums / Structs * //\\n // ************************************* //\\n\\n struct DisputeData {\\n uint248 id;\\n bool ruled;\\n address arbitrable;\\n uint256 paid;\\n address relayer;\\n }\\n\\n // ************************************* //\\n // * Events * //\\n // ************************************* //\\n\\n event OutgoingDispute(\\n bytes32 disputeHash,\\n bytes32 blockhash,\\n uint256 localDisputeID,\\n uint256 _choices,\\n bytes _extraData,\\n address arbitrable\\n );\\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 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 uint256[] internal feeForJuror; // feeForJuror[subcourtID]\\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 uint256[] memory _feeForJuror,\\n address _senderGateway,\\n uint256 _senderChainID\\n ) {\\n governor = _governor;\\n fastBridgeReceiver = _fastBridgeReceiver;\\n feeForJuror = _feeForJuror;\\n senderGateway = _senderGateway;\\n senderChainID = _senderChainID;\\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 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 feeForJuror[_subcourtID] = _feeForJuror;\\n }\\n\\n /**\\n * @dev Creates the `feeForJuror` property value for a new subcourt.\\n * @param _feeForJuror The new value for the `feeForJuror` property value.\\n */\\n function createSubcourtJurorFee(uint256 _feeForJuror) external onlyByGovernor {\\n feeForJuror.push(_feeForJuror);\\n }\\n\\n // ************************************* //\\n // * State Modifiers * //\\n // ************************************* //\\n\\n function createDispute(uint256 _choices, bytes calldata _extraData)\\n external\\n payable\\n override\\n returns (uint256 disputeID)\\n {\\n require(msg.value >= arbitrationCost(_extraData), \\\"Not paid enough for arbitration\\\");\\n\\n disputeID = localDisputeID++;\\n uint256 chainID;\\n assembly {\\n chainID := chainid()\\n }\\n bytes32 disputeHash = keccak256(\\n abi.encodePacked(\\n 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: msg.value,\\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 subcourtID, uint256 minJurors) = extraDataToSubcourtIDMinJurors(_extraData);\\n\\n cost = feeForJuror[subcourtID] * 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 payable(dispute.relayer).transfer(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 extraDataToSubcourtIDMinJurors(bytes memory _extraData)\\n internal\\n view\\n returns (uint96 subcourtID, uint256 minJurors)\\n {\\n // Note that here we ignore DisputeKitID\\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 >= feeForJuror.length) subcourtID = 0;\\n if (minJurors == 0) minJurors = MIN_JURORS;\\n } else {\\n subcourtID = 0;\\n minJurors = MIN_JURORS;\\n }\\n }\\n}\\n\",\"keccak256\":\"0x68b4733e355a497e0f7eee6f4fb82dd8debefc6e8d0fb18ad25466993d5bd076\",\"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 \\\"../../bridge/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(\\n address _messageSender,\\n bytes32 _disputeHash,\\n uint256 _ruling,\\n address _forwarder\\n ) 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\",\"keccak256\":\"0xef24b9fbfb1afcb5cd8ac01541dab1142c34e87e723f0d3355bf80d163136b38\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60c060405260016000553480156200001657600080fd5b506040516200115838038062001158833981016040819052620000399162000142565b600280546001600160a01b038088166001600160a01b031992831617909255600380549287169290911691909117905582516200007e9060019060208601906200009a565b506001600160a01b0390911660a0526080525062000256915050565b828054828255906000526020600020908101928215620000d8579160200282015b82811115620000d8578251825591602001919060010190620000bb565b50620000e6929150620000ea565b5090565b5b80821115620000e65760008155600101620000eb565b6001600160a01b03811681146200011757600080fd5b50565b8051620001278162000101565b919050565b634e487b7160e01b600052604160045260246000fd5b600080600080600060a086880312156200015b57600080fd5b8551620001688162000101565b809550506020808701516200017d8162000101565b60408801519095506001600160401b03808211156200019b57600080fd5b818901915089601f830112620001b057600080fd5b815181811115620001c557620001c56200012c565b8060051b604051601f19603f83011681018181108582111715620001ed57620001ed6200012c565b60405291825284820192508381018501918c8311156200020c57600080fd5b938501935b828510156200022c5784518452938501939285019262000211565b80985050505050505062000243606087016200011a565b9150608086015190509295509295909350565b60805160a051610ed5620002836000396000818161026a0152610592015260006101ad0152610ed56000f3fe6080604052600436106100f35760003560e01c8063c13517e11161008a578063eaff425a11610059578063eaff425a1461034e578063ebb7119414610363578063f7434ea914610383578063f7f56752146103a357600080fd5b8063c13517e114610245578063ce0aaf9514610258578063d3c617ff1461028c578063d96a36ca1461032e57600080fd5b806359354c77116100c657806359354c77146101cf5780639ff66f64146101ef578063a60a4db514610205578063ab6f672e1461022557600080fd5b80630c340a24146100f85780632d5db96d146101355780632e1db890146101575780634def54551461019b575b600080fd5b34801561010457600080fd5b50600254610118906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014157600080fd5b50610155610150366004610b61565b6103c3565b005b34801561016357600080fd5b5061018d610172366004610b8d565b6000908152600660205260409020546001600160f81b031690565b60405190815260200161012c565b3480156101a757600080fd5b5061018d7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101db57600080fd5b506101556101ea366004610ba6565b6104b0565b3480156101fb57600080fd5b5061018d60055481565b34801561021157600080fd5b50610155610220366004610bd0565b610507565b34801561023157600080fd5b50610155610240366004610b8d565b61075c565b61018d610253366004610c63565b6107ba565b34801561026457600080fd5b506101187f000000000000000000000000000000000000000000000000000000000000000081565b34801561029857600080fd5b506102f06102a7366004610b8d565b60066020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a00161012c565b34801561033a57600080fd5b50600354610118906001600160a01b031681565b34801561035a57600080fd5b5061018d600381565b34801561036f57600080fd5b5061015561037e366004610b8d565b610988565b34801561038f57600080fd5b5061018d61039e366004610caf565b610a7d565b3480156103af57600080fd5b50600454610118906001600160a01b031681565b6002546001600160a01b031633146103f65760405162461bcd60e51b81526004016103ed90610cf1565b60405180910390fd5b80826001600160a01b031663b5b7a1846040518163ffffffff1660e01b815260040160206040518083038186803b15801561043057600080fd5b505afa158015610444573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104689190610d33565b6104729042610d62565b61047c9190610d62565b6005555060038054600480546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b031633146104da5760405162461bcd60e51b81526004016103ed90610cf1565b806001836001600160601b0316815481106104f7576104f7610d7a565b6000918252602090912001555050565b6003546001600160a01b031633148061053657506005544210801561053657506004546001600160a01b031633145b6105905760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2046617374204272696467652060448201526437b7363c9760d91b60648201526084016103ed565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146106115760405162461bcd60e51b815260206004820181905260248201527f4f6e6c792074686520686f6d656761746577617920697320616c6c6f7765642e60448201526064016103ed565b600083815260066020526040902080546001600160f81b031661066f5760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b60448201526064016103ed565b8054600160f81b900460ff16156106bc5760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b60448201526064016103ed565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038581166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018690521690819063311a6c5690604401600060405180830381600087803b15801561073c57600080fd5b505af1158015610750573d6000803e3d6000fd5b50505050505050505050565b6002546001600160a01b031633146107865760405162461bcd60e51b81526004016103ed90610cf1565b6001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60155565b60006107c68383610a7d565b3410156108155760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e0060448201526064016103ed565b60008054908061082483610d90565b90915550905046600081610839600143610dab565b4084888888336040516020016108559796959493929190610dc2565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b038088168552600085840181815233878701908152346060890190815260808901848152868552600690975296909220965190511515600160f81b02921691909117855551600185810180546001600160a01b039384166001600160a01b031991821617909155945160028701559251600390950180549590911694909316939093179091559091507f0d14de2c628befa6eb7dc5c0b952832c96822914f589200f72acb5d8869982469082906109319043610dab565b40858989893360405161094a9796959493929190610e22565b60405180910390a1604051339084907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350509392505050565b600081815260066020526040902080546001600160f81b03166109e65760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b60448201526064016103ed565b8054600160f81b900460ff16610a2e5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b60448201526064016103ed565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f19350505050158015610a77573d6000803e3d6000fd5b50505050565b6000806000610ac185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b0092505050565b91509150806001836001600160601b031681548110610ae257610ae2610d7a565b9060005260206000200154610af79190610e80565b95945050505050565b6000806040835110610b3d575050602081015160408201516001546001600160601b03831610610b2f57600091505b80610b38575060035b915091565b50600090506003915091565b6001600160a01b0381168114610b5e57600080fd5b50565b60008060408385031215610b7457600080fd5b8235610b7f81610b49565b946020939093013593505050565b600060208284031215610b9f57600080fd5b5035919050565b60008060408385031215610bb957600080fd5b82356001600160601b0381168114610b7f57600080fd5b60008060008060808587031215610be657600080fd5b8435610bf181610b49565b935060208501359250604085013591506060850135610c0f81610b49565b939692955090935050565b60008083601f840112610c2c57600080fd5b50813567ffffffffffffffff811115610c4457600080fd5b602083019150836020828501011115610c5c57600080fd5b9250929050565b600080600060408486031215610c7857600080fd5b83359250602084013567ffffffffffffffff811115610c9657600080fd5b610ca286828701610c1a565b9497909650939450505050565b60008060208385031215610cc257600080fd5b823567ffffffffffffffff811115610cd957600080fd5b610ce585828601610c1a565b90969095509350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600060208284031215610d4557600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610d7557610d75610d4c565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610da457610da4610d4c565b5060010190565b600082821015610dbd57610dbd610d4c565b500390565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b87815286602082015285604082015284606082015260c060808201528260c0820152828460e0830137600081840160e0908101919091526001600160a01b039290921660a0820152601f909201601f19169091010195945050505050565b6000816000190483118215151615610e9a57610e9a610d4c565b50029056fea264697066735822122009b3af15685a53211f786283eab12089a5aef4d10948fde906e1a9ca6c4069a564736f6c63430008090033", + "deployedBytecode": "0x6080604052600436106100f35760003560e01c8063c13517e11161008a578063eaff425a11610059578063eaff425a1461034e578063ebb7119414610363578063f7434ea914610383578063f7f56752146103a357600080fd5b8063c13517e114610245578063ce0aaf9514610258578063d3c617ff1461028c578063d96a36ca1461032e57600080fd5b806359354c77116100c657806359354c77146101cf5780639ff66f64146101ef578063a60a4db514610205578063ab6f672e1461022557600080fd5b80630c340a24146100f85780632d5db96d146101355780632e1db890146101575780634def54551461019b575b600080fd5b34801561010457600080fd5b50600254610118906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014157600080fd5b50610155610150366004610b61565b6103c3565b005b34801561016357600080fd5b5061018d610172366004610b8d565b6000908152600660205260409020546001600160f81b031690565b60405190815260200161012c565b3480156101a757600080fd5b5061018d7f000000000000000000000000000000000000000000000000000000000000000081565b3480156101db57600080fd5b506101556101ea366004610ba6565b6104b0565b3480156101fb57600080fd5b5061018d60055481565b34801561021157600080fd5b50610155610220366004610bd0565b610507565b34801561023157600080fd5b50610155610240366004610b8d565b61075c565b61018d610253366004610c63565b6107ba565b34801561026457600080fd5b506101187f000000000000000000000000000000000000000000000000000000000000000081565b34801561029857600080fd5b506102f06102a7366004610b8d565b60066020526000908152604090208054600182015460028301546003909301546001600160f81b03831693600160f81b90930460ff16926001600160a01b039283169290911685565b604080516001600160f81b03909616865293151560208601526001600160a01b0392831693850193909352606084015216608082015260a00161012c565b34801561033a57600080fd5b50600354610118906001600160a01b031681565b34801561035a57600080fd5b5061018d600381565b34801561036f57600080fd5b5061015561037e366004610b8d565b610988565b34801561038f57600080fd5b5061018d61039e366004610caf565b610a7d565b3480156103af57600080fd5b50600454610118906001600160a01b031681565b6002546001600160a01b031633146103f65760405162461bcd60e51b81526004016103ed90610cf1565b60405180910390fd5b80826001600160a01b031663b5b7a1846040518163ffffffff1660e01b815260040160206040518083038186803b15801561043057600080fd5b505afa158015610444573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104689190610d33565b6104729042610d62565b61047c9190610d62565b6005555060038054600480546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b6002546001600160a01b031633146104da5760405162461bcd60e51b81526004016103ed90610cf1565b806001836001600160601b0316815481106104f7576104f7610d7a565b6000918252602090912001555050565b6003546001600160a01b031633148061053657506005544210801561053657506004546001600160a01b031633145b6105905760405162461bcd60e51b815260206004820152602560248201527f416363657373206e6f7420616c6c6f7765643a2046617374204272696467652060448201526437b7363c9760d91b60648201526084016103ed565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316846001600160a01b0316146106115760405162461bcd60e51b815260206004820181905260248201527f4f6e6c792074686520686f6d656761746577617920697320616c6c6f7765642e60448201526064016103ed565b600083815260066020526040902080546001600160f81b031661066f5760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b60448201526064016103ed565b8054600160f81b900460ff16156106bc5760405162461bcd60e51b815260206004820152601160248201527043616e6e6f742072756c6520747769636560781b60448201526064016103ed565b80546001600160f81b0316600160f81b811782556003820180546001600160a01b038581166001600160a01b031990921691909117909155600183015460405163188d362b60e11b81526004810193909352602483018690521690819063311a6c5690604401600060405180830381600087803b15801561073c57600080fd5b505af1158015610750573d6000803e3d6000fd5b50505050505050505050565b6002546001600160a01b031633146107865760405162461bcd60e51b81526004016103ed90610cf1565b6001805480820182556000919091527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf60155565b60006107c68383610a7d565b3410156108155760405162461bcd60e51b815260206004820152601f60248201527f4e6f74207061696420656e6f75676820666f72206172626974726174696f6e0060448201526064016103ed565b60008054908061082483610d90565b90915550905046600081610839600143610dab565b4084888888336040516020016108559796959493929190610dc2565b60408051601f19818403018152828252805160209182012060a0840183526001600160f81b038088168552600085840181815233878701908152346060890190815260808901848152868552600690975296909220965190511515600160f81b02921691909117855551600185810180546001600160a01b039384166001600160a01b031991821617909155945160028701559251600390950180549590911694909316939093179091559091507f0d14de2c628befa6eb7dc5c0b952832c96822914f589200f72acb5d8869982469082906109319043610dab565b40858989893360405161094a9796959493929190610e22565b60405180910390a1604051339084907f141dfc18aa6a56fc816f44f0e9e2f1ebc92b15ab167770e17db5b084c10ed99590600090a350509392505050565b600081815260066020526040902080546001600160f81b03166109e65760405162461bcd60e51b8152602060048201526016602482015275111a5cdc1d5d1948191bd95cc81b9bdd08195e1a5cdd60521b60448201526064016103ed565b8054600160f81b900460ff16610a2e5760405162461bcd60e51b815260206004820152600d60248201526c139bdd081c9d5b1959081e595d609a1b60448201526064016103ed565b600281018054600091829055600383015460405191926001600160a01b039091169183156108fc0291849190818181858888f19350505050158015610a77573d6000803e3d6000fd5b50505050565b6000806000610ac185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610b0092505050565b91509150806001836001600160601b031681548110610ae257610ae2610d7a565b9060005260206000200154610af79190610e80565b95945050505050565b6000806040835110610b3d575050602081015160408201516001546001600160601b03831610610b2f57600091505b80610b38575060035b915091565b50600090506003915091565b6001600160a01b0381168114610b5e57600080fd5b50565b60008060408385031215610b7457600080fd5b8235610b7f81610b49565b946020939093013593505050565b600060208284031215610b9f57600080fd5b5035919050565b60008060408385031215610bb957600080fd5b82356001600160601b0381168114610b7f57600080fd5b60008060008060808587031215610be657600080fd5b8435610bf181610b49565b935060208501359250604085013591506060850135610c0f81610b49565b939692955090935050565b60008083601f840112610c2c57600080fd5b50813567ffffffffffffffff811115610c4457600080fd5b602083019150836020828501011115610c5c57600080fd5b9250929050565b600080600060408486031215610c7857600080fd5b83359250602084013567ffffffffffffffff811115610c9657600080fd5b610ca286828701610c1a565b9497909650939450505050565b60008060208385031215610cc257600080fd5b823567ffffffffffffffff811115610cd957600080fd5b610ce585828601610c1a565b90969095509350505050565b60208082526022908201527f416363657373206e6f7420616c6c6f7765643a20476f7665726e6f72206f6e6c6040820152613c9760f11b606082015260800190565b600060208284031215610d4557600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008219821115610d7557610d75610d4c565b500190565b634e487b7160e01b600052603260045260246000fd5b6000600019821415610da457610da4610d4c565b5060010190565b600082821015610dbd57610dbd610d4c565b500390565b8781528660208201526c6372656174654469737075746560981b604082015285604d82015284606d8201528284608d83013760609190911b6bffffffffffffffffffffffff1916608d919092019081019190915260a10195945050505050565b87815286602082015285604082015284606082015260c060808201528260c0820152828460e0830137600081840160e0908101919091526001600160a01b039290921660a0820152601f909201601f19169091010195945050505050565b6000816000190483118215151615610e9a57610e9a610d4c565b50029056fea264697066735822122009b3af15685a53211f786283eab12089a5aef4d10948fde906e1a9ca6c4069a564736f6c63430008090033", + "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." + } + }, + "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)." + } + }, + "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." + } + }, + "createDispute(uint256,bytes)": { + "details": "Create a dispute. Must be called by the arbitrable contract. Must pay at least arbitrationCost(_extraData).", + "params": { + "_choices": "Amount of choices the arbitrator can make in this dispute.", + "_extraData": "Can be used to give additional info on the dispute to be created." + }, + "returns": { + "disputeID": "ID of the dispute created." + } + }, + "createSubcourtJurorFee(uint256)": { + "details": "Creates the `feeForJuror` property value for a new subcourt.", + "params": { + "_feeForJuror": "The new value for the `feeForJuror` property value." + } + } + }, + "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": 21762, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "localDisputeID", + "offset": 0, + "slot": "0", + "type": "t_uint256" + }, + { + "astId": 21765, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "feeForJuror", + "offset": 0, + "slot": "1", + "type": "t_array(t_uint256)dyn_storage" + }, + { + "astId": 21767, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "governor", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 21770, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "fastBridgeReceiver", + "offset": 0, + "slot": "3", + "type": "t_contract(IFastBridgeReceiver)16758" + }, + { + "astId": 21773, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "depreciatedFastbridge", + "offset": 0, + "slot": "4", + "type": "t_contract(IFastBridgeReceiver)16758" + }, + { + "astId": 21775, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "depreciatedFastBridgeExpiration", + "offset": 0, + "slot": "5", + "type": "t_uint256" + }, + { + "astId": 21780, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "disputeHashtoDisputeData", + "offset": 0, + "slot": "6", + "type": "t_mapping(t_bytes32,t_struct(DisputeData)21736_storage)" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)dyn_storage": { + "base": "t_uint256", + "encoding": "dynamic_array", + "label": "uint256[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IFastBridgeReceiver)16758": { + "encoding": "inplace", + "label": "contract IFastBridgeReceiver", + "numberOfBytes": "20" + }, + "t_mapping(t_bytes32,t_struct(DisputeData)21736_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct ForeignGateway.DisputeData)", + "numberOfBytes": "32", + "value": "t_struct(DisputeData)21736_storage" + }, + "t_struct(DisputeData)21736_storage": { + "encoding": "inplace", + "label": "struct ForeignGateway.DisputeData", + "members": [ + { + "astId": 21727, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "id", + "offset": 0, + "slot": "0", + "type": "t_uint248" + }, + { + "astId": 21729, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "ruled", + "offset": 31, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 21731, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "arbitrable", + "offset": 0, + "slot": "1", + "type": "t_address" + }, + { + "astId": 21733, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "paid", + "offset": 0, + "slot": "2", + "type": "t_uint256" + }, + { + "astId": 21735, + "contract": "src/gateway/ForeignGateway.sol:ForeignGateway", + "label": "relayer", + "offset": 0, + "slot": "3", + "type": "t_address" + } + ], + "numberOfBytes": "128" + }, + "t_uint248": { + "encoding": "inplace", + "label": "uint248", + "numberOfBytes": "31" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index 1a246ed37..7b577fa00 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -86,6 +86,22 @@ const config: HardhatUserConfig = { }, }, }, + arbitrumGoerli: { + chainId: 421613, + url: "https://goerli-rollup.arbitrum.io/rpc", + accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], + live: true, + saveDeployments: true, + tags: ["staging", "home", "layer2"], + companionNetworks: { + foreign: "goerli", + }, + verify: { + etherscan: { + apiKey: process.env.ARBISCAN_API_KEY, + }, + }, + }, arbitrum: { chainId: 42161, url: "https://arb1.arbitrum.io/rpc", @@ -114,13 +130,16 @@ const config: HardhatUserConfig = { home: "arbitrumRinkeby", }, }, - kovan: { - chainId: 42, - url: `https://kovan.infura.io/v3/${process.env.INFURA_API_KEY}`, + goerli: { + chainId: 5, + url: `https://goerli.infura.io/v3/${process.env.INFURA_API_KEY}`, accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [], live: true, saveDeployments: true, tags: ["staging", "foreign", "layer1"], + companionNetworks: { + home: "arbitrumGoerli", + }, }, mainnet: { chainId: 1, diff --git a/contracts/package.json b/contracts/package.json index 3b4e07680..f0e71053d 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -7,6 +7,9 @@ "author": "Kleros", "license": "MIT", "packageManager": "yarn@3.1.0", + "engines": { + "node": ">=16.0.0" + }, "volta": { "node": "16.13.0" }, @@ -16,22 +19,24 @@ "deploy": "hardhat deploy", "deploy:staging": "run-s \"deploy --network rinkeby {@}\" \"deploy --network arbitrumRinkeby {@}\" --", "test": "TS_NODE_TRANSPILE_ONLY=1 hardhat test", + "size": "hardhat size-contracts --no-compile", "watch": "hardhat watch", "docgen": "hardhat docgen", "publish": "yarn npm publish --access public --tag $(cat package.json | jq .version)" }, "devDependencies": { + "@nomicfoundation/hardhat-chai-matchers": "^1.0.3", "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@0.3.0-beta.13", "@nomiclabs/hardhat-waffle": "^2.0.3", - "@openzeppelin/contracts": "^4.7.2", - "@tenderly/hardhat-tenderly": "^1.1.4", + "@openzeppelin/contracts": "^4.7.3", + "@tenderly/hardhat-tenderly": "^1.1.6", "@typechain/ethers-v5": "^10.0.0", "@typechain/hardhat": "^6.1.2", - "@types/chai": "^4.3.1", + "@types/chai": "^4.3.3", "@types/mocha": "^9.1.1", "@types/node": "^16", - "@typescript-eslint/eslint-plugin": "^5.31.0", - "@typescript-eslint/parser": "^5.31.0", + "@typescript-eslint/eslint-plugin": "^5.33.1", + "@typescript-eslint/parser": "^5.33.1", "chai": "^4.3.6", "chai-ethers": "^0.0.1", "dotenv": "^16.0.1", @@ -41,13 +46,14 @@ "follow-redirects": "^1.15.0", "hardhat": "^2.10.1", "hardhat-contract-sizer": "^2.6.1", - "hardhat-deploy": "^0.11.11", + "hardhat-deploy": "^0.11.12", "hardhat-deploy-ethers": "^0.3.0-beta.13", "hardhat-docgen": "^1.3.0", "hardhat-gas-reporter": "^1.0.8", "hardhat-watcher": "^2.3.0", "json-schema": "^0.4.0", "mocha": "^10.0.0", + "node-fetch": "^3.2.10", "npm-run-all": "^4.1.5", "shelljs": "^0.8.5", "solhint": "^3.3.7", diff --git a/contracts/scripts/changeRng.ts b/contracts/scripts/changeRng.ts index 41491d7ca..80b03788c 100644 --- a/contracts/scripts/changeRng.ts +++ b/contracts/scripts/changeRng.ts @@ -4,6 +4,7 @@ const { deploy, execute } = deployments; enum HomeChains { ARBITRUM_ONE = 42161, ARBITRUM_RINKEBY = 421611, + ARBITRUM_GOERLI = 421613, HARDHAT = 31337, } @@ -21,7 +22,7 @@ async function main() { const rng = await deploy("IncrementalNG", { from: deployer, - args: [6485021504514574], + args: [ethers.utils.keccak256(ethers.utils.toUtf8Bytes("Hello World!"))], log: true, skipIfAlreadyDeployed: false, // BUG: this parameter does nothing }); diff --git a/contracts/scripts/generateDeploymentsMarkdown.sh b/contracts/scripts/generateDeploymentsMarkdown.sh index d1d5a1828..40020f8d6 100755 --- a/contracts/scripts/generateDeploymentsMarkdown.sh +++ b/contracts/scripts/generateDeploymentsMarkdown.sh @@ -12,12 +12,23 @@ function generate() { #deploymentDir #explorerUrl done } -echo "### Rinkeby" +echo "#### Goerli" +echo +echo "- [PNK](https://goerli.etherscan.io/token/0xA3B02bA6E10F55fb177637917B1b472da0110CcC)" +generate "$SCRIPT_DIR/../deployments/goerli" "https://goerli.etherscan.io/address/" +echo +echo "#### Arbitrum Goerli (Nitro)" +echo +echo "- [PNK](https://goerli-rollup-explorer.arbitrum.io/token/0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610/token-transfers)" +generate "$SCRIPT_DIR/../deployments/arbitrumGoerli" "https://goerli-rollup-explorer.arbitrum.io/address/" +echo +echo +echo "#### Rinkeby - DEPRECATED" echo echo "- [PNK](https://rinkeby.etherscan.io/token/0x14aba1fa8a31a8649e8098ad067b739cc5708f30)" generate "$SCRIPT_DIR/../deployments/rinkeby" "https://rinkeby.etherscan.io/address/" echo -echo "### Arbitrum Rinkeby" +echo "#### Arbitrum Rinkeby (Classic) - DEPRECATED" echo echo "- [PNK](https://testnet.arbiscan.io/token/0x364530164a2338cdba211f72c1438eb811b5c639)" generate "$SCRIPT_DIR/../deployments/arbitrumRinkeby" "https://testnet.arbiscan.io/address/" \ No newline at end of file diff --git a/contracts/scripts/getCourtsV1.ts b/contracts/scripts/getCourtsV1.ts new file mode 100644 index 000000000..93056fdfa --- /dev/null +++ b/contracts/scripts/getCourtsV1.ts @@ -0,0 +1,56 @@ +import { BigNumber } from "ethers"; +import { ethers } from "hardhat"; +import { IKlerosLiquid } from "../typechain-types"; + +interface Court { + id: number; + parent: number; + hiddenVotes: boolean; + minStake: number; + alpha: number; + feeForJuror: number; + jurorsForCourtJump: number; + timesPerPeriod: number[]; +} + +async function main() { + const courtsV1 = (await ethers.getContractAt( + "IKlerosLiquid", + "0x988b3A538b618C7A603e1c11Ab82Cd16dbE28069" + )) as IKlerosLiquid; + + const courts: Court[] = []; + for (let courtId = 0; courtId < 24; ++courtId) { + const court: Court = await courtsV1.courts(courtId).then( + (result) => + ({ + id: courtId, + parent: result.parent.toString(), + hiddenVotes: result.hiddenVotes, + minStake: result.minStake.toString(), + alpha: result.alpha.toString(), + feeForJuror: result.feeForJuror.toString(), + jurorsForCourtJump: result.feeForJuror.toString(), + timesPerPeriod: [], + } as unknown as Court) + ); + + court.timesPerPeriod = await courtsV1.getSubcourt(courtId).then((result) => { + return result.timesPerPeriod.map((bn) => bn.toNumber()); + }); + + court.id = courtId; + + // console.log("CourtId %d -> %O", courtId, court); + + courts.push(court); + } + console.log(JSON.stringify(courts, null, "\t")); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/contracts/scripts/getPoliciesV1.ts b/contracts/scripts/getPoliciesV1.ts new file mode 100644 index 000000000..9b881629d --- /dev/null +++ b/contracts/scripts/getPoliciesV1.ts @@ -0,0 +1,42 @@ +import { ethers } from "hardhat"; +import fetch from "node-fetch"; + +interface Policy { + court: number; + uri: string; + name: string; + description: string; + summary: string; + requiredSkills: string; +} + +async function main() { + const policyRegistryV1 = await ethers.getContractAt("PolicyRegistry", "0xCf1f07713d5193FaE5c1653C9f61953D048BECe4"); + + const fetchPolicy = (url: string): Promise => { + return fetch(url).then((response) => response.json()); + }; + + const fetchPolicyUri = (court: number): Promise => { + return policyRegistryV1.policies(court); + }; + + const policies: Policy[] = []; + for (let court = 0; ; ++court) { + const uri = await fetchPolicyUri(court); + if (!uri) break; + + const policy = await fetchPolicy("https://ipfs.kleros.io" + uri); + policy.court = court; + policy.uri = uri; + policies.push(policy); + } + console.log(JSON.stringify(policies, null, "\t")); +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/contracts/scripts/populateCourts.ts b/contracts/scripts/populateCourts.ts new file mode 100644 index 000000000..286c03531 --- /dev/null +++ b/contracts/scripts/populateCourts.ts @@ -0,0 +1,129 @@ +import { deployments, getNamedAccounts, getChainId, ethers } from "hardhat"; +import { KlerosCore } from "../typechain-types"; +import { BigNumber } from "ethers"; +import courtsV1 from "../courts.v1.json"; + +enum HomeChains { + ARBITRUM_ONE = 42161, + ARBITRUM_RINKEBY = 421611, + ARBITRUM_GOERLI = 421613, + HARDHAT = 31337, +} + +const DISPUTE_KIT_CLASSIC = BigNumber.from(1); +const TESTING_PARAMETERS = false; + +async function main() { + // fallback to hardhat node signers on local network + const deployer = (await getNamedAccounts()).deployer ?? (await ethers.getSigners())[0].address; + + const chainId = Number(await getChainId()); + if (!HomeChains[chainId]) { + console.error(`Aborting: script is not compatible with ${chainId}`); + return; + } else { + console.log("deploying to %s with deployer %s", HomeChains[chainId], deployer); + } + + // WARNING: skip the Forking court at id 0, so the v1 courts are shifted by 1 + const courtsV2 = courtsV1.map((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, + })); + + console.log("courtsV2 = %O", courtsV2); + + const klerosCoreDeployment = await deployments.get("KlerosCore"); + const core = (await ethers.getContractAt("KlerosCore", klerosCoreDeployment.address)) as KlerosCore; + + for (const court of courtsV2) { + const subcourtPresent = await core.courts(court.id).catch(() => {}); + if (subcourtPresent) { + console.log("Subcourt %d found: %O", court.id, subcourtPresent); + + // Subcourt.parent and sortitionSumTreeK cannot be changed. + + if (subcourtPresent.hiddenVotes !== court.hiddenVotes) { + console.log( + "Subcourt %d: changing hiddenVotes from %d to %d", + court.id, + subcourtPresent.hiddenVotes, + court.hiddenVotes + ); + await core.changeSubcourtHiddenVotes(court.id, court.hiddenVotes); + } + + if (!subcourtPresent.minStake.eq(court.minStake)) { + console.log("Subcourt %d: changing minStake from %d to %d", court.id, subcourtPresent.minStake, court.minStake); + await core.changeSubcourtMinStake(court.id, court.minStake); + } + + if (!subcourtPresent.alpha.eq(court.alpha)) { + console.log("Subcourt %d: changing alpha from %d to %d", court.id, subcourtPresent.alpha, court.alpha); + await core.changeSubcourtAlpha(court.id, court.alpha); + } + + if (!subcourtPresent.feeForJuror.eq(court.feeForJuror)) { + console.log( + "Subcourt %d: changing feeForJuror from %d to %d", + court.id, + subcourtPresent.feeForJuror, + court.feeForJuror + ); + await core.changeSubcourtJurorFee(court.id, court.feeForJuror); + } + + if (!subcourtPresent.jurorsForCourtJump.eq(court.jurorsForCourtJump)) { + console.log( + "Subcourt %d: changing jurorsForCourtJump from %d to %d", + court.id, + subcourtPresent.jurorsForCourtJump, + court.jurorsForCourtJump + ); + await core.changeSubcourtJurorsForJump(court.id, court.jurorsForCourtJump); + } + + const timesPerPeriodPresent = (await core.getTimesPerPeriod(court.id)).map((bn) => bn.toNumber()); + if (!timesPerPeriodPresent.every((val, index) => val === court.timesPerPeriod[index])) { + console.log( + "Subcourt %d: changing timesPerPeriod from %O to %O", + court.id, + timesPerPeriodPresent, + court.timesPerPeriod + ); + await core.changeSubcourtTimesPerPeriod(court.id, [ + court.timesPerPeriod[0], + court.timesPerPeriod[1], + court.timesPerPeriod[2], + court.timesPerPeriod[3], + ]); + } + } else { + console.log("Subcourt %d not found, creating it with", court.id, court); + await core.createSubcourt( + court.parent, + court.hiddenVotes, + court.minStake, + court.alpha, + court.feeForJuror, + court.jurorsForCourtJump, + [court.timesPerPeriod[0], court.timesPerPeriod[1], court.timesPerPeriod[2], court.timesPerPeriod[3]], + 5, // Not accessible on-chain, but has always been set to the same value so far. + [DISPUTE_KIT_CLASSIC] + ); + } + + await new Promise((resolve) => setTimeout(resolve, 100)); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/contracts/scripts/populatePolicyRegistry.ts b/contracts/scripts/populatePolicyRegistry.ts new file mode 100644 index 000000000..0ce15ab48 --- /dev/null +++ b/contracts/scripts/populatePolicyRegistry.ts @@ -0,0 +1,44 @@ +import { deployments, getNamedAccounts, getChainId, ethers } from "hardhat"; +import { PolicyRegistry } from "../typechain-types"; +import policiesV1 from "../policies.v1.json"; + +enum HomeChains { + ARBITRUM_ONE = 42161, + ARBITRUM_RINKEBY = 421611, + ARBITRUM_GOERLI = 421613, + HARDHAT = 31337, +} + +async function main() { + // fallback to hardhat node signers on local network + const deployer = (await getNamedAccounts()).deployer ?? (await ethers.getSigners())[0].address; + + const chainId = Number(await getChainId()); + if (!HomeChains[chainId]) { + console.error(`Aborting: script is not compatible with ${chainId}`); + return; + } else { + console.log("deploying to %s with deployer %s", HomeChains[chainId], deployer); + } + + // 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 })); + + const policyRegistryDeployment = await deployments.get("PolicyRegistry"); + const policyRegistry = (await ethers.getContractAt( + "PolicyRegistry", + policyRegistryDeployment.address + )) as PolicyRegistry; + + for await (const policy of policiesV2) { + console.log("Populating policy for %s Court (%d): %s", policy.name, policy.court, policy.uri); + await policyRegistry.setPolicy(policy.court, policy.uri); + } +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/contracts/src/arbitration/KlerosCore.sol b/contracts/src/arbitration/KlerosCore.sol index 1a82de9b8..bdbb11595 100644 --- a/contracts/src/arbitration/KlerosCore.sol +++ b/contracts/src/arbitration/KlerosCore.sol @@ -33,12 +33,6 @@ contract KlerosCore is IArbitrator { execution // Tokens are redistributed and the ruling is executed. } - enum SortitionFlags { - CreateDisputeHook, // Set to true if the hook is needed after dispute creation. - PreStakeHook, // Set to true if the module requires a hook before staking. - StoreStakeValues // Set to true if staked values should be stored within the module. - } - struct Court { uint96 parent; // The parent court. bool hiddenVotes; // Whether to use commit and reveal or not. @@ -83,11 +77,6 @@ contract KlerosCore is IArbitrator { uint256 depthLevel; // How far this DK is from the root. 0 for root DK. } - struct SortitionModuleStruct { - uint256 flags; // Bitmap of flags for this sortition module. - mapping(bytes32 => bool) courtInitialized; // True if the court with this ID has been initialialized in the module. Only checked if the flag is raised. - } - // ************************************* // // * Storage * // // ************************************* // @@ -105,14 +94,12 @@ contract KlerosCore is IArbitrator { IERC20 public pinakion; // The Pinakion token contract. // TODO: interactions with jurorProsecutionModule. address public jurorProsecutionModule; // The module for juror's prosecution. + ISortitionModule public sortitionModule; // Sortition module for drawing. Court[] public courts; // The subcourts. DisputeKitNode[] public disputeKitNodes; // The list of DisputeKitNode, indexed by DisputeKitID. Dispute[] public disputes; // The disputes. - ISortitionModule[] public sortitionModules; // Stores the addresses of added modules. - mapping(ISortitionModule => SortitionModuleStruct) public sortitionModuleData; // Data of sortition modules. - mapping(IDisputeKit => ISortitionModule) public disputeKitToSortition; // Maps dispute kit to its respective sortition module. mapping(address => Juror) internal jurors; // The jurors. // ************************************* // @@ -167,7 +154,7 @@ contract KlerosCore is IArbitrator { // ************************************* // modifier onlyByGovernor() { - require(governor == msg.sender, "Access not allowed: Governor only."); + require(governor == msg.sender, "Governor only"); _; } @@ -180,8 +167,7 @@ contract KlerosCore is IArbitrator { * @param _courtParameters Numeric parameters of General court (minStake, alpha, feeForJuror and jurorsForCourtJump respectively). * @param _timesPerPeriod The `timesPerPeriod` property value of the general court. * @param _sortitionExtraData The extra data for sortition module. - * @param _sortitionModuleAddress The initial sortition module responsible for sortition of the jurors. - * @param _sortitionModuleFlags Flags for sortition module. + * @param _sortitionModuleAddress The sortition module responsible for sortition of the jurors. */ constructor( address _governor, @@ -192,8 +178,7 @@ contract KlerosCore is IArbitrator { uint256[4] memory _courtParameters, uint256[4] memory _timesPerPeriod, bytes memory _sortitionExtraData, - ISortitionModule _sortitionModuleAddress, - uint256 _sortitionModuleFlags + ISortitionModule _sortitionModuleAddress ) { governor = _governor; pinakion = _pinakion; @@ -207,7 +192,6 @@ contract KlerosCore is IArbitrator { DisputeKitNode({parent: 0, children: new uint256[](0), disputeKit: _disputeKit, depthLevel: 0}) ); emit DisputeKitCreated(DISPUTE_KIT_CLASSIC, _disputeKit, NULL_DISPUTE_KIT); - disputeKitToSortition[_disputeKit] = _sortitionModuleAddress; // FORKING_COURT // TODO: Fill the properties for the Forking court, emit SubcourtCreated. @@ -225,14 +209,9 @@ contract KlerosCore is IArbitrator { court.jurorsForCourtJump = _courtParameters[3]; court.timesPerPeriod = _timesPerPeriod; - SortitionModuleStruct storage sortitionModule = sortitionModuleData[_sortitionModuleAddress]; - sortitionModule.flags = _sortitionModuleFlags; - sortitionModules.push(_sortitionModuleAddress); + sortitionModule = _sortitionModuleAddress; - _sortitionModuleAddress.initialize(bytes32(uint256(GENERAL_COURT)), _sortitionExtraData); - - sortitionModule.courtInitialized[bytes32(uint256(FORKING_COURT))] = true; - sortitionModule.courtInitialized[bytes32(uint256(GENERAL_COURT))] = true; + sortitionModule.initialize(bytes32(uint256(GENERAL_COURT)), _sortitionExtraData); emit SubcourtCreated( 1, @@ -287,37 +266,42 @@ contract KlerosCore is IArbitrator { jurorProsecutionModule = _jurorProsecutionModule; } - /** @dev Adds new sortition module to the array. - * @param _sortitionModule The new sortition module to add. - * @param _sortitionModuleFlags Flags for sortition module. + /** @dev Changes the `_sortitionModule` storage variable. + * Note that the new module should be initialized for all courts. + * @param _sortitionModule The new value for the `sortitionModule` storage variable. */ - function addSortitionModule(ISortitionModule _sortitionModule, uint256 _sortitionModuleFlags) - external - onlyByGovernor - { - SortitionModuleStruct storage sortitionModule = sortitionModuleData[_sortitionModule]; - sortitionModule.flags = _sortitionModuleFlags; - sortitionModules.push(_sortitionModule); + function changeSortitionModule(ISortitionModule _sortitionModule) external onlyByGovernor { + sortitionModule = _sortitionModule; + } + + /** @dev Initializes sortition module for the courts. + * @param _sortitionExtraData Extra data for sortition module. + * @param _cursor Index of the court from where to start iterating. + * @param _count Number of iterations to go through. If 0, iterates until the end. + */ + function initializeSortitionModule( + bytes memory _sortitionExtraData, + uint256 _cursor, + uint256 _count + ) external onlyByGovernor { + for (uint256 i = _cursor; i < courts.length && (_count == 0 || i < _cursor + _count); i++) { + sortitionModule.initialize(bytes32(i), _sortitionExtraData); + } } /** @dev Add a new supported dispute kit module to the court. * @param _disputeKitAddress The address of the dispute kit contract. * @param _parent The ID of the parent dispute kit. It is left empty when root DK is created. - * @param _sortitionModuleAddress The address of the relevant sortition module. * Note that the root DK must be supported by the general court. */ - function addNewDisputeKit( - IDisputeKit _disputeKitAddress, - uint256 _parent, - ISortitionModule _sortitionModuleAddress - ) external onlyByGovernor { + function addNewDisputeKit(IDisputeKit _disputeKitAddress, uint256 _parent) external onlyByGovernor { uint256 disputeKitID = disputeKitNodes.length; - require(_parent < disputeKitID, "Parent doesn't exist"); + require(_parent < disputeKitID, "!Parent"); uint256 depthLevel; if (_parent != NULL_DISPUTE_KIT) { depthLevel = disputeKitNodes[_parent].depthLevel + 1; // It should be always possible to reach the root from the leaf with the defined number of search iterations. - require(depthLevel < SEARCH_ITERATIONS, "Depth level is at max"); + require(depthLevel < SEARCH_ITERATIONS, "Depth level max"); } disputeKitNodes.push( DisputeKitNode({ @@ -327,7 +311,7 @@ contract KlerosCore is IArbitrator { depthLevel: depthLevel }) ); - disputeKitToSortition[_disputeKitAddress] = _sortitionModuleAddress; + disputeKitNodes[_parent].children.push(disputeKitID); emit DisputeKitCreated(disputeKitID, _disputeKitAddress, _parent); if (_parent == NULL_DISPUTE_KIT) { @@ -358,12 +342,9 @@ contract KlerosCore is IArbitrator { bytes memory _sortitionExtraData, uint256[] memory _supportedDisputeKits ) external onlyByGovernor { - require( - courts[_parent].minStake <= _minStake, - "A subcourt cannot be a child of a subcourt with a higher minimum stake." - ); - require(_supportedDisputeKits.length > 0, "Must support at least one DK"); - require(_parent != FORKING_COURT, "Can't have Forking court as a parent"); + require(courts[_parent].minStake <= _minStake, "MinStake lower than parent court"); + require(_supportedDisputeKits.length > 0, "!Supported DK"); + require(_parent != FORKING_COURT, "Invalid: Forking court as parent"); uint256 subcourtID = courts.length; Court storage court = courts.push(); @@ -374,15 +355,6 @@ contract KlerosCore is IArbitrator { "Wrong DK index" ); court.supportedDisputeKits[_supportedDisputeKits[i]] = true; - - ISortitionModule sortitionModuleAddress = disputeKitToSortition[ - disputeKitNodes[_supportedDisputeKits[i]].disputeKit - ]; - SortitionModuleStruct storage sortitionModule = sortitionModuleData[sortitionModuleAddress]; - if (!sortitionModule.courtInitialized[bytes32(subcourtID)]) { - sortitionModuleAddress.initialize(bytes32(subcourtID), _sortitionExtraData); - sortitionModule.courtInitialized[bytes32(subcourtID)] = true; - } } court.parent = _parent; @@ -394,6 +366,8 @@ contract KlerosCore is IArbitrator { court.jurorsForCourtJump = _jurorsForCourtJump; court.timesPerPeriod = _timesPerPeriod; + sortitionModule.initialize(bytes32(subcourtID), _sortitionExtraData); + // Update the parent. courts[_parent].children.push(subcourtID); emit SubcourtCreated( @@ -414,12 +388,12 @@ contract KlerosCore is IArbitrator { * @param _minStake The new value for the `minStake` property value. */ function changeSubcourtMinStake(uint96 _subcourtID, uint256 _minStake) external onlyByGovernor { - require(_subcourtID == GENERAL_COURT || courts[courts[_subcourtID].parent].minStake <= _minStake); + require( + _subcourtID == GENERAL_COURT || courts[courts[_subcourtID].parent].minStake <= _minStake, + "MinStake lower than parent court" + ); 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." - ); + require(courts[courts[_subcourtID].children[i]].minStake >= _minStake, "MinStake lower than parent court"); } courts[_subcourtID].minStake = _minStake; @@ -457,7 +431,7 @@ contract KlerosCore is IArbitrator { * @param _subcourtID The ID of the subcourt. * @param _hiddenVotes The new value for the `hiddenVotes` property value. */ - function changeHiddenVotes(uint96 _subcourtID, bool _hiddenVotes) external onlyByGovernor { + function changeSubcourtHiddenVotes(uint96 _subcourtID, bool _hiddenVotes) external onlyByGovernor { courts[_subcourtID].hiddenVotes = _hiddenVotes; emit SubcourtModified(_subcourtID, "hiddenVotes"); } @@ -492,7 +466,7 @@ contract KlerosCore is IArbitrator { } else { require( !(_subcourtID == GENERAL_COURT && disputeKitNodes[_disputeKitIDs[i]].parent == NULL_DISPUTE_KIT), - "Can't remove root DK support from the general court" + "Can't disable Root DK in General" ); enableDisputeKit(_subcourtID, _disputeKitIDs[i], false); } @@ -517,11 +491,7 @@ contract KlerosCore is IArbitrator { uint256 _stake, uint256 _penalty ) external { - // Use courtInitialized mapping to check the validity of the caller. - require( - sortitionModuleData[ISortitionModule(msg.sender)].courtInitialized[bytes32(uint256(_subcourtID))], - "Wrong caller" - ); + require(msg.sender == address(sortitionModule), "Wrong caller"); setStakeForAccount(_account, _subcourtID, _stake, _penalty); } @@ -537,13 +507,10 @@ contract KlerosCore is IArbitrator { override returns (uint256 disputeID) { - require(msg.value >= arbitrationCost(_extraData), "Not enough ETH to cover arbitration cost."); - (uint96 subcourtID, , uint256 disputeKitID) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData); + require(msg.value >= arbitrationCost(_extraData), "ETH too low for arbitration cost"); - require( - courts[subcourtID].supportedDisputeKits[disputeKitID], - "The dispute kit is not supported by this subcourt" - ); + (uint96 subcourtID, , uint256 disputeKitID) = extraDataToSubcourtIDMinJurorsDisputeKit(_extraData); + require(courts[subcourtID].supportedDisputeKits[disputeKitID], "DK unsupported by subcourt"); disputeID = disputes.length; Dispute storage dispute = disputes.push(); @@ -559,11 +526,7 @@ contract KlerosCore is IArbitrator { round.tokensAtStakePerJuror = (court.minStake * court.alpha) / ALPHA_DIVISOR; round.totalFeesForJurors = msg.value; - uint256 sortitionFlag = 1 << uint256(SortitionFlags.CreateDisputeHook); - ISortitionModule sortitionModuleAddress = disputeKitToSortition[disputeKit]; - if (sortitionFlag & sortitionModuleData[sortitionModuleAddress].flags == sortitionFlag) { - sortitionModuleAddress.createDisputeHook(disputeID, 0); // Default round ID. - } + sortitionModule.createDisputeHook(disputeID, 0); // Default round ID. disputeKit.createDispute(disputeID, _numberOfChoices, _extraData, round.nbVotes); emit DisputeCreation(disputeID, IArbitrable(msg.sender)); @@ -582,33 +545,33 @@ contract KlerosCore is IArbitrator { require( currentRound > 0 || block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)], - "The evidence period time has not passed yet and it is not an appeal." + "Evidence not passed && !Appeal" ); - require(round.drawnJurors.length == round.nbVotes, "The dispute has not finished drawing yet."); + require(round.drawnJurors.length == round.nbVotes, "Dispute still drawing"); dispute.period = court.hiddenVotes ? Period.commit : Period.vote; } else if (dispute.period == Period.commit) { require( block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] || disputeKitNodes[round.disputeKitID].disputeKit.areCommitsAllCast(_disputeID), - "The commit period time has not passed yet." + "Commit period not passed" ); dispute.period = Period.vote; } else if (dispute.period == Period.vote) { require( block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)] || disputeKitNodes[round.disputeKitID].disputeKit.areVotesAllCast(_disputeID), - "The vote period time has not passed yet" + "Vote period not passed" ); dispute.period = Period.appeal; emit AppealPossible(_disputeID, dispute.arbitrated); } else if (dispute.period == Period.appeal) { require( block.timestamp - dispute.lastPeriodChange >= court.timesPerPeriod[uint256(dispute.period)], - "The appeal period time has not passed yet." + "Appeal period not passed" ); dispute.period = Period.execution; } else if (dispute.period == Period.execution) { - revert("The dispute is already in the last period."); + revert("Dispute period is final"); } dispute.lastPeriodChange = block.timestamp; @@ -623,7 +586,7 @@ contract KlerosCore is IArbitrator { Dispute storage dispute = disputes[_disputeID]; uint256 currentRound = dispute.rounds.length - 1; Round storage round = dispute.rounds[currentRound]; - require(dispute.period == Period.evidence, "Should be evidence period."); + require(dispute.period == Period.evidence, "!Evidence period"); IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit; @@ -635,8 +598,10 @@ contract KlerosCore is IArbitrator { if (drawnAddress != address(0)) { // In case no one has staked at the court yet. jurors[drawnAddress].lockedTokens[dispute.subcourtID] += round.tokensAtStakePerJuror; + + emit Draw(drawnAddress, _disputeID, currentRound, round.drawnJurors.length); + round.drawnJurors.push(drawnAddress); - emit Draw(drawnAddress, _disputeID, currentRound, i); } } } @@ -652,16 +617,13 @@ contract KlerosCore is IArbitrator { uint256 _numberOfChoices, bytes memory _extraData ) external payable { - require(msg.value >= appealCost(_disputeID), "Not enough ETH to cover appeal cost."); + require(msg.value >= appealCost(_disputeID), "ETH too low for appeal cost"); Dispute storage dispute = disputes[_disputeID]; - require(dispute.period == Period.appeal, "Dispute is not appealable."); + require(dispute.period == Period.appeal, "Dispute not appealable"); Round storage round = dispute.rounds[dispute.rounds.length - 1]; - require( - msg.sender == address(disputeKitNodes[round.disputeKitID].disputeKit), - "Access not allowed: Dispute Kit only." - ); + require(msg.sender == address(disputeKitNodes[round.disputeKitID].disputeKit), "Dispute Kit only"); uint96 newSubcourtID = dispute.subcourtID; uint256 newDisputeKitID = round.disputeKitID; @@ -669,7 +631,7 @@ contract KlerosCore is IArbitrator { // Warning: the extra round must be created before calling disputeKit.createDispute() Round storage extraRound = dispute.rounds.push(); - if (round.nbVotes >= courts[newDisputeKitID].jurorsForCourtJump) { + if (round.nbVotes >= courts[newSubcourtID].jurorsForCourtJump) { // Jump to parent subcourt. newSubcourtID = courts[newSubcourtID].parent; @@ -708,11 +670,7 @@ contract KlerosCore is IArbitrator { IDisputeKit disputeKit = disputeKitNodes[extraRound.disputeKitID].disputeKit; - uint256 sortitionFlag = 1 << uint256(SortitionFlags.CreateDisputeHook); - ISortitionModule sortitionModuleAddress = disputeKitToSortition[disputeKit]; - if (sortitionFlag & sortitionModuleData[sortitionModuleAddress].flags == sortitionFlag) { - sortitionModuleAddress.createDisputeHook(_disputeID, dispute.rounds.length - 1); - } + sortitionModule.createDisputeHook(_disputeID, dispute.rounds.length - 1); // Dispute kit was changed, so create a dispute in the new DK contract. if (extraRound.disputeKitID != round.disputeKitID) { @@ -735,7 +693,7 @@ contract KlerosCore is IArbitrator { uint256 _iterations ) external { Dispute storage dispute = disputes[_disputeID]; - require(dispute.period == Period.execution, "Should be execution period."); + require(dispute.period == Period.execution, "!Execution period"); Round storage round = dispute.rounds[_round]; IDisputeKit disputeKit = disputeKitNodes[round.disputeKitID].disputeKit; @@ -783,8 +741,9 @@ contract KlerosCore is IArbitrator { // Unstake the juror if he lost due to inactivity. if (!disputeKit.isVoteActive(_disputeID, _round, i)) { - for (uint256 j = 0; j < jurors[account].subcourtIDs.length; j++) { - setStakeForAccount(account, jurors[account].subcourtIDs[j], 0, 0); + uint96[] memory subcourtIDs = getJurorSubcourtIDs(account); + for (uint256 j = 0; j < subcourtIDs.length; j++) { + setStakeForAccount(account, subcourtIDs[j], 0, 0); } } emit TokenAndETHShift(account, _disputeID, -int256(penalty), 0); @@ -837,8 +796,8 @@ contract KlerosCore is IArbitrator { */ function executeRuling(uint256 _disputeID) external { Dispute storage dispute = disputes[_disputeID]; - require(dispute.period == Period.execution, "Should be execution period."); - require(!dispute.ruled, "Ruling already executed."); + require(dispute.period == Period.execution, "!Execution period"); + require(!dispute.ruled, "Ruling already executed"); uint256 winningChoice = currentRuling(_disputeID); dispute.ruled = true; @@ -920,8 +879,7 @@ contract KlerosCore is IArbitrator { uint256 disputeKitID ) { - Dispute storage dispute = disputes[_disputeID]; - Round storage round = dispute.rounds[_round]; + Round storage round = disputes[_disputeID].rounds[_round]; return ( round.tokensAtStakePerJuror, round.totalFeesForJurors, @@ -933,8 +891,7 @@ contract KlerosCore is IArbitrator { } function getNumberOfRounds(uint256 _disputeID) external view returns (uint256) { - Dispute storage dispute = disputes[_disputeID]; - return dispute.rounds.length; + return disputes[_disputeID].rounds.length; } function getJurorBalance(address _juror, uint96 _subcourtID) @@ -977,29 +934,6 @@ contract KlerosCore is IArbitrator { // * Public Views for Dispute Kits * // // ************************************* // - // TODO: some getters can be merged into a single function - - function drawAddressFromSortition(bytes32 _key, uint256 _drawnNumber) external view returns (address drawnAddress) { - ISortitionModule sortitionModuleAddress = disputeKitToSortition[IDisputeKit(msg.sender)]; - drawnAddress = sortitionModuleAddress.draw(_key, _drawnNumber); - } - - function getSubcourtID(uint256 _disputeID) external view returns (uint256 subcourtID) { - return disputes[_disputeID].subcourtID; - } - - function getCurrentPeriod(uint256 _disputeID) external view returns (Period period) { - return disputes[_disputeID].period; - } - - function areVotesHidden(uint256 _subcourtID) external view returns (bool hiddenVotes) { - return courts[_subcourtID].hiddenVotes; - } - - function isRuled(uint256 _disputeID) external view returns (bool) { - return disputes[_disputeID].ruled; - } - function getNumberOfVotes(uint256 _disputeID) external view returns (uint256) { Dispute storage dispute = disputes[_disputeID]; return dispute.rounds[dispute.rounds.length - 1].nbVotes; @@ -1009,7 +943,7 @@ contract KlerosCore is IArbitrator { * @param _disputeID The ID of the dispute. * @return Whether DK will be switched or not. */ - function isDisputeKitJumping(uint256 _disputeID) public view returns (bool) { + function isDisputeKitJumping(uint256 _disputeID) external view returns (bool) { Dispute storage dispute = disputes[_disputeID]; Round storage round = dispute.rounds[dispute.rounds.length - 1]; Court storage court = courts[dispute.subcourtID]; @@ -1036,6 +970,10 @@ contract KlerosCore is IArbitrator { return disputeKitNodes[_disputeKitID].disputeKit; } + function getJurorSubcourtIDs(address _juror) public view returns (uint96[] memory) { + return jurors[_juror].subcourtIDs; + } + // ************************************* // // * Internal * // // ************************************* // @@ -1073,29 +1011,19 @@ contract KlerosCore is IArbitrator { bytes32 stakePathID = accountAndSubcourtIDToStakePathID(_account, _subcourtID); uint256 currentStake = juror.stakedTokens[_subcourtID]; - uint256 delta; - bool plusOrMinus; // True if the stake is increasing, false otherwise if (_stake != 0) { // Check against locked tokens in case the min stake was lowered. if (_stake < courts[_subcourtID].minStake || _stake < juror.lockedTokens[_subcourtID]) return false; } - uint256 sortitionFlag = 1 << uint256(SortitionFlags.PreStakeHook); - for (uint256 i = 0; i < sortitionModules.length; i++) { - if (sortitionFlag & sortitionModuleData[sortitionModules[i]].flags == sortitionFlag) { - ISortitionModule.Result result = sortitionModules[i].preStakeHook( - _account, - _subcourtID, - _stake, - _penalty - ); - if (result == ISortitionModule.Result.False) { - return false; - } else if (result == ISortitionModule.Result.True) { - return true; - } - } + ISortitionModule.Result result = sortitionModule.preStakeHook(_account, _subcourtID, _stake, _penalty); + + // This condition will be skipped if the hook isn't triggered. + if (result == ISortitionModule.Result.False) { + return false; + } else if (result == ISortitionModule.Result.True) { + return true; } uint256 transferredAmount; @@ -1110,8 +1038,6 @@ contract KlerosCore is IArbitrator { return false; } } - plusOrMinus = true; - delta = _stake - currentStake; } else { if (_stake == 0) { // Keep locked tokens in the contract and release them after dispute is executed. @@ -1137,28 +1063,21 @@ contract KlerosCore is IArbitrator { } } } - delta = currentStake - _stake; } - // Update juror's records in the current and in parent subcourts. - sortitionFlag = 1 << uint256(SortitionFlags.StoreStakeValues); + // Update juror's records. + juror.stakedTokens[_subcourtID] = _stake; + bool finished = false; uint256 currentSubcourtID = _subcourtID; while (!finished) { - for (uint256 i = 0; i < sortitionModules.length; i++) { - if (sortitionFlag & sortitionModuleData[sortitionModules[i]].flags == sortitionFlag) { - sortitionModules[i].set(bytes32(currentSubcourtID), _stake, stakePathID); - } - } - juror.stakedTokens[uint96(currentSubcourtID)] = plusOrMinus - ? juror.stakedTokens[uint96(currentSubcourtID)] + delta - : juror.stakedTokens[uint96(currentSubcourtID)] - delta; + // Tokens are also implicitely staked in parent courts through sortition module to increase the chance of being drawn. + sortitionModule.set(bytes32(currentSubcourtID), _stake, stakePathID); if (currentSubcourtID == GENERAL_COURT) finished = true; else currentSubcourtID = courts[currentSubcourtID].parent; } emit StakeSet(_account, _subcourtID, _stake); - return true; } diff --git a/contracts/src/arbitration/PolicyRegistry.sol b/contracts/src/arbitration/PolicyRegistry.sol new file mode 100644 index 000000000..a03873dca --- /dev/null +++ b/contracts/src/arbitration/PolicyRegistry.sol @@ -0,0 +1,76 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8; + +/** + * @title PolicyRegistry + * @author Enrique Piqueras - + * @dev A contract to maintain a policy for each subcourt. + */ +contract PolicyRegistry { + // ************************************* // + // * Events * // + // ************************************* // + + /** + * @dev Emitted when a policy is updated. + * @param _subcourtID The ID of the policy's subcourt. + * @param _policy The URI of the policy JSON. + */ + event PolicyUpdate(uint256 indexed _subcourtID, string _policy); + + // ************************************* // + // * Storage * // + // ************************************* // + + address public governor; + mapping(uint256 => string) public policies; + + // ************************************* // + // * Function Modifiers * // + // ************************************* // + + /** + * @dev Requires that the sender is the governor. + */ + modifier onlyByGovernor() { + require(governor == msg.sender, "No allowed: governor only"); + _; + } + + // ************************************* // + // * Constructor * // + // ************************************* // + + /** @dev Constructs the `PolicyRegistry` contract. + * @param _governor The governor's address. + */ + constructor(address _governor) { + governor = _governor; + } + + // ************************************* // + // * Governance * // + // ************************************* // + + /** + * @dev Changes the `governor` storage variable. + * @param _governor The new value for the `governor` storage variable. + */ + function changeGovernor(address _governor) external onlyByGovernor { + governor = _governor; + } + + // ************************************* // + // * State Modifiers * // + // ************************************* // + + /** + * @dev Sets the policy for the specified subcourt. + * @param _subcourtID The ID of the specified subcourt. + * @param _policy The URI of the policy JSON. + */ + function setPolicy(uint256 _subcourtID, string calldata _policy) external onlyByGovernor { + policies[_subcourtID] = _policy; + emit PolicyUpdate(_subcourtID, policies[_subcourtID]); + } +} diff --git a/contracts/src/arbitration/arbitrables/ArbitrableExample.sol b/contracts/src/arbitration/arbitrables/ArbitrableExample.sol index b7b46bb48..4b0925f26 100644 --- a/contracts/src/arbitration/arbitrables/ArbitrableExample.sol +++ b/contracts/src/arbitration/arbitrables/ArbitrableExample.sol @@ -16,8 +16,8 @@ contract ArbitrableExample is IArbitrable, IMetaEvidence { uint256 numberOfRulingOptions; // The number of choices the arbitrator can give. } - uint256 constant META_EVIDENCE_ID = 0; - + 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]. @@ -27,8 +27,8 @@ contract ArbitrableExample is IArbitrable, IMetaEvidence { * @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); } @@ -72,4 +72,9 @@ contract ArbitrableExample is IArbitrable, IMetaEvidence { emit Ruling(IArbitrator(msg.sender), _externalDisputeID, dispute.ruling); } + + function changedMetaEvidence(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 5a9fb5b8e..13ecf6774 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitClassic.sol @@ -71,10 +71,12 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { 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. uint256 public constant LOSER_APPEAL_PERIOD_MULTIPLIER = 5000; // Multiplier of the appeal period for the choice that wasn't voted for in the previous round, in basis points. Default is 1/2 of original appeal period. uint256 public constant ONE_BASIS_POINT = 10000; // One basis point, for scaling. + uint256 public constant RNG_LOOKAHEAD = 20; // Minimum block distance between requesting and obtaining a random number. Arbitrum sequencer finality = 20 blocks. RNG public rng; // The random number generator - uint256 public RNBlock; // The block number when the random number was requested. - uint256 public RN; // The current random number. + + uint256 public rngRequestedBlock; // The block number requested to the random number. + Phase public phase; // Current phase of this dispute kit. uint256 public disputesWithoutJurors; // The number of disputes that have not finished drawing jurors. Dispute[] public disputes; // Array of the locally created disputes. @@ -148,7 +150,10 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { */ function changeRandomNumberGenerator(RNG _rng) external onlyByGovernor { rng = _rng; - // TODO: if current phase is generating, call rng.requestRN() for the next block + if (phase == Phase.generating) { + rngRequestedBlock = block.number + RNG_LOOKAHEAD; + rng.requestRandomness(rngRequestedBlock); + } } // ************************************* // @@ -187,21 +192,20 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { /** @dev Passes the phase. */ function passPhase() external override { - ISortitionModule sortitionModule = core.disputeKitToSortition(IDisputeKit(this)); + ISortitionModule sortitionModule = core.sortitionModule(); if (sortitionModule.phase() == ISortitionModule.Phase.staking || sortitionModule.freezingPhaseTimeout()) { require(phase != Phase.resolving, "Already in Resolving phase"); phase = Phase.resolving; // Safety net. } else if (sortitionModule.phase() == ISortitionModule.Phase.freezing) { if (phase == Phase.resolving) { require(disputesWithoutJurors > 0, "All the disputes have jurors"); - require(block.number >= sortitionModule.getFreezeBlock() + 20, "Too soon: L1 finality required"); - // TODO: RNG process is currently unfinished. - RNBlock = block.number; - rng.requestRN(block.number); + rngRequestedBlock = sortitionModule.getFreezeBlock() + RNG_LOOKAHEAD; + rng.requestRandomness(rngRequestedBlock); phase = Phase.generating; } else if (phase == Phase.generating) { - RN = rng.getRN(RNBlock); - require(RN != 0, "Random number is not ready yet"); + uint256 randomNumber = rng.receiveRandomness(rngRequestedBlock); + require(randomNumber != 0, "Random number is not ready yet"); + sortitionModule.notifyRandomNumber(randomNumber); phase = Phase.drawing; } else if (phase == Phase.drawing) { require(disputesWithoutJurors == 0, "Not ready for Resolving phase"); @@ -229,12 +233,12 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]]; Round storage round = dispute.rounds[dispute.rounds.length - 1]; - bytes32 key = bytes32(core.getSubcourtID(_coreDisputeID)); // Get the ID of the tree. - uint256 drawnNumber = getRandomNumber(); + ISortitionModule sortitionModule = core.sortitionModule(); + (uint96 subcourtID, , , , ) = core.disputes(_coreDisputeID); + bytes32 key = bytes32(uint256(subcourtID)); // Get the ID of the tree. // TODO: Handle the situation when no one has staked yet. - // TODO: Move post check to sortition module? - drawnAddress = core.drawAddressFromSortition(key, drawnNumber); + drawnAddress = sortitionModule.draw(key, _coreDisputeID, round.votes.length); if (postDrawCheck(_coreDisputeID, drawnAddress)) { round.votes.push(Vote({account: drawnAddress, commit: bytes32(0), choice: 0, voted: false})); @@ -259,10 +263,8 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { uint256[] calldata _voteIDs, bytes32 _commit ) external notJumped(_coreDisputeID) { - require( - core.getCurrentPeriod(_coreDisputeID) == KlerosCore.Period.commit, - "The dispute should be in Commit period." - ); + (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID); + require(period == KlerosCore.Period.commit, "The dispute should be in Commit period."); require(_commit != bytes32(0), "Empty commit."); Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]]; @@ -290,17 +292,16 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { uint256 _salt, string memory _justification ) external notJumped(_coreDisputeID) { - require( - core.getCurrentPeriod(_coreDisputeID) == KlerosCore.Period.vote, - "The dispute should be in Vote period." - ); + (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID); + require(period == KlerosCore.Period.vote, "The dispute should be in Vote period."); require(_voteIDs.length > 0, "No voteID provided"); Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]]; require(_choice <= dispute.numberOfChoices, "Choice out of bounds"); Round storage round = dispute.rounds[dispute.rounds.length - 1]; - bool hiddenVotes = core.areVotesHidden(core.getSubcourtID(_coreDisputeID)); + (uint96 subcourtID, , , , ) = core.disputes(_coreDisputeID); + (, bool hiddenVotes, , , , ) = core.courts(subcourtID); // Save the votes. for (uint256 i = 0; i < _voteIDs.length; i++) { @@ -418,7 +419,8 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { uint256 _coreRoundID, uint256 _choice ) external returns (uint256 amount) { - require(core.isRuled(_coreDisputeID), "Dispute should be resolved."); + (, , , bool isRuled, ) = core.disputes(_coreDisputeID); + require(isRuled, "Dispute should be resolved."); Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]]; Round storage round = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]]; @@ -623,19 +625,12 @@ contract DisputeKitClassic is BaseDisputeKit, IEvidence { * @return Whether the address can be drawn or not. */ function postDrawCheck(uint256 _coreDisputeID, address _juror) internal view override returns (bool) { - uint256 subcourtID = core.getSubcourtID(_coreDisputeID); + (uint96 subcourtID, , , , ) = core.disputes(_coreDisputeID); (uint256 lockedAmountPerJuror, , , , , ) = core.getRoundInfo( _coreDisputeID, core.getNumberOfRounds(_coreDisputeID) - 1 ); - (uint256 stakedTokens, uint256 lockedTokens, ) = core.getJurorBalance(_juror, uint96(subcourtID)); + (uint256 stakedTokens, uint256 lockedTokens, ) = core.getJurorBalance(_juror, subcourtID); return stakedTokens >= lockedTokens + lockedAmountPerJuror; } - - /** @dev RNG function - * @return rn A random number. - */ - function getRandomNumber() internal returns (uint256) { - return rng.getUncorrelatedRN(block.number); - } } diff --git a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol index 20c6d5493..6bcffcd26 100644 --- a/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol +++ b/contracts/src/arbitration/dispute-kits/DisputeKitSybilResistant.sol @@ -80,11 +80,12 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { 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. uint256 public constant LOSER_APPEAL_PERIOD_MULTIPLIER = 5000; // Multiplier of the appeal period for the choice that wasn't voted for in the previous round, in basis points. Default is 1/2 of original appeal period. uint256 public constant ONE_BASIS_POINT = 10000; // One basis point, for scaling. + uint256 public constant RNG_LOOKAHEAD = 20; // Minimum block distance between requesting and obtaining a random number. Arbitrum sequencer finality = 20 blocks. RNG public rng; // The random number generator IProofOfHumanity public poh; // The Proof of Humanity registry - uint256 public RNBlock; // The block number when the random number was requested. - uint256 public RN; // The current random number. + uint256 public rngRequestedBlock; // The block number requested to the random number. + Phase public phase; // Current phase of this dispute kit. uint256 public disputesWithoutJurors; // The number of disputes that have not finished drawing jurors. Dispute[] public disputes; // Array of the locally created disputes. @@ -160,7 +161,10 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { */ function changeRandomNumberGenerator(RNG _rng) external onlyByGovernor { rng = _rng; - // TODO: if current phase is generating, call rng.requestRN() for the next block + if (phase == Phase.generating) { + rngRequestedBlock = block.number + RNG_LOOKAHEAD; + rng.requestRandomness(rngRequestedBlock); + } } /** @dev Changes the `poh` storage variable. @@ -206,21 +210,20 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { /** @dev Passes the phase. */ function passPhase() external override { - ISortitionModule sortitionModule = core.disputeKitToSortition(IDisputeKit(this)); + ISortitionModule sortitionModule = core.sortitionModule(); if (sortitionModule.phase() == ISortitionModule.Phase.staking || sortitionModule.freezingPhaseTimeout()) { require(phase != Phase.resolving, "Already in Resolving phase"); phase = Phase.resolving; // Safety net. } else if (sortitionModule.phase() == ISortitionModule.Phase.freezing) { if (phase == Phase.resolving) { require(disputesWithoutJurors > 0, "All the disputes have jurors"); - require(block.number >= sortitionModule.getFreezeBlock() + 20, "Too soon: L1 finality required"); - // TODO: RNG process is currently unfinished. - RNBlock = block.number; - rng.requestRN(block.number); + rngRequestedBlock = sortitionModule.getFreezeBlock() + RNG_LOOKAHEAD; + rng.requestRandomness(rngRequestedBlock); phase = Phase.generating; } else if (phase == Phase.generating) { - RN = rng.getRN(RNBlock); - require(RN != 0, "Random number is not ready yet"); + uint256 randomNumber = rng.receiveRandomness(rngRequestedBlock); + require(randomNumber != 0, "Random number is not ready yet"); + sortitionModule.notifyRandomNumber(randomNumber); phase = Phase.drawing; } else if (phase == Phase.drawing) { require(disputesWithoutJurors == 0, "Not ready for Resolving phase"); @@ -248,12 +251,12 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]]; Round storage round = dispute.rounds[dispute.rounds.length - 1]; - bytes32 key = bytes32(core.getSubcourtID(_coreDisputeID)); // Get the ID of the tree. - uint256 drawnNumber = getRandomNumber(); + ISortitionModule sortitionModule = core.sortitionModule(); + (uint96 subcourtID, , , , ) = core.disputes(_coreDisputeID); + bytes32 key = bytes32(uint256(subcourtID)); // Get the ID of the tree. // TODO: Handle the situation when no one has staked yet. - // TODO: Move post check to sortition module? - drawnAddress = core.drawAddressFromSortition(key, drawnNumber); + drawnAddress = sortitionModule.draw(key, _coreDisputeID, round.votes.length); if (postDrawCheck(_coreDisputeID, drawnAddress) && !round.alreadyDrawn[drawnAddress]) { round.votes.push(Vote({account: drawnAddress, commit: bytes32(0), choice: 0, voted: false})); @@ -279,10 +282,8 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { uint256[] calldata _voteIDs, bytes32 _commit ) external notJumped(_coreDisputeID) { - require( - core.getCurrentPeriod(_coreDisputeID) == KlerosCore.Period.commit, - "The dispute should be in Commit period." - ); + (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID); + require(period == KlerosCore.Period.commit, "The dispute should be in Commit period."); require(_commit != bytes32(0), "Empty commit."); Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]]; @@ -308,19 +309,18 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { uint256[] calldata _voteIDs, uint256 _choice, uint256 _salt, - string calldata _justification + string memory _justification ) external notJumped(_coreDisputeID) { - require( - core.getCurrentPeriod(_coreDisputeID) == KlerosCore.Period.vote, - "The dispute should be in Vote period." - ); + (, , KlerosCore.Period period, , ) = core.disputes(_coreDisputeID); + require(period == KlerosCore.Period.vote, "The dispute should be in Vote period."); require(_voteIDs.length > 0, "No voteID provided"); Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]]; require(_choice <= dispute.numberOfChoices, "Choice out of bounds"); Round storage round = dispute.rounds[dispute.rounds.length - 1]; - bool hiddenVotes = core.areVotesHidden(core.getSubcourtID(_coreDisputeID)); + (uint96 subcourtID, , , , ) = core.disputes(_coreDisputeID); + (, bool hiddenVotes, , , , ) = core.courts(subcourtID); // Save the votes. for (uint256 i = 0; i < _voteIDs.length; i++) { @@ -438,7 +438,8 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { uint256 _coreRoundID, uint256 _choice ) external returns (uint256 amount) { - require(core.isRuled(_coreDisputeID), "Dispute should be resolved."); + (, , , bool isRuled, ) = core.disputes(_coreDisputeID); + require(isRuled, "Dispute should be resolved."); Dispute storage dispute = disputes[coreDisputeIDToLocal[_coreDisputeID]]; Round storage round = dispute.rounds[dispute.coreRoundIDToLocal[_coreRoundID]]; @@ -643,12 +644,13 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { * @return Whether the address can be drawn or not. */ function postDrawCheck(uint256 _coreDisputeID, address _juror) internal view override returns (bool) { - uint256 subcourtID = core.getSubcourtID(_coreDisputeID); + (uint96 subcourtID, , , , ) = core.disputes(_coreDisputeID); (uint256 lockedAmountPerJuror, , , , , ) = core.getRoundInfo( _coreDisputeID, core.getNumberOfRounds(_coreDisputeID) - 1 ); - (uint256 stakedTokens, uint256 lockedTokens, ) = core.getJurorBalance(_juror, uint96(subcourtID)); + (uint256 stakedTokens, uint256 lockedTokens, ) = core.getJurorBalance(_juror, subcourtID); + if (stakedTokens < lockedTokens + lockedAmountPerJuror) { return false; } else { @@ -663,11 +665,4 @@ contract DisputeKitSybilResistant is BaseDisputeKit, IEvidence { function proofOfHumanity(address _address) internal view returns (bool) { return poh.isRegistered(_address); } - - /** @dev RNG function - * @return rn A random number. - */ - function getRandomNumber() internal returns (uint256) { - return rng.getUncorrelatedRN(block.number); - } } diff --git a/contracts/src/bridge/FastBridgeReceiverOnEthereum.sol b/contracts/src/bridge/FastBridgeReceiverOnEthereum.sol index 27868d383..3be98bf9c 100644 --- a/contracts/src/bridge/FastBridgeReceiverOnEthereum.sol +++ b/contracts/src/bridge/FastBridgeReceiverOnEthereum.sol @@ -117,7 +117,7 @@ contract FastBridgeReceiverOnEthereum is IFastBridgeReceiver, ISafeBridgeReceive uint256 epochNow = block.timestamp / epochPeriod; // allow claim about current or previous epoch - require(_epoch == epochNow || _epoch == epochNow + 1, "Invalid Claim"); + require(_epoch == epochNow || _epoch == epochNow + 1, "Invalid epoch."); require(claims[_epoch].bridger == address(0), "Claim already made for most recent finalized epoch."); claims[_epoch] = Claim({ diff --git a/contracts/src/bridge/FastBridgeReceiverOnGnosis.sol b/contracts/src/bridge/FastBridgeReceiverOnGnosis.sol index 3587cde54..9602e1bdb 100644 --- a/contracts/src/bridge/FastBridgeReceiverOnGnosis.sol +++ b/contracts/src/bridge/FastBridgeReceiverOnGnosis.sol @@ -115,7 +115,7 @@ contract FastBridgeReceiverOnGnosis is IFastBridgeReceiver, ISafeBridgeReceiver uint256 epochNow = block.timestamp / epochPeriod; // allow claim about current or previous epoch - require(_epoch == epochNow || _epoch == epochNow + 1, "Invalid Claim"); + require(_epoch == epochNow || _epoch == epochNow + 1, "Invalid Epoch."); require(claims[_epoch].bridger == address(0), "Claim already made for most recent finalized epoch."); claims[_epoch] = Claim({ diff --git a/contracts/src/bridge/FastBridgeReceiverOnPolygon.sol b/contracts/src/bridge/FastBridgeReceiverOnPolygon.sol index e29148509..59bc83364 100644 --- a/contracts/src/bridge/FastBridgeReceiverOnPolygon.sol +++ b/contracts/src/bridge/FastBridgeReceiverOnPolygon.sol @@ -109,7 +109,7 @@ contract FastBridgeReceiverOnPolygon is FxBaseChildTunnel, IFastBridgeReceiver, uint256 epochNow = block.timestamp / epochPeriod; // allow claim about current or previous epoch - require(_epoch == epochNow || _epoch == epochNow + 1, "Invalid Claim"); + require(_epoch == epochNow || _epoch == epochNow + 1, "Invalid Epoch"); require(claims[_epoch].bridger == address(0), "Claim already made for most recent finalized epoch."); claims[_epoch] = Claim({ diff --git a/contracts/src/bridge/FastBridgeSender.sol b/contracts/src/bridge/FastBridgeSender.sol index 21ca6c549..41113af46 100644 --- a/contracts/src/bridge/FastBridgeSender.sol +++ b/contracts/src/bridge/FastBridgeSender.sol @@ -134,7 +134,7 @@ contract FastBridgeSender is IFastBridgeSender, ISafeBridgeSender { bytes32 receiver = bytes32(bytes20(_receiver)); uint256 nonce = batchSize; // add sender and receiver with proper function selector formatting - // [length][receiver: 1 slot padded][offset][function selector: 4 bytes no padding][msg.sender: 1 slot padded][function arguments: 1 slot padded] + // [length][nonce][receiver: 1 slot padded][offset][function selector: 4 bytes no padding][msg.sender: 1 slot padded][function arguments: 1 slot padded] assembly { fastMessage := mload(0x40) // free memory pointer let lengthCalldata := mload(_calldata) // calldata length diff --git a/contracts/src/data-structures/ISortitionModule.sol b/contracts/src/data-structures/ISortitionModule.sol index c3fcce323..8bd99a83f 100644 --- a/contracts/src/data-structures/ISortitionModule.sol +++ b/contracts/src/data-structures/ISortitionModule.sol @@ -20,7 +20,13 @@ interface ISortitionModule { bytes32 _ID ) external; - function draw(bytes32 _key, uint256 _drawnNumber) external view returns (address); + function notifyRandomNumber(uint256 _drawnNumber) external; + + function draw( + bytes32 _subCourt, + uint256 _coreDisputeID, + uint256 _voteID + ) external view returns (address); function createDisputeHook(uint256 _disputeID, uint256 _roundID) external; diff --git a/contracts/src/data-structures/SortitionModule.sol b/contracts/src/data-structures/SortitionModule.sol index 5ed11dbbf..f761c1f73 100644 --- a/contracts/src/data-structures/SortitionModule.sol +++ b/contracts/src/data-structures/SortitionModule.sol @@ -58,6 +58,8 @@ contract SortitionModule is ISortitionModule { mapping(uint256 => DelayedStake) public delayedStakes; // Stores the stakes that were changed during Freezing phase, to update them when the phase is switched to Staking. mapping(IDisputeKit => bool) public needsFreezing; + mapping(address => uint256) public randomNumbers; // Random number for sortition per each dispute kit. + event NewPhase(Phase _phase); modifier onlyByCore() { @@ -208,6 +210,14 @@ contract SortitionModule is ISortitionModule { tree.nodes.push(0); } + /** + * @dev Saves the random number to use it in sortition. + * @param _randomNumber Random number returned by RNG contract. + */ + function notifyRandomNumber(uint256 _randomNumber) public override { + randomNumbers[msg.sender] = _randomNumber; + } + /** * @dev Set a value of a tree. * @param _key The key of the tree. @@ -349,18 +359,22 @@ contract SortitionModule is ISortitionModule { /** * @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. + * Note Core dispute ID and vote ID aren't used by this module. * @return drawnAddress The drawn address. * `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(bytes32 _key, uint256 _drawnNumber) public view override onlyByCore returns (address drawnAddress) { + function draw( + bytes32 _key, + uint256, /*_coreDisputeID*/ + uint256 /*_voteID*/ + ) public view override returns (address drawnAddress) { require(phase == Phase.freezing, "Wrong phase."); SortitionSumTree storage tree = sortitionSumTrees[_key]; uint256 treeIndex = 0; - uint256 currentDrawnNumber = _drawnNumber % tree.nodes[0]; + uint256 currentDrawnNumber = randomNumbers[msg.sender] % tree.nodes[0]; // While it still has children while ((tree.K * treeIndex) + 1 < tree.nodes.length) { diff --git a/contracts/src/kleros-v1/IKlerosLiquid.sol b/contracts/src/kleros-v1/IKlerosLiquid.sol index 79532045f..f18396839 100644 --- a/contracts/src/kleros-v1/IKlerosLiquid.sol +++ b/contracts/src/kleros-v1/IKlerosLiquid.sol @@ -19,6 +19,18 @@ interface IKlerosLiquid is IArbitrator { drawing // Jurors can be drawn. Pass after all disputes have jurors or `maxDrawingTime` passes. } + 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 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. @@ -37,6 +49,18 @@ interface IKlerosLiquid is IArbitrator { uint256 lockedTokens; // The juror's total amount of tokens locked in disputes. } + function courts(uint256 _index) + external + view + returns ( + uint96 parent, + bool hiddenVotes, + uint256 minStake, + uint256 alpha, + uint256 feeForJuror, + uint256 jurorsForCourtJump + ); + function phase() external view returns (Phase); function lockInsolventTransfers() external view returns (bool); diff --git a/contracts/src/rng/BlockhashRNG.sol b/contracts/src/rng/BlockhashRNG.sol new file mode 100644 index 000000000..88cd4b416 --- /dev/null +++ b/contracts/src/rng/BlockhashRNG.sol @@ -0,0 +1,50 @@ +// SPDX-License-Identifier: MIT + +pragma solidity ^0.8; + +import "./RNG.sol"; + +/** + * @title Random Number Generator using blockhash with fallback. + * @author Clément Lesaege - + * + * Random Number Generator returning the blockhash with a fallback behaviour. + * In case no one called it within the 256 blocks, it returns the previous blockhash. + * This contract must be used when returning 0 is a worse failure mode than returning another blockhash. + * Allows saving the random number for use in the future. It allows the contract to still access the blockhash even after 256 blocks. + */ +contract BlockHashRNG is RNG { + mapping(uint256 => uint256) public randomNumbers; // randomNumbers[block] is the random number for this block, 0 otherwise. + + /** + * @dev Request a random number. + * @param _block Block the random number is linked to. + */ + function requestRandomness(uint256 _block) external override { + // nop + } + + /** + * @dev Return the random number. If it has not been saved and is still computable compute it. + * @param _block Block the random number is linked to. + * @return randomNumber The random number or 0 if it is not ready or has not been requested. + */ + function receiveRandomness(uint256 _block) external override returns (uint256 randomNumber) { + randomNumber = randomNumbers[_block]; + if (randomNumber != 0) { + return randomNumber; + } + + if (_block < block.number) { + // The random number is not already set and can be. + if (blockhash(_block) != 0x0) { + // Normal case. + randomNumber = uint256(blockhash(_block)); + } else { + // The contract was not called in time. Fallback to returning previous blockhash. + randomNumber = uint256(blockhash(block.number - 1)); + } + } + randomNumbers[_block] = randomNumber; + } +} diff --git a/contracts/src/rng/ConstantNG.sol b/contracts/src/rng/ConstantNG.sol deleted file mode 100644 index 427c344dd..000000000 --- a/contracts/src/rng/ConstantNG.sol +++ /dev/null @@ -1,37 +0,0 @@ -// SPDX-License-Identifier: MIT - -/** - * @title Constant Number Generator - * @author Clément Lesaege - - * @dev A Random Number Generator which always return the same number. Usefull in order to make tests. - */ - -pragma solidity ^0.8; -import "./RNG.sol"; - -contract ConstantNG is RNG { - uint256 public immutable number; - - /** - * @dev Constructor. - * @param _number The number to always return. - */ - constructor(uint256 _number) { - number = _number; - } - - /** - * @dev Contribute to the reward of a random number. All the ETH will be lost forever. - * @param _block Block the random number is linked to. - */ - function contribute(uint256 _block) public payable override {} - - /** - * @dev Get the "random number" (which is always the same). - * @param _block Block the random number is linked to. - * @return RN Random Number. If the number is not ready or has not been required 0 instead. - */ - function getRN(uint256 _block) public view override returns (uint256 RN) { - return number; - } -} diff --git a/contracts/src/rng/IncrementalNG.sol b/contracts/src/rng/IncrementalNG.sol index 2cac16dde..3cb5be1c6 100644 --- a/contracts/src/rng/IncrementalNG.sol +++ b/contracts/src/rng/IncrementalNG.sol @@ -17,19 +17,19 @@ contract IncrementalNG is RNG { } /** - * @dev Contribute to the reward of a random number. All the ETH will be lost forever. - * @param _block Block the random number is linked to. + * @dev Request a random number. + * @param _block Block the random number is linked to. */ - function contribute(uint256 _block) public payable override { - /* NOP */ + function requestRandomness(uint256 _block) external override { + // nop } /** - * @dev Get the "random number", which is predictable. + * @dev Get the "random number" (which is always the same). * @param _block Block the random number is linked to. - * @return RN Random Number. If the number is not ready or has not been required 0 instead. + * @return randomNumber The random number or 0 if it is not ready or has not been requested. */ - function getRN(uint256 _block) public override returns (uint256 RN) { + function receiveRandomness(uint256 _block) external override returns (uint256 randomNumber) { unchecked { return number++; } diff --git a/contracts/src/rng/RNG.sol b/contracts/src/rng/RNG.sol index 21a5d645e..8b6bfa9f8 100644 --- a/contracts/src/rng/RNG.sol +++ b/contracts/src/rng/RNG.sol @@ -1,51 +1,18 @@ // SPDX-License-Identifier: MIT -/** - * @authors: [@clesaege] - * @reviewers: [@remedcu] - * @auditors: [] - * @bounties: [] - * @deployments: [] - */ - pragma solidity ^0.8; -/** - * @title Random Number Generator Standard - * @author Clément Lesaege - - * @dev This is an abstract contract - */ -abstract contract RNG { - /** - * @dev Contribute to the reward of a random number. - * @param _block Block the random number is linked to. - */ - function contribute(uint256 _block) public payable virtual; - +interface RNG { /** * @dev Request a random number. * @param _block Block linked to the request. */ - function requestRN(uint256 _block) public payable { - contribute(_block); - } - - /** - * @dev Get the random number. - * @param _block Block the random number is linked to. - * @return RN Random Number. If the number is not ready or has not been required 0 instead. - */ - function getRN(uint256 _block) public virtual returns (uint256 RN); + function requestRandomness(uint256 _block) external; /** - * @dev Get a uncorrelated random number. Act like getRN but give a different number for each sender. - * This is to prevent users from getting correlated numbers. + * @dev Receive the random number. * @param _block Block the random number is linked to. - * @return RN Random Number. If the number is not ready or has not been required 0 instead. + * @return randomNumber Random Number. If the number is not ready or has not been required 0 instead. */ - function getUncorrelatedRN(uint256 _block) public returns (uint256 RN) { - uint256 baseRN = getRN(_block); - if (baseRN == 0) return 0; - else return uint256(keccak256(abi.encode(msg.sender, baseRN))); - } + function receiveRandomness(uint256 _block) external returns (uint256 randomNumber); } diff --git a/contracts/test/arbitration/draw.ts b/contracts/test/arbitration/draw.ts index ae2389d14..76bef657a 100644 --- a/contracts/test/arbitration/draw.ts +++ b/contracts/test/arbitration/draw.ts @@ -1,3 +1,4 @@ +import { anyValue } from "@nomicfoundation/hardhat-chai-matchers/withArgs"; import { deployments, ethers, getNamedAccounts, network } from "hardhat"; import { BigNumber } from "ethers"; import { @@ -96,16 +97,24 @@ describe("Draw Benchmark", async () => { value: arbitrationCost, }); - await network.provider.send("evm_increaseTime", [130]); // Wait for minStakingTime + await network.provider.send("evm_increaseTime", [2000]); // Wait for minStakingTime await network.provider.send("evm_mine"); await sortitionModule.passPhase(); // Staking -> Freezing for (let index = 0; index < 20; index++) { await network.provider.send("evm_mine"); // Wait for 20 blocks finality } await disputeKit.passPhase(); // Resolving -> Generating + for (let index = 0; index < 20; index++) { + await network.provider.send("evm_mine"); // RNG lookahead + } await disputeKit.passPhase(); // Generating -> Drawing - // Draw! - const tx3 = await core.draw(0, 1000, { gasLimit: 1000000 }); + await expect(core.draw(0, 1000, { gasLimit: 1000000 })) + .to.emit(core, "Draw") + .withArgs(anyValue, 0, 0, 0) + .to.emit(core, "Draw") + .withArgs(anyValue, 0, 0, 1) + .to.emit(core, "Draw") + .withArgs(anyValue, 0, 0, 2); }); }); diff --git a/contracts/test/arbitration/index.ts b/contracts/test/arbitration/index.ts index 4ba553e3a..f3033e0d7 100644 --- a/contracts/test/arbitration/index.ts +++ b/contracts/test/arbitration/index.ts @@ -10,12 +10,12 @@ const MULTIPLIER_DENOMINATOR = 10000; describe("DisputeKitClassic", async () => { // eslint-disable-next-line no-unused-vars - let deployer, claimant, supporter, challenger, innocentBystander; - let core, disputeKit, arbitrable, sortitionModule; + let deployer; + let core, disputeKit; before("Deploying", async () => { - [deployer, claimant, supporter, challenger, innocentBystander] = await ethers.getSigners(); - [core, disputeKit, arbitrable, sortitionModule] = await deployContracts(deployer); + [deployer] = await ethers.getSigners(); + [core, disputeKit] = await deployContracts(deployer); }); it("Kleros Core initialization", async () => { @@ -70,8 +70,8 @@ describe("DisputeKitClassic", async () => { }); async function deployContracts(deployer) { - const constantNGFactory = await ethers.getContractFactory("ConstantNG", deployer); - const rng = await constantNGFactory.deploy(42); + const rngFactory = await ethers.getContractFactory("BlockHashRNG", deployer); + const rng = await rngFactory.deploy(); await rng.deployed(); const disputeKitFactory = await ethers.getContractFactory("DisputeKitClassic", deployer); @@ -101,16 +101,11 @@ async function deployContracts(deployer) { [200, 10000, 100, 3], [0, 0, 0, 0], 0xfa, - sortitionModule.address, - 7 + sortitionModule.address ); await core.deployed(); await disputeKit.changeCore(core.address); - const ArbitrableFactory = await ethers.getContractFactory("ArbitrableExample", deployer); - const arbitrable = await ArbitrableFactory.deploy(core.address, "uri://metaevidence.json"); - await arbitrable.deployed(); - - return [core, disputeKit, arbitrable]; + return [core, disputeKit]; } diff --git a/contracts/test/arbitration/unstake.ts b/contracts/test/arbitration/unstake.ts new file mode 100644 index 000000000..9e55d0689 --- /dev/null +++ b/contracts/test/arbitration/unstake.ts @@ -0,0 +1,80 @@ +import { ethers, getNamedAccounts, network, deployments } from "hardhat"; +import { BigNumber } from "ethers"; +import { PNK, KlerosCore, DisputeKitClassic, SortitionModule } from "../../typechain-types"; +import { expect } from "chai"; + +/* eslint-disable no-unused-vars */ +/* eslint-disable no-unused-expressions */ + +describe("Unstake juror", async () => { + const ONE_TENTH_ETH = BigNumber.from(10).pow(17); + const ONE_THOUSAND_PNK = BigNumber.from(10).pow(21); + + // 2nd court, 3 jurors, 1 dispute kit + const extraData = + "0x000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000001"; + + let deployer; + let disputeKit; + let pnk; + let core; + let sortitionModule; + + beforeEach("Setup", async () => { + ({ deployer } = await getNamedAccounts()); + + console.log("deployer:%s", deployer); + console.log("named accounts: %O", await getNamedAccounts()); + + await deployments.fixture(["Arbitration"], { + fallbackToGlobal: true, + keepExistingDeployments: false, + }); + disputeKit = (await ethers.getContract("DisputeKitClassic")) as DisputeKitClassic; + pnk = (await ethers.getContract("PNK")) as PNK; + core = (await ethers.getContract("KlerosCore")) as KlerosCore; + sortitionModule = (await ethers.getContract("SortitionModule")) as SortitionModule; + }); + + it("Unstake inactive juror", async () => { + const arbitrationCost = ONE_TENTH_ETH.mul(3); + + await core.createSubcourt(1, false, ONE_THOUSAND_PNK, 1000, ONE_TENTH_ETH, 3, [0, 0, 0, 0], 3, [1]); // Parent - general court, Classic dispute kit + + await pnk.approve(core.address, ONE_THOUSAND_PNK.mul(4)); + await core.setStake(1, ONE_THOUSAND_PNK.mul(2)); + await core.setStake(2, ONE_THOUSAND_PNK.mul(2)); + + expect(await core.getJurorSubcourtIDs(deployer)).to.be.deep.equal([BigNumber.from("1"), BigNumber.from("2")]); + + await core.createDispute(2, extraData, { value: arbitrationCost }); + + await network.provider.send("evm_increaseTime", [2000]); // Wait for minStakingTime + await network.provider.send("evm_mine"); + await sortitionModule.passPhase(); // Staking -> Freezing + for (let index = 0; index < 20; index++) { + await network.provider.send("evm_mine"); // Wait for 20 blocks finality + } + await disputeKit.passPhase(); // Resolving -> Generating + for (let index = 0; index < 20; index++) { + await network.provider.send("evm_mine"); // RNG lookahead + } + await disputeKit.passPhase(); // Generating -> Drawing + + await core.draw(0, 5000); + + await disputeKit.passPhase(); // Drawing -> Resolving + + await core.passPeriod(0); // Evidence -> Voting + await core.passPeriod(0); // Voting -> Appeal + await core.passPeriod(0); // Appeal -> Execution + + await sortitionModule.passPhase(); // Freezing -> Staking. Change so we don't deal with delayed stakes + + expect(await core.getJurorSubcourtIDs(deployer)).to.be.deep.equal([BigNumber.from("1"), BigNumber.from("2")]); + + await core.execute(0, 0, 1); // 1 iteration should unstake from both courts + + expect(await core.getJurorSubcourtIDs(deployer)).to.be.deep.equal([]); + }); +}); diff --git a/contracts/test/integration/index.ts b/contracts/test/integration/index.ts index 1869171aa..f61bf6b48 100644 --- a/contracts/test/integration/index.ts +++ b/contracts/test/integration/index.ts @@ -2,13 +2,13 @@ import { expect } from "chai"; import { deployments, ethers, getNamedAccounts, network } from "hardhat"; import { BigNumber, utils } from "ethers"; import { - IncrementalNG, + BlockHashRNG, PNK, KlerosCore, FastBridgeReceiverOnEthereum, ForeignGatewayOnEthereum, ArbitrableExample, - FastBridgeSenderToEthereumMock, + FastBridgeSenderMock, HomeGatewayToEthereum, DisputeKitClassic, InboxMock, @@ -44,7 +44,7 @@ describe("Integration tests", async () => { } let deployer; - let ng, + let rng, disputeKit, pnk, core, @@ -66,30 +66,29 @@ describe("Integration tests", async () => { fallbackToGlobal: true, keepExistingDeployments: false, }); - ng = (await ethers.getContract("IncrementalNG")) as IncrementalNG; + rng = (await ethers.getContract("BlockHashRNG")) as BlockHashRNG; disputeKit = (await ethers.getContract("DisputeKitClassic")) as DisputeKitClassic; pnk = (await ethers.getContract("PNK")) as PNK; core = (await ethers.getContract("KlerosCore")) as KlerosCore; fastBridgeReceiver = (await ethers.getContract("FastBridgeReceiverOnEthereum")) as FastBridgeReceiverOnEthereum; foreignGateway = (await ethers.getContract("ForeignGatewayOnEthereum")) as ForeignGatewayOnEthereum; arbitrable = (await ethers.getContract("ArbitrableExample")) as ArbitrableExample; - fastBridgeSender = (await ethers.getContract("FastBridgeSenderToEthereumMock")) as FastBridgeSenderToEthereumMock; + fastBridgeSender = (await ethers.getContract("FastBridgeSenderMock")) as FastBridgeSenderMock; homeGateway = (await ethers.getContract("HomeGatewayToEthereum")) as HomeGatewayToEthereum; inbox = (await ethers.getContract("InboxMock")) as InboxMock; sortitionModule = (await ethers.getContract("SortitionModule")) as SortitionModule; }); it("RNG", async () => { - const rnOld = await ng.number(); - let tx = await ng.getRN(9876543210); + let tx = await rng.receiveRandomness(9876543210); let trace = await network.provider.send("debug_traceTransaction", [tx.hash]); let [rn] = ethers.utils.defaultAbiCoder.decode(["uint"], `0x${trace.returnValue}`); - expect(rn).to.equal(rnOld); + expect(rn).to.equal(0); // requested a block number in the future, so return 0. - tx = await ng.getRN(9876543210); + tx = await rng.receiveRandomness(5); trace = await network.provider.send("debug_traceTransaction", [tx.hash]); [rn] = ethers.utils.defaultAbiCoder.decode(["uint"], `0x${trace.returnValue}`); - expect(rn).to.equal(rnOld.add(1)); + expect(rn).to.not.equal(0); // requested a block number in the past, so return non-zero. }); it("Honest Claim - No Challenge - Bridger paid", async () => { @@ -150,7 +149,7 @@ describe("Integration tests", async () => { expect(tx2).to.emit(homeGateway, "Dispute"); const events2 = (await tx2.wait()).events; - await network.provider.send("evm_increaseTime", [130]); // Wait for minStakingTime + await network.provider.send("evm_increaseTime", [2000]); // Wait for minStakingTime await network.provider.send("evm_mine"); expect(await sortitionModule.phase()).to.equal(Phase.staking); @@ -170,6 +169,7 @@ describe("Integration tests", async () => { expect(await disputeKit.phase()).to.equal(DisputeKitPhase.generating); console.log("KC phase: %d, DK phase: ", await sortitionModule.phase(), await disputeKit.phase()); + await mineBlocks(20); // Wait for RNG lookahead await disputeKit.passPhase(); // Generating -> Drawing expect(await disputeKit.phase()).to.equal(DisputeKitPhase.drawing); console.log("KC phase: %d, DK phase: ", await sortitionModule.phase(), await disputeKit.phase()); @@ -310,7 +310,7 @@ describe("Integration tests", async () => { expect(tx2).to.emit(homeGateway, "Dispute"); - await network.provider.send("evm_increaseTime", [130]); // Wait for minStakingTime + await network.provider.send("evm_increaseTime", [2000]); // Wait for minStakingTime await network.provider.send("evm_mine"); expect(await sortitionModule.phase()).to.equal(Phase.staking); @@ -330,6 +330,7 @@ describe("Integration tests", async () => { expect(await disputeKit.phase()).to.equal(DisputeKitPhase.generating); console.log("KC phase: %d, DK phase: ", await sortitionModule.phase(), await disputeKit.phase()); + await mineBlocks(20); // Wait for RNG lookahead await disputeKit.passPhase(); // Generating -> Drawing expect(await disputeKit.phase()).to.equal(DisputeKitPhase.drawing); console.log("KC phase: %d, DK phase: ", await sortitionModule.phase(), await disputeKit.phase()); @@ -477,7 +478,7 @@ describe("Integration tests", async () => { }); expect(tx2).to.emit(homeGateway, "Dispute"); - await network.provider.send("evm_increaseTime", [130]); // Wait for minStakingTime + await network.provider.send("evm_increaseTime", [2000]); // Wait for minStakingTime await network.provider.send("evm_mine"); expect(await sortitionModule.phase()).to.equal(Phase.staking); @@ -497,6 +498,7 @@ describe("Integration tests", async () => { expect(await disputeKit.phase()).to.equal(DisputeKitPhase.generating); console.log("KC phase: %d, DK phase: ", await sortitionModule.phase(), await disputeKit.phase()); + await mineBlocks(20); // Wait for RNG lookahead await disputeKit.passPhase(); // Generating -> Drawing expect(await disputeKit.phase()).to.equal(DisputeKitPhase.drawing); console.log("KC phase: %d, DK phase: ", await sortitionModule.phase(), await disputeKit.phase()); diff --git a/contracts/test/rng/index.ts b/contracts/test/rng/index.ts index f84ed2d48..fd060c3a8 100644 --- a/contracts/test/rng/index.ts +++ b/contracts/test/rng/index.ts @@ -2,19 +2,6 @@ import { expect } from "chai"; import { ethers } from "hardhat"; import { BigNumber } from "ethers"; -describe("ConstantNG", async () => { - it("Should return always the same number", async () => { - const ConstantRNG = await ethers.getContractFactory("ConstantNG"); - const constantRNG = await ConstantRNG.deploy(42); - await constantRNG.deployed(); - - expect(await constantRNG.getRN(0)).to.equal(42); - expect(await constantRNG.getRN(0)).to.equal(42); - expect(await constantRNG.getRN(437280)).to.equal(42); - expect(await constantRNG.getRN(437280)).to.equal(42); - }); -}); - describe("IncrementalNG", async () => { it("Should return a number incrementing each time", async () => { const IncrementalNG = await ethers.getContractFactory("IncrementalNG"); @@ -22,12 +9,12 @@ describe("IncrementalNG", async () => { const incrementalNG = await IncrementalNG.deploy(initialNg); await incrementalNG.deployed(); - expect(await incrementalNG.callStatic.getRN(689376)).to.equal(initialNg); - await incrementalNG.getRN(29543); - expect(await incrementalNG.callStatic.getRN(5894382)).to.equal(initialNg + 1); - await incrementalNG.getRN(0); - expect(await incrementalNG.callStatic.getRN(3465)).to.equal(initialNg + 2); - await incrementalNG.getRN(BigNumber.from(2).pow(255)); - expect(await incrementalNG.callStatic.getRN(0)).to.equal(initialNg + 3); + expect(await incrementalNG.callStatic.receiveRandomness(689376)).to.equal(initialNg); + await incrementalNG.receiveRandomness(29543); + expect(await incrementalNG.callStatic.receiveRandomness(5894382)).to.equal(initialNg + 1); + await incrementalNG.receiveRandomness(0); + expect(await incrementalNG.callStatic.receiveRandomness(3465)).to.equal(initialNg + 2); + await incrementalNG.receiveRandomness(BigNumber.from(2).pow(255)); + expect(await incrementalNG.callStatic.receiveRandomness(0)).to.equal(initialNg + 3); }); }); diff --git a/contracts/tsconfig.json b/contracts/tsconfig.json index dffa3bb53..0399f604c 100644 --- a/contracts/tsconfig.json +++ b/contracts/tsconfig.json @@ -7,7 +7,8 @@ "outDir": "dist", "declaration": true, "sourceMap": true, - "noImplicitAny": false + "noImplicitAny": false, + "resolveJsonModule": true }, "include": [ "./src", diff --git a/package.json b/package.json index 70734b25a..45f06d5a6 100644 --- a/package.json +++ b/package.json @@ -4,16 +4,26 @@ "description": "Kleros version 2", "main": "index.js", "repository": "git@github.com:kleros/kleros-v2.git", - "author": "Kleros", + "author": { + "name": "Kleros", + "email": "contact@kleros.io", + "url": "https://kleros.io" + }, + "bugs": { + "url": "https://github.com/kleros/kleros-v2/issues", + "email": "contact@kleros.io" + }, "license": "MIT", "private": true, "workspaces": [ "bots", + "bot-pinner", "contracts", "dynamic-script", "evidence-display", "klerosjs", "subgraph", + "subgraph-fastbridge", "web" ], "packageManager": "yarn@3.1.1", @@ -52,6 +62,7 @@ "scripts": { "depcheck": "depcheck .", "changelog": "conventional-changelog --infile CHANGELOG.md --same-file --release-count 0 && prettier --write CHANGELOG.md", - "postinstall": "husky install" + "postinstall": "husky install", + "reinstall": "YARN_CHECKSUM_BEHAVIOR=update yarn install --no-immutable" } } diff --git a/subgraph-fastbridge/.eslintrc.json b/subgraph-fastbridge/.eslintrc.json new file mode 100644 index 000000000..8256ebd88 --- /dev/null +++ b/subgraph-fastbridge/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "root": true, + "parser": "@typescript-eslint/parser", + "plugins": ["@typescript-eslint"], + "extends": [ + "plugin:@typescript-eslint/recommended", + "prettier", + "prettier/@typescript-eslint" + ] +} diff --git a/subgraph-fastbridge/.prettierrc b/subgraph-fastbridge/.prettierrc new file mode 100644 index 000000000..9d4892be8 --- /dev/null +++ b/subgraph-fastbridge/.prettierrc @@ -0,0 +1,3 @@ +{ + "printWidth": 80 +} diff --git a/subgraph-fastbridge/README.md b/subgraph-fastbridge/README.md new file mode 100644 index 000000000..a14a5257d --- /dev/null +++ b/subgraph-fastbridge/README.md @@ -0,0 +1,108 @@ +# @kleros/kleros-v2-subgraph-fastbridge + +## Deployments + +- [kleros/fastbridge-arbitrum-rinkeby](https://thegraph.com/hosted-service/subgraph/kleros/fastbridge-arbitrum-rinkeby) + +## Build + +```bash +$ yarn + +$ yarn codegen + +$ yarn build +``` + +## Deployment to The Graph (hosted service) + +### Authentication + +Get an API key from the thegraph.com, then authenticate. + +```bash +$ yarn run graph auth --product hosted-service +``` + +### Deployment + +```bash +yarn deploy +``` + +## Deployment to a local Graph node + +_Credits to the [scaffold-eth service package](https://github.com/scaffold-eth/scaffold-eth/tree/b03d07f15882db626300ffa04f222736b2a22f81/packages/services/graph-node)_ + +Preconfigured Docker image for running a Graph Node. + +## Usage + +**Prerequisite**: docker and docker-compose. + +```bash +$ docker-compose up -d +Starting graph-node_postgres_1 ... done +Starting graph-node_ipfs_1 ... done +Starting graph-node_graph-node_1 ... done + +$ docker-compose logs -f +... +``` + +This will start docker containers for the following services: + +- IPFS, +- Postgres +- **Graph Node** connecting to the Arbitrum Rinkeby official RPC + +This also creates persistent data directories for IPFS and Postgres in `./data/ipfs` and `./data/postgres`. + +Once this is up and running, you can use [`graph-cli`](https://github.com/graphprotocol/graph-cli) to create and deploy your subgraph to the running Graph Node. + +```bash +# First time only. +$ yarn create-local +Created subgraph: fastbridge + +$ yarn deploy-local --version-label v0.0.1 +✔ Apply migrations +✔ Load subgraph from subgraph.yaml + Compile data source: FastBridgeSender => build/FastBridgeSender/FastBridgeSender.wasm +✔ Compile subgraph + Copy schema file build/schema.graphql + Write subgraph file build/FastBridgeSender/abis/FastBridgeSender.json + Write subgraph manifest build/subgraph.yaml +✔ Write compiled subgraph to build/ + Add file to IPFS build/schema.graphql + .. Qmb3Uahj4qKh5u3V4KuraXJqsrUVwPtvva1KQQSb5tLov9 + Add file to IPFS build/FastBridgeSender/abis/FastBridgeSender.json + .. QmQas2SuTQH6zybTVMGBym76kyBoTp7MwkogcmtHAeMoRj + Add file to IPFS build/FastBridgeSender/FastBridgeSender.wasm + .. QmSLfCYp19WW5JEiaKdmcGFgBCJ5DA723dEkM6QvXE2eCa +✔ Upload subgraph to IPFS + +Build completed: QmWjRVXec6auQdnpvYJ7F8vW7PzkJHYJhFtorWZAhtP9A3 + +Deployed to http://localhost:8000/subgraphs/name/fastbridge/graphql + +Subgraph endpoints: +Queries (HTTP): http://localhost:8000/subgraphs/name/fastbridge +``` + +## Access + +### Graph Node + +- GraphiQL: `http://localhost:8000/` +- HTTP: `http://localhost:8000/subgraphs/name/` +- WebSockets: `ws://localhost:8001/subgraphs/name/` +- Admin: `http://localhost:8020/` + +### IPFS + +- `127.0.0.1:5001` or `/ip4/127.0.0.1/tcp/5001` + +### Postgres + +- `postgresql://graph-node:let-me-in@localhost:5432/graph-node` diff --git a/subgraph-fastbridge/abis/FastBridgeSender.json b/subgraph-fastbridge/abis/FastBridgeSender.json new file mode 100644 index 000000000..4fed10ef1 --- /dev/null +++ b/subgraph-fastbridge/abis/FastBridgeSender.json @@ -0,0 +1,231 @@ +{ + "address": "0xf8A4a85e7153374A1b9BDA763a84252eC286843b", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epochPeriod", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_safeBridgeReceiver", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "batchID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "batchMerkleRoot", + "type": "bytes32" + } + ], + "name": "BatchOutgoing", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "fastMessage", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "fastMessageHash", + "type": "bytes32" + } + ], + "name": "MessageReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "canonicalBridgeMessageID", + "type": "bytes32" + } + ], + "name": "SentSafe", + "type": "event" + }, + { + "inputs": [], + "name": "ARB_SYS", + "outputs": [ + { + "internalType": "contract IArbSys", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "batch", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "batchSize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentBatchID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "fastOutbox", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "safeBridgeReceiver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sendBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "sendFast", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "sendSafeFallback", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ] +} diff --git a/subgraph-fastbridge/abis/FastBridgeSenderToEthereum.json b/subgraph-fastbridge/abis/FastBridgeSenderToEthereum.json new file mode 100644 index 000000000..4fed10ef1 --- /dev/null +++ b/subgraph-fastbridge/abis/FastBridgeSenderToEthereum.json @@ -0,0 +1,231 @@ +{ + "address": "0xf8A4a85e7153374A1b9BDA763a84252eC286843b", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epochPeriod", + "type": "uint256" + }, + { + "internalType": "address", + "name": "_safeBridgeReceiver", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "batchID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "batchSize", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "batchMerkleRoot", + "type": "bytes32" + } + ], + "name": "BatchOutgoing", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes", + "name": "fastMessage", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "fastMessageHash", + "type": "bytes32" + } + ], + "name": "MessageReceived", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "epoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "canonicalBridgeMessageID", + "type": "bytes32" + } + ], + "name": "SentSafe", + "type": "event" + }, + { + "inputs": [], + "name": "ARB_SYS", + "outputs": [ + { + "internalType": "contract IArbSys", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "batch", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "batchSize", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentBatchID", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epochPeriod", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "fastOutbox", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "safeBridgeReceiver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "sendBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_receiver", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "sendFast", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_epoch", + "type": "uint256" + } + ], + "name": "sendSafeFallback", + "outputs": [], + "stateMutability": "payable", + "type": "function" + } + ] +} diff --git a/subgraph-fastbridge/docker-compose.yml b/subgraph-fastbridge/docker-compose.yml new file mode 100644 index 000000000..4b269237d --- /dev/null +++ b/subgraph-fastbridge/docker-compose.yml @@ -0,0 +1,40 @@ +version: "3" +services: + graph-node: + image: graphprotocol/graph-node:latest + ports: + - "8000:8000" + - "8001:8001" + - "8020:8020" + - "8030:8030" + - "8040:8040" + depends_on: + - ipfs + - postgres + environment: + postgres_host: postgres + postgres_user: graph-node + postgres_pass: let-me-in + postgres_db: graph-node + ipfs: "ipfs:5001" + ethereum: "arbitrum-rinkeby:https://rinkeby.arbitrum.io/rpc" + GRAPH_LOG: debug + extra_hosts: + - "host.docker.internal:host-gateway" + ipfs: + image: ipfs/go-ipfs:v0.10.0 + ports: + - "5001:5001" + volumes: + - ./data/ipfs:/data/ipfs + postgres: + image: postgres + ports: + - "5432:5432" + command: ["postgres", "-cshared_preload_libraries=pg_stat_statements"] + environment: + POSTGRES_USER: graph-node + POSTGRES_PASSWORD: let-me-in + POSTGRES_DB: graph-node + volumes: + - ./data/postgres:/var/lib/postgresql/data diff --git a/subgraph-fastbridge/package.json b/subgraph-fastbridge/package.json new file mode 100644 index 000000000..8c76fa70b --- /dev/null +++ b/subgraph-fastbridge/package.json @@ -0,0 +1,19 @@ +{ + "name": "@kleros/kleros-v2-subgraph-fastbridge", + "license": "MIT", + "scripts": { + "codegen": "graph codegen", + "build": "graph build", + "deploy": "graph deploy --node https://api.thegraph.com/deploy/ kleros/fastbridge-arbitrum-rinkeby", + "create-local": "graph create --node http://localhost:8020/ kleros/fastbridge-arbitrum-rinkeby", + "remove-local": "graph remove --node http://localhost:8020/ kleros/fastbridge-arbitrum-rinkeby", + "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 kleros/fastbridge-arbitrum-rinkeby" + }, + "dependencies": { + "@graphprotocol/graph-cli": "^0.33.0", + "@graphprotocol/graph-ts": "^0.27.0" + }, + "volta": { + "node": "16.17.0" + } +} diff --git a/subgraph-fastbridge/schema.graphql b/subgraph-fastbridge/schema.graphql new file mode 100644 index 000000000..5957a4d09 --- /dev/null +++ b/subgraph-fastbridge/schema.graphql @@ -0,0 +1,36 @@ +type FastMessage @entity(immutable: true) { + id: ID! + batchID: BigInt! + nonce: BigInt! + message: Bytes! + receiver: Receiver! + sender: Sender! + hash: Bytes! +} + +type Proof @entity(immutable: true) { + id: ID! + batchID: BigInt! + nonce: BigInt! + data: Bytes! + fastMessage: FastMessage! +} + +type Receiver @entity(immutable: true) { + id: ID! + fastMessages: [FastMessage!]! @derivedFrom(field: "receiver") +} + +type Sender @entity(immutable: true) { + id: ID! + fastMessages: [FastMessage!]! @derivedFrom(field: "sender") +} + +type Batch @entity { + id: ID! + epochFinal: BigInt! + batchSize: BigInt! + merkleRoot: Bytes + sentSafe: Boolean + canonicalBridgeMessageID: Bytes +} \ No newline at end of file diff --git a/subgraph-fastbridge/scripts/updateAbis.sh b/subgraph-fastbridge/scripts/updateAbis.sh new file mode 100755 index 000000000..292a23064 --- /dev/null +++ b/subgraph-fastbridge/scripts/updateAbis.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +function update() #file #dataSourceIndex +{ + local f="$1" + local dataSourceIndex="$2" + cat $f | jq '. | {address: .address, abi: .abi}' > abis/$(basename $f) + + address=$(cat abis/$(basename $f) | jq '.address') + yq -i ".dataSources[$dataSourceIndex].source.address=$address" $SCRIPT_DIR/../subgraph.yaml + + blockNumber="$(cat $f | jq '.receipt.blockNumber')" + yq -i ".dataSources[$dataSourceIndex].source.startBlock=$blockNumber" $SCRIPT_DIR/../subgraph.yaml +} + +update "$SCRIPT_DIR/../../contracts/deployments/arbitrumRinkeby/FastBridgeSender.json" 0 diff --git a/subgraph-fastbridge/src/FastBridgeSender.ts b/subgraph-fastbridge/src/FastBridgeSender.ts new file mode 100644 index 000000000..284fce806 --- /dev/null +++ b/subgraph-fastbridge/src/FastBridgeSender.ts @@ -0,0 +1,156 @@ +import { Bytes, ByteArray, BigInt, crypto } from "@graphprotocol/graph-ts"; + +import { + FastBridgeSender, + MessageReceived, + BatchOutgoing, + SentSafe, +} from "../generated/FastBridgeSender/FastBridgeSender"; +import { + FastMessage, + Sender, + Batch, + Proof, + Receiver, +} from "../generated/schema"; + +export function handleSentSafe(event: SentSafe): void { + const batch = Batch.load(event.params.epoch.toString()); + if (batch) { + batch.sentSafe = true; + batch.canonicalBridgeMessageID = event.params.canonicalBridgeMessageID; + batch.save(); + } +} + +export function handleMessageReceived(event: MessageReceived): void { + const contract = FastBridgeSender.bind(event.address); + + const batchID = contract.currentBatchID(); + const leafHash = event.params.fastMessageHash; + const message = event.params.fastMessage; + const nonce = BigInt.fromByteArray(firstSlotReverse(message)); + + const fastMessage = new FastMessage( + batchID.toString() + "," + nonce.toString() + ); + + fastMessage.message = message; + fastMessage.hash = leafHash; + fastMessage.batchID = batchID; + fastMessage.nonce = nonce; + + const receiverAddress = getAddress(message, 44).toHexString(); + const senderAddress = getAddress(message, 144).toHexString(); + + const receiver = new Receiver(receiverAddress); + receiver.save(); + + const sender = new Sender(senderAddress); + sender.save(); + + fastMessage.receiver = receiverAddress; + fastMessage.sender = senderAddress; + fastMessage.save(); +} + +export function handleBatchOutgoing(event: BatchOutgoing): void { + const layers: ByteArray[][] = []; + const layerZero: ByteArray[] = []; + + const epochInitial = event.params.batchID; + const epochFinal = event.params.epoch; + const batchSize = event.params.batchSize; + const currentBatchID = event.params.batchID; + + const batch = new Batch(currentBatchID.toString()); + + batch.epochFinal = epochFinal; + batch.batchSize = batchSize; + + let count = 0; + const _epochFinal = epochFinal.toU32(); + + for (let i = epochInitial.toU32(); i <= _epochFinal; i++) { + let fastMessage = FastMessage.load(i.toString() + "," + count.toString()); + while (fastMessage != null) { + layerZero.push(fastMessage.hash); + count++; + fastMessage = FastMessage.load(i.toString() + "," + count.toString()); + } + } + layers.push(layerZero); + // Get next layer until we reach the root + while (layers[layers.length - 1].length > 1) { + layers.push(getNextLayer(layers[layers.length - 1])); + } + + // PROOF + for (let idx = 0; idx < layerZero.length; idx++) { + const proof: ByteArray[] = []; + const _proof = new Proof(currentBatchID.toString() + "," + idx.toString()); + let _idx = idx; + for (let i = 0; i < layers.length; i++) { + const pairIdx = idx % 2 === 0 ? idx + 1 : idx - 1; + if (pairIdx < layers[i].length) { + proof.push(layers[i][pairIdx]); + } + _idx /= 2; + } + _proof.data = Bytes.fromByteArray(Flatten(proof)); + _proof.fastMessage = currentBatchID.toString() + "," + idx.toString(); + _proof.batchID = currentBatchID; + _proof.nonce = BigInt.fromU32(idx); + _proof.save(); + } + batch.merkleRoot = event.params.batchMerkleRoot; + batch.sentSafe = false; + batch.save(); +} + +function Flatten(a: ByteArray[]): ByteArray { + const out = new ByteArray(32 * a.length); + for (let i = 0; i < a.length; i++) out.set(a[i], i * 32); + return out; +} + +function getNextLayer(elements: ByteArray[]): ByteArray[] { + return elements.reduce((layer, el, idx, arr) => { + if (idx % 2 === 0) { + // Hash the current element with its pair element + if (idx === arr.length - 1) { + layer.push(el); + } else { + layer.push(crypto.keccak256(concatAndSortByteArrays(el, arr[idx + 1]))); + } + } + + return layer; + }, [] as ByteArray[]); +} + +function firstSlotReverse(a: ByteArray): ByteArray { + const out = new ByteArray(32); + for (let i = 0; i < 32; i++) out[i] = a[31 - i]; + return out; +} + +function getAddress(input: ByteArray, offset: i32): ByteArray { + const out = new ByteArray(20); + for (let i = 0; i < 20; i++) out[i] = input[i + offset]; + return out; +} + +function concatAndSortByteArrays(a: ByteArray, b: ByteArray): ByteArray { + let out: ByteArray; + for (let i = 0; i < 32; i++) { + if (a[i] > b[i]) { + out = b.concat(a); + return out; + } else if (b[i] < a[i]) { + out = a.concat(b); + return out; + } + } + return a; +} diff --git a/subgraph-fastbridge/subgraph.yaml b/subgraph-fastbridge/subgraph.yaml new file mode 100644 index 000000000..8b24a0d3c --- /dev/null +++ b/subgraph-fastbridge/subgraph.yaml @@ -0,0 +1,34 @@ +specVersion: 0.0.4 +description: Fast Bridge Sender on Arbitrum Rinkeby. +repository: https://github.com/kleros/kleros-v2/tree/master/subgraph-fastbridge +schema: + file: ./schema.graphql +dataSources: + - kind: ethereum + name: FastBridgeSender + network: arbitrum-rinkeby + source: + address: "0xf8A4a85e7153374A1b9BDA763a84252eC286843b" + abi: FastBridgeSender + startBlock: 14453120 + mapping: + kind: ethereum/events + apiVersion: 0.0.6 + language: wasm/assemblyscript + entities: + - FastMessage + - Proof + - Sender + - Receiver + - Batch + abis: + - name: FastBridgeSender + file: ./abis/FastBridgeSender.json + eventHandlers: + - event: SentSafe(indexed uint256,bytes32) + handler: handleSentSafe + - event: MessageReceived(bytes,bytes32) + handler: handleMessageReceived + - event: BatchOutgoing(indexed uint256,uint256,uint256,bytes32) + handler: handleBatchOutgoing + file: ./src/FastBridgeSender.ts diff --git a/subgraph-fastbridge/tsconfig.json b/subgraph-fastbridge/tsconfig.json new file mode 100644 index 000000000..5c5d17c92 --- /dev/null +++ b/subgraph-fastbridge/tsconfig.json @@ -0,0 +1,4 @@ +{ + "extends": "@graphprotocol/graph-ts/types/tsconfig.base.json", + "include": ["src"] +} diff --git a/subgraph/schema.graphql b/subgraph/schema.graphql index 050152cbd..ff5eab5c3 100644 --- a/subgraph/schema.graphql +++ b/subgraph/schema.graphql @@ -9,14 +9,14 @@ enum Period { type Court @entity { id: ID! hiddenVotes: Boolean! - children: [Court!]! - childrenIDs: [String!]! + parent: Court + children: [Court!]! @derivedFrom(field: "parent") minStake: BigInt! alpha: BigInt! feeForJuror: BigInt! jurorsForCourtJump: BigInt! timesPerPeriod: [BigInt!]! - supportedDisputeKits: BigInt! + supportedDisputeKits: [DisputeKit!]! disputes: [Dispute!]! @derivedFrom(field: "subcourtID") stakedJurors: [JurorTokensPerSubcourt!]! @derivedFrom(field: "subcourt") tokens: [JurorTokensPerSubcourt!]! @derivedFrom(field: "subcourt") @@ -48,15 +48,18 @@ type JurorTokensPerSubcourt @entity { type Round @entity { id: ID! # Set to `${dispute.id}-${currentRound}` dispute: Dispute! + disputeKitID: DisputeKit! tokensAtStakePerJuror: BigInt! totalFeesForJurors: BigInt! + nbVotes: BigInt! repartitions: BigInt! penalties: BigInt! - draws: [Draw!]! @derivedFrom(field: "round") + drawnJurors: [Draw!]! @derivedFrom(field: "round") } type Draw @entity { id: ID! # Set to `${dispute.id}-${currentRound}-${voteID}` + dispute: Dispute! round: Round! juror: Juror! voteID: BigInt! @@ -66,17 +69,27 @@ type Dispute @entity { id: ID! subcourtID: Court! arbitrated: Bytes! - disputeKit: Bytes! period: Period! ruled: Boolean! lastPeriodChange: BigInt! - nbVotes: BigInt! - currentRound: Int! rounds: [Round!]! @derivedFrom(field: "dispute") + draws: [Draw!]! @derivedFrom(field: "dispute") + currentRound: Int! shifts: [TokenAndETHShift!]! @derivedFrom(field: "dispute") gatewayDispute: GatewayDispute! @derivedFrom(field: "homeDispute") } +type DisputeKit @entity { + id: ID! + address: Bytes + parent: DisputeKit + children: [DisputeKit!]! @derivedFrom(field: "parent") + needsFreezing: Boolean! + depthLevel: BigInt! + rounds: [Round!]! @derivedFrom(field: "disputeKitID") + courts: [Court!]! @derivedFrom(field: "supportedDisputeKits") +} + type GatewayDispute @entity { id: ID! homeDispute: Dispute! @@ -86,11 +99,11 @@ type GatewayDispute @entity { relayer: Bytes! } -type OutgoingMessage @entity { +type OutgoingBatch @entity { id: ID! # Set to messageHash - target: Bytes! - messageHash: String! - message: String! + size: BigInt! + epoch: BigInt! + batchMerkleRoot: String! } type PNKStakedDataPoint @entity { diff --git a/subgraph/scripts/update.sh b/subgraph/scripts/update.sh new file mode 100755 index 000000000..cdd141209 --- /dev/null +++ b/subgraph/scripts/update.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +function update() #file #dataSourceIndex +{ + local f="$1" + local dataSourceIndex="$2" + + address=$(cat $f | jq '.address') + yq -i ".dataSources[$dataSourceIndex].source.address=$address" $SCRIPT_DIR/../subgraph.yaml + + blockNumber="$(cat $f | jq '.receipt.blockNumber')" + yq -i ".dataSources[$dataSourceIndex].source.startBlock=$blockNumber" $SCRIPT_DIR/../subgraph.yaml +} + +update "$SCRIPT_DIR/../../contracts/deployments/arbitrumRinkeby/KlerosCore.json" 0 +update "$SCRIPT_DIR/../../contracts/deployments/arbitrumRinkeby/HomeGatewayToEthereum.json" 1 +update "$SCRIPT_DIR/../../contracts/deployments/arbitrumRinkeby/FastBridgeSender.json" 2 diff --git a/subgraph/src/FastBridgeSender.ts b/subgraph/src/FastBridgeSender.ts index c7fb0e142..d58cf006c 100644 --- a/subgraph/src/FastBridgeSender.ts +++ b/subgraph/src/FastBridgeSender.ts @@ -1,16 +1,10 @@ -import { - OutgoingMessage as OutgoingMessageEvent, -} from "../generated/FastBridgeSender/FastBridgeSender"; -import { - OutgoingMessage -} from "../generated/schema"; +import { BatchOutgoing as BatchOutgoingEvent } from "../generated/FastBridgeSender/FastBridgeSender"; +import { OutgoingBatch } from "../generated/schema"; -export function handleOutgoingMessage(event: OutgoingMessageEvent): void { - const outgoingMessage = new OutgoingMessage( - event.params.messageHash.toHexString() - ); - outgoingMessage.target = event.params.target; - outgoingMessage.messageHash = event.params.messageHash.toHex(); - outgoingMessage.message = event.params.message.toHex(); - outgoingMessage.save(); +export function handleBatchOutgoing(event: BatchOutgoingEvent): void { + const outgoingBatch = new OutgoingBatch(event.params.batchID.toHexString()); + outgoingBatch.size = event.params.batchSize; + outgoingBatch.epoch = event.params.epoch; + outgoingBatch.batchMerkleRoot = event.params.batchMerkleRoot.toHex(); + outgoingBatch.save(); } diff --git a/subgraph/src/KlerosCore.ts b/subgraph/src/KlerosCore.ts index 07055409f..0dac487c6 100644 --- a/subgraph/src/KlerosCore.ts +++ b/subgraph/src/KlerosCore.ts @@ -4,15 +4,20 @@ import { Entity, Value, store, + BigDecimal, } from "@graphprotocol/graph-ts"; import { KlerosCore, AppealDecision, DisputeCreation, + DisputeKitCreated, + DisputeKitEnabled, + SubcourtCreated, + SubcourtModified, Draw as DrawEvent, NewPeriod, StakeSet, - TokenAndETHShift as TokenAndETHShiftEvent + TokenAndETHShift as TokenAndETHShiftEvent, } from "../generated/KlerosCore/KlerosCore"; import { Juror, @@ -21,6 +26,8 @@ import { Round, Draw, Dispute, + DisputeKit, + Court, } from "../generated/schema"; function getPeriodName(index: i32): string { @@ -28,6 +35,72 @@ function getPeriodName(index: i32): string { return periodArray.at(index) || "None"; } +export function handleSubcourtCreated(event: SubcourtCreated): void { + const subcourt = new Court(event.params._subcourtID.toString()); + subcourt.hiddenVotes = event.params._hiddenVotes; + subcourt.parent = event.params._parent.toString(); + subcourt.minStake = event.params._minStake; + subcourt.alpha = event.params._alpha; + subcourt.feeForJuror = event.params._feeForJuror; + subcourt.jurorsForCourtJump = event.params._jurorsForCourtJump; + subcourt.timesPerPeriod = event.params._timesPerPeriod; + subcourt.supportedDisputeKits = + event.params._supportedDisputeKits.map((disputeKitID: BigInt) => + disputeKitID.toString() + ); + subcourt.save(); +} + +export function handleSubcourtModified(event: SubcourtModified): void { + const court = Court.load(event.params._subcourtID.toString()); + if (court) { + const contract = KlerosCore.bind(event.address); + const courtContractState = contract.courts(event.params._subcourtID); + court.hiddenVotes = courtContractState.getHiddenVotes(); + court.minStake = courtContractState.getMinStake(); + court.alpha = courtContractState.getAlpha(); + court.feeForJuror = courtContractState.getFeeForJuror(); + court.jurorsForCourtJump = courtContractState.getJurorsForCourtJump(); + court.timesPerPeriod = contract.getTimesPerPeriod(event.params._subcourtID); + court.save(); + } +} + +export function handleDisputeKitCreated(event: DisputeKitCreated): void { + const disputeKit = new DisputeKit(event.params._disputeKitID.toString()); + disputeKit.parent = event.params._parent.toString(); + disputeKit.address = event.params._disputeKitAddress; + disputeKit.needsFreezing = false; + const parent = DisputeKit.load(event.params._parent.toString()); + disputeKit.depthLevel = parent + ? parent.depthLevel.plus(BigInt.fromI32(1)) + : BigInt.fromI32(0); + disputeKit.save(); +} + +export function handleDisputeKitEnabled(event: DisputeKitEnabled): void { + const court = Court.load(event.params._subcourtID.toString()); + if (court) { + const isEnable = event.params._enable; + const disputeKitID = event.params._disputeKitID.toString(); + court.supportedDisputeKits = isEnable + ? court.supportedDisputeKits.concat([disputeKitID]) + : filterSupportedDisputeKits(court.supportedDisputeKits, disputeKitID); + court.save(); + } +} + +function filterSupportedDisputeKits( + supportedDisputeKits: string[], + disputeKitID: string +): string[] { + let result: string[] = []; + for (let i = 0; i < supportedDisputeKits.length; i++) + if (supportedDisputeKits[i] !== disputeKitID) + result = result.concat([supportedDisputeKits[i]]); + return result; +} + export function handleAppealDecision(event: AppealDecision): void { const disputeID = event.params._disputeID; const dispute = Dispute.load(disputeID.toString()); @@ -38,7 +111,8 @@ export function handleAppealDecision(event: AppealDecision): void { `${disputeID.toString()}-${newRoundIndex.toString()}` ); const roundInfo = contract.getRoundInfo( - disputeID, BigInt.fromI64(newRoundIndex) + disputeID, + BigInt.fromI64(newRoundIndex) ); round.dispute = disputeID.toString(); round.tokensAtStakePerJuror = roundInfo.value0; @@ -59,11 +133,9 @@ export function handleDisputeCreation(event: DisputeCreation): void { const subcourtID = disputeStorage.value0.toString(); dispute.arbitrated = event.params._arbitrable; dispute.subcourtID = subcourtID; - dispute.disputeKit = disputeStorage.value2; dispute.period = "Evidence"; dispute.ruled = false; - dispute.lastPeriodChange = disputeStorage.value5; - dispute.nbVotes = disputeStorage.value6; + dispute.lastPeriodChange = disputeStorage.value4; dispute.currentRound = 0; const roundInfo = contract.getRoundInfo(disputeID, BigInt.fromString("0")); const round = new Round(`${disputeID.toString()}-0`); @@ -88,13 +160,12 @@ export function handleNewPeriod(event: NewPeriod): void { export function handleDraw(event: DrawEvent): void { const disputeID = event.params._disputeID; - const currentRound = event.params._appeal; + const currentRound = event.params._roundID; const voteID = event.params._voteID; - const drawID = ( - `${disputeID.toString()}-${currentRound.toString()}-${voteID.toString()}` - ); + const drawID = `${disputeID.toString()}-${currentRound.toString()}-${voteID.toString()}`; const drawnAddress = event.params._address; const draw = new Draw(drawID); + draw.dispute = disputeID.toString(); draw.round = currentRound.toString(); draw.juror = drawnAddress.toHexString(); draw.voteID = voteID; @@ -102,18 +173,23 @@ export function handleDraw(event: DrawEvent): void { const dispute = Dispute.load(disputeID.toString()); if (dispute) { updateJurorBalance( - drawnAddress.toHexString(), dispute.subcourtID.toString(), event + drawnAddress.toHexString(), + dispute.subcourtID.toString(), + event ); } } function updateJurorBalance( - address: string, subcourt: string, event: DrawEvent + address: string, + subcourt: string, + event: DrawEvent ): void { const jurorTokens = new JurorTokensPerSubcourt(`${address}-${subcourt}`); const contract = KlerosCore.bind(event.address); const jurorBalance = contract.getJurorBalance( - Address.fromString(address), BigInt.fromString(subcourt) + Address.fromString(address), + BigInt.fromString(subcourt) ); jurorTokens.locked = jurorBalance.value1; jurorTokens.save(); @@ -142,7 +218,8 @@ export function handleStakeSet(event: StakeSet): void { jurorTokens.staked = amountStaked; jurorTokens.save(); updateTotalPNKStaked( - getDelta(previousStake, amountStaked), event.block.timestamp + getDelta(previousStake, amountStaked), + event.block.timestamp ); } @@ -151,7 +228,7 @@ export function handleTokenAndETHShift(event: TokenAndETHShiftEvent): void { const disputeID = event.params._disputeID; const shiftID = `${jurorAddress}-${disputeID.toString()}`; const tokenAmount = event.params._tokenAmount; - const ethAmount = event.params._ETHAmount; + const ethAmount = event.params._ethAmount; const shift = new TokenAndETHShift(shiftID); if (tokenAmount.gt(BigInt.fromI32(0))) { updatePNKRedistributed(tokenAmount, event.block.timestamp); @@ -165,10 +242,14 @@ export function handleTokenAndETHShift(event: TokenAndETHShiftEvent): void { } function getDelta(previousValue: BigInt, newValue: BigInt): BigInt { - return (newValue.minus(previousValue)); + return newValue.minus(previousValue); } -function updateDataPoint(delta: BigInt, timestamp: BigInt, entityName: string): void { +function updateDataPoint( + delta: BigInt, + timestamp: BigInt, + entityName: string +): void { let counter = store.get(entityName, "0"); if (!counter) { counter = new Entity(); diff --git a/subgraph/subgraph.yaml b/subgraph/subgraph.yaml index ff0edec82..0e4434889 100644 --- a/subgraph/subgraph.yaml +++ b/subgraph/subgraph.yaml @@ -1,4 +1,4 @@ -specVersion: 0.0.2 +specVersion: 0.0.4 schema: file: ./schema.graphql dataSources: @@ -6,21 +6,27 @@ dataSources: name: KlerosCore network: arbitrum-rinkeby source: - address: "0xd08452AEE7ab5bE3BF6733BA0d3F0CFdaf060Aa2" + address: "0x815d709EFCF5E69e2e9E2F8d3815d762496a2f0F" abi: KlerosCore - startBlock: 9609833 + startBlock: 14452893 mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript entities: - - AppealDecision - - AppealPossible - - DisputeCreation - - Draw - - NewPeriod - - StakeSet + - Court + - Juror - TokenAndETHShift + - JurorTokensPerSubcourt + - Round + - Draw + - Dispute + - DisputeKit + - PNKStakedDataPoint + - ETHPaidDataPoint + - PNKRedistributedDataPoint + - ActiveJurorsDataPoint + - CasesDataPoint abis: - name: KlerosCore file: ../contracts/deployments/arbitrumRinkeby/KlerosCore.json @@ -33,6 +39,14 @@ dataSources: handler: handleDraw - event: NewPeriod(indexed uint256,uint8) handler: handleNewPeriod + - event: SubcourtCreated(indexed uint256,indexed uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256,uint256[]) + handler: handleSubcourtCreated + - event: SubcourtModified(indexed uint96,string) + handler: handleSubcourtModified + - event: DisputeKitCreated(indexed uint256,indexed address,indexed uint256) + handler: handleDisputeKitCreated + - event: DisputeKitEnabled(indexed uint96,indexed uint256,indexed bool) + handler: handleDisputeKitEnabled - event: StakeSet(indexed address,uint256,uint256,uint256) handler: handleStakeSet - event: TokenAndETHShift(indexed address,indexed uint256,int256,int256) @@ -42,18 +56,18 @@ dataSources: name: HomeGateway network: arbitrum-rinkeby source: - address: "0x2Aa1f82d363f79c1E7a4CcF955Fb7E4306b9B260" + address: "0x4e894c2B60214beC53B60D09F39544518296C07B" abi: HomeGateway - startBlock: 9609833 + startBlock: 14453123 mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript entities: - - Dispute + - GatewayDispute abis: - name: HomeGateway - file: ../contracts/deployments/arbitrumRinkeby/HomeGateway.json + file: ../contracts/deployments/arbitrumRinkeby/HomeGatewayToEthereum.json eventHandlers: - event: Dispute(indexed address,indexed uint256,uint256,uint256) handler: handleDisputeEvent @@ -62,12 +76,12 @@ dataSources: name: FastBridgeSender network: arbitrum-rinkeby source: - address: "0x0b9e03455Fed83f209Fa7ce596c93ba6aBAd1f46" + address: "0xf8A4a85e7153374A1b9BDA763a84252eC286843b" abi: FastBridgeSender - startBlock: 9609833 + startBlock: 14453120 mapping: kind: ethereum/events - apiVersion: 0.0.5 + apiVersion: 0.0.6 language: wasm/assemblyscript entities: - OutgoingMessage @@ -75,6 +89,6 @@ dataSources: - name: FastBridgeSender file: ../contracts/deployments/arbitrumRinkeby/FastBridgeSender.json eventHandlers: - - event: OutgoingMessage(address,bytes32,bytes) - handler: handleOutgoingMessage + - event: BatchOutgoing(indexed uint256,uint256,uint256,bytes32) + handler: handleBatchOutgoing file: ./src/FastBridgeSender.ts diff --git a/web/package.json b/web/package.json index 1c8d57a40..663d950b7 100644 --- a/web/package.json +++ b/web/package.json @@ -8,8 +8,10 @@ "license": "MIT", "alias": { "src": "./src", + "utils": "./src/utils", "assets": "./src/assets", "components": "./src/components", + "connectors": "./src/connectors", "context": "./src/context", "layout": "./src/layout", "consts": "./src/consts", @@ -30,12 +32,12 @@ "generate": "graphql-codegen" }, "devDependencies": { - "@parcel/transformer-svg-react": "^2.6.2", + "@parcel/transformer-svg-react": "^2.7.0", "@types/react": "^18.0.14", "@types/react-dom": "^18.0.6", "@types/styled-components": "^5.1.21", - "@typescript-eslint/eslint-plugin": "^5.31.0", - "@typescript-eslint/parser": "^5.31.0", + "@typescript-eslint/eslint-plugin": "^5.33.1", + "@typescript-eslint/parser": "^5.33.1", "@typescript-eslint/utils": "^5.29.0", "eslint": "^8.16.0", "eslint-config-prettier": "^8.3.0", @@ -47,27 +49,31 @@ "eslint-plugin-security": "^1.4.0", "eslint-utils": "^3.0.0", "lru-cache": "^7.8.0", - "parcel": "^2.6.2", + "parcel": "^2.7.0", "prettier": "^2.5.1", "typescript": "^4.5.5" }, "dependencies": { - "@graphql-codegen/cli": "^2.11.3", - "@graphql-codegen/typescript": "^2.4.9", - "@graphql-codegen/typescript-operations": "^2.5.2", + "@graphql-codegen/cli": "^2.11.6", + "@graphql-codegen/typescript": "^2.7.3", + "@graphql-codegen/typescript-operations": "^2.5.3", "@kleros/kleros-v2-contracts": "workspace:^", - "@kleros/ui-components-library": "^1.5.0", - "chart.js": "^3.8.2", + "@kleros/ui-components-library": "^1.7.0", + "@web3-react/core": "^6.1.9", + "@web3-react/injected-connector": "^6.0.7", + "@web3-react/types": "^6.0.7", + "chart.js": "^3.9.1", "chartjs-adapter-moment": "^1.0.0", "core-js": "^3.21.1", - "ethers": "^5.6.5", + "ethers": "^5.7.0", "graphql": "^16.4.0", "graphql-request": "^4.2.0", "moment": "^2.29.4", "react": "^18.2.0", "react-chartjs-2": "^4.3.1", "react-dom": "^18.2.0", - "react-is": "^18.0.0", + "react-error-boundary": "^3.1.4", + "react-is": "^18.2.0", "react-router-dom": "6", "styled-components": "^5.3.5", "swr": "^1.3.0" diff --git a/web/src/app.tsx b/web/src/app.tsx index b6bad642d..e03e75d9e 100644 --- a/web/src/app.tsx +++ b/web/src/app.tsx @@ -1,11 +1,14 @@ import React from "react"; -import StyledComponentsProvider from "context/StyledComponentsProvider"; import { SWRConfig } from "swr"; import { request } from "graphql-request"; import { Routes, Route } from "react-router-dom"; +import Web3Provider from "context/Web3Provider"; +import StyledComponentsProvider from "context/StyledComponentsProvider"; +import WrongChainBoundary from "components/WrongChainBoundary"; import Layout from "layout/index"; import Home from "./pages/Home"; import Cases from "./pages/Cases"; +import Dashboard from "./pages/Dashboard"; const fetcherBuilder = (url: string) => @@ -24,18 +27,22 @@ const App: React.FC = () => { ), }} > - - }> - } /> - } /> - Courts} /> - Dashboard} /> - Justice not found here ¯\_( ͡° ͜ʖ ͡°)_/¯} - /> - - + + + + }> + } /> + } /> + Courts} /> + } /> + Justice not found here ¯\_( ͡° ͜ʖ ͡°)_/¯} + /> + + + + ); diff --git a/web/src/assets/svgs/styled/eth.svg b/web/src/assets/svgs/styled/eth.svg new file mode 100644 index 000000000..8b1703496 --- /dev/null +++ b/web/src/assets/svgs/styled/eth.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/web/src/assets/svgs/styled/pnk.svg b/web/src/assets/svgs/styled/pnk.svg new file mode 100644 index 000000000..56a546d4c --- /dev/null +++ b/web/src/assets/svgs/styled/pnk.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/web/src/components/CasesDisplay/CasesGrid.tsx b/web/src/components/CasesDisplay/CasesGrid.tsx new file mode 100644 index 000000000..09ee766cb --- /dev/null +++ b/web/src/components/CasesDisplay/CasesGrid.tsx @@ -0,0 +1,59 @@ +import React from "react"; +import styled from "styled-components"; +import { StandardPagination } from "@kleros/ui-components-library"; +import DisputeCard from "components/DisputeCard"; + +const Container = styled.div` + display: flex; + flex-wrap: wrap; + justify-content: center; + gap: 8px; +`; + +// 24px as margin-top since we already have 8px from the flex gap +const StyledPagination = styled(StandardPagination)` + margin-top: 24px; + margin-left: auto; + margin-right: auto; +`; + +export interface ICasesGrid { + casesPerPage: number; +} + +const CasesGrid: React.FC = ({ casesPerPage }) => ( + <> + + + + + + {}} /> + +); + +export default CasesGrid; diff --git a/web/src/pages/Cases/Filters.tsx b/web/src/components/CasesDisplay/Filters.tsx similarity index 100% rename from web/src/pages/Cases/Filters.tsx rename to web/src/components/CasesDisplay/Filters.tsx diff --git a/web/src/pages/Cases/Search.tsx b/web/src/components/CasesDisplay/Search.tsx similarity index 100% rename from web/src/pages/Cases/Search.tsx rename to web/src/components/CasesDisplay/Search.tsx diff --git a/web/src/pages/Cases/Stats.tsx b/web/src/components/CasesDisplay/Stats.tsx similarity index 89% rename from web/src/pages/Cases/Stats.tsx rename to web/src/components/CasesDisplay/Stats.tsx index ef2185590..3d8e0b2aa 100644 --- a/web/src/pages/Cases/Stats.tsx +++ b/web/src/components/CasesDisplay/Stats.tsx @@ -32,10 +32,10 @@ const fields = [ const Stats: React.FC = () => (

{fields.map(({ label, value }, i) => ( - <> - + + {i + 1 < fields.length ? : null} - + ))}
); diff --git a/web/src/pages/Cases/StatsAndFilters.tsx b/web/src/components/CasesDisplay/StatsAndFilters.tsx similarity index 100% rename from web/src/pages/Cases/StatsAndFilters.tsx rename to web/src/components/CasesDisplay/StatsAndFilters.tsx diff --git a/web/src/components/CasesDisplay/index.tsx b/web/src/components/CasesDisplay/index.tsx new file mode 100644 index 000000000..d924a1bca --- /dev/null +++ b/web/src/components/CasesDisplay/index.tsx @@ -0,0 +1,31 @@ +import React from "react"; +import styled from "styled-components"; +import Search from "./Search"; +import StatsAndFilters from "./StatsAndFilters"; +import CasesGrid, { ICasesGrid } from "./CasesGrid"; + +const StyledHR = styled.hr` + margin-top: 24px; + margin-bottom: 24px; +`; + +interface ICasesDisplay extends ICasesGrid { + title?: string; + className?: string; +} + +const CasesDisplay: React.FC = ({ + casesPerPage, + title = "Cases", + className, +}) => ( +
+

{title}

+ + + + +
+); + +export default CasesDisplay; diff --git a/web/src/components/ConnectButton.tsx b/web/src/components/ConnectButton.tsx index cae2ffb7a..8f539c856 100644 --- a/web/src/components/ConnectButton.tsx +++ b/web/src/components/ConnectButton.tsx @@ -1,6 +1,52 @@ import React from "react"; +import styled from "styled-components"; +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"; -const ConnectButton: React.FC = () =>