From a80aad1e44326631c2eb541379c0f7a701193738 Mon Sep 17 00:00:00 2001 From: shotaronowhere Date: Tue, 17 Oct 2023 19:58:17 -0700 Subject: [PATCH 1/2] feat: notification schema and refactoring --- config/mainnet.json | 10 +- config/xdai.json | 10 +- contracts/KlerosLiquid.json | 737 ++++++ contracts/PolicyRegistry.json | 56 + contracts/kleros.json | 310 --- generated/Kleros/Kleros.ts | 513 ---- generated/KlerosLiquid/KlerosLiquid.ts | 2453 ++++++++++++++++++++ generated/PolicyRegistry/PolicyRegistry.ts | 167 ++ generated/schema.ts | 469 +++- mappings/arbitrable.ts | 87 + mappings/const.template.ts | 7 - mappings/index.ts | 233 -- mappings/kleros-liquid.ts | 287 +++ mappings/policy-registry.ts | 49 + package.json | 4 +- schema.graphql | 41 +- subgraph.template.yaml | 65 +- subgraph.yaml | 69 +- 18 files changed, 4452 insertions(+), 1115 deletions(-) create mode 100644 contracts/KlerosLiquid.json create mode 100644 contracts/PolicyRegistry.json delete mode 100644 contracts/kleros.json delete mode 100644 generated/Kleros/Kleros.ts create mode 100644 generated/KlerosLiquid/KlerosLiquid.ts create mode 100644 generated/PolicyRegistry/PolicyRegistry.ts create mode 100644 mappings/arbitrable.ts delete mode 100644 mappings/const.template.ts delete mode 100644 mappings/index.ts create mode 100644 mappings/kleros-liquid.ts create mode 100644 mappings/policy-registry.ts diff --git a/config/mainnet.json b/config/mainnet.json index 33c5b5d..b59fde2 100644 --- a/config/mainnet.json +++ b/config/mainnet.json @@ -1,5 +1,11 @@ { "chain": "mainnet", - "address": "0x988b3a538b618c7a603e1c11ab82cd16dbe28069", - "startBlock": "7303699" + "kleros": { + "address": "0x988b3A538b618C7A603e1c11Ab82Cd16dbE28069", + "startBlock": "7303699" + }, + "policyRegistry": { + "address": "0xcf1f07713d5193fae5c1653c9f61953d048bece4", + "startBlock": "10175794" + } } \ No newline at end of file diff --git a/config/xdai.json b/config/xdai.json index 529f478..0837736 100644 --- a/config/xdai.json +++ b/config/xdai.json @@ -1,5 +1,11 @@ { "chain": "xdai", - "address": "0x9c1da9a04925bdfdedf0f6421bc7eea8305f9002", - "startBlock": "16895601" + "kleros": { + "address": "0x9c1da9a04925bdfdedf0f6421bc7eea8305f9002", + "startBlock": "16895601" + }, + "policyRegistry": { + "address": "0x9d494768936b6bdaabc46733b8d53a937a6c6d7e", + "startBlock": "16895606" + } } \ No newline at end of file diff --git a/contracts/KlerosLiquid.json b/contracts/KlerosLiquid.json new file mode 100644 index 0000000..f54d2d4 --- /dev/null +++ b/contracts/KlerosLiquid.json @@ -0,0 +1,737 @@ +[ + { + "constant": false, + "inputs": [{ "name": "_pinakion", "type": "address" }], + "name": "changePinakion", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "RNBlock", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "disputesWithoutJurors", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [], + "name": "passPhase", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "governor", + "outputs": [{ "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "lastDelayedSetStake", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "_disputeID", "type": "uint256" }], + "name": "disputeStatus", + "outputs": [{ "name": "status", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "_disputeID", "type": "uint256" }], + "name": "passPeriod", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "maxDrawingTime", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "_disputeID", "type": "uint256" }], + "name": "currentRuling", + "outputs": [{ "name": "ruling", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "", "type": "uint256" }], + "name": "courts", + "outputs": [ + { "name": "parent", "type": "uint96" }, + { "name": "hiddenVotes", "type": "bool" }, + { "name": "minStake", "type": "uint256" }, + { "name": "alpha", "type": "uint256" }, + { "name": "feeForJuror", "type": "uint256" }, + { "name": "jurorsForCourtJump", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_disputeID", "type": "uint256" }, + { "name": "_appeal", "type": "uint256" }, + { "name": "_iterations", "type": "uint256" } + ], + "name": "execute", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "ALPHA_DIVISOR", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_disputeID", "type": "uint256" }, + { "name": "_voteIDs", "type": "uint256[]" }, + { "name": "_choice", "type": "uint256" }, + { "name": "_salt", "type": "uint256" } + ], + "name": "castVote", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_subcourtID", "type": "uint96" }, + { "name": "_minStake", "type": "uint256" } + ], + "name": "changeSubcourtMinStake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "_subcourtID", "type": "uint96" }], + "name": "getSubcourt", + "outputs": [ + { "name": "children", "type": "uint256[]" }, + { "name": "timesPerPeriod", "type": "uint256[4]" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_disputeID", "type": "uint256" }, + { "name": "_extraData", "type": "bytes" } + ], + "name": "appeal", + "outputs": [], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_from", "type": "address" }, + { "name": "_to", "type": "address" }, + { "name": "_amount", "type": "uint256" } + ], + "name": "onTransfer", + "outputs": [{ "name": "allowed", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "", "type": "uint256" }], + "name": "disputes", + "outputs": [ + { "name": "subcourtID", "type": "uint96" }, + { "name": "arbitrated", "type": "address" }, + { "name": "numberOfChoices", "type": "uint256" }, + { "name": "period", "type": "uint8" }, + { "name": "lastPeriodChange", "type": "uint256" }, + { "name": "drawsInRound", "type": "uint256" }, + { "name": "commitsInRound", "type": "uint256" }, + { "name": "ruled", "type": "bool" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_subcourtID", "type": "uint96" }, + { "name": "_timesPerPeriod", "type": "uint256[4]" } + ], + "name": "changeSubcourtTimesPerPeriod", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_subcourtID", "type": "uint96" }, + { "name": "_feeForJuror", "type": "uint256" } + ], + "name": "changeSubcourtJurorFee", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_subcourtID", "type": "uint96" }, + { "name": "_alpha", "type": "uint256" } + ], + "name": "changeSubcourtAlpha", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_disputeID", "type": "uint256" }, + { "name": "_voteIDs", "type": "uint256[]" }, + { "name": "_commit", "type": "bytes32" } + ], + "name": "castCommit", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "RN", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "RNGenerator", + "outputs": [{ "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_destination", "type": "address" }, + { "name": "_amount", "type": "uint256" }, + { "name": "_data", "type": "bytes" } + ], + "name": "executeGovernorProposal", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "_minStakingTime", "type": "uint256" }], + "name": "changeMinStakingTime", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "NON_PAYABLE_AMOUNT", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_subcourtID", "type": "uint96" }, + { "name": "_stake", "type": "uint128" } + ], + "name": "setStake", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "_disputeID", "type": "uint256" }], + "name": "executeRuling", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "name": "_disputeID", "type": "uint256" }, + { "name": "_appeal", "type": "uint256" }, + { "name": "_voteID", "type": "uint256" } + ], + "name": "getVote", + "outputs": [ + { "name": "account", "type": "address" }, + { "name": "commit", "type": "bytes32" }, + { "name": "choice", "type": "uint256" }, + { "name": "voted", "type": "bool" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "_RNGenerator", "type": "address" }], + "name": "changeRNGenerator", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "_iterations", "type": "uint256" }], + "name": "executeDelayedSetStakes", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "name": "_account", "type": "address" }, + { "name": "_subcourtID", "type": "uint96" } + ], + "name": "stakeOf", + "outputs": [{ "name": "stake", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_subcourtID", "type": "uint96" }, + { "name": "_jurorsForCourtJump", "type": "uint256" } + ], + "name": "changeSubcourtJurorsForJump", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "_disputeID", "type": "uint256" }], + "name": "appealPeriod", + "outputs": [ + { "name": "start", "type": "uint256" }, + { "name": "end", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "phase", + "outputs": [{ "name": "", "type": "uint8" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MAX_STAKE_PATHS", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "", "type": "uint256" }], + "name": "delayedSetStakes", + "outputs": [ + { "name": "account", "type": "address" }, + { "name": "subcourtID", "type": "uint96" }, + { "name": "stake", "type": "uint128" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "lastPhaseChange", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "minStakingTime", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "nextDelayedSetStake", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_numberOfChoices", "type": "uint256" }, + { "name": "_extraData", "type": "bytes" } + ], + "name": "createDispute", + "outputs": [{ "name": "disputeID", "type": "uint256" }], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_disputeID", "type": "uint256" }, + { "name": "_iterations", "type": "uint256" } + ], + "name": "drawJurors", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_parent", "type": "uint96" }, + { "name": "_hiddenVotes", "type": "bool" }, + { "name": "_minStake", "type": "uint256" }, + { "name": "_alpha", "type": "uint256" }, + { "name": "_feeForJuror", "type": "uint256" }, + { "name": "_jurorsForCourtJump", "type": "uint256" }, + { "name": "_timesPerPeriod", "type": "uint256[4]" }, + { "name": "_sortitionSumTreeK", "type": "uint256" } + ], + "name": "createSubcourt", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "_account", "type": "address" }], + "name": "getJuror", + "outputs": [{ "name": "subcourtIDs", "type": "uint96[]" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_owner", "type": "address" }, + { "name": "_spender", "type": "address" }, + { "name": "_amount", "type": "uint256" } + ], + "name": "onApprove", + "outputs": [{ "name": "allowed", "type": "bool" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "", "type": "address" }], + "name": "jurors", + "outputs": [ + { "name": "stakedTokens", "type": "uint256" }, + { "name": "lockedTokens", "type": "uint256" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "_maxDrawingTime", "type": "uint256" }], + "name": "changeMaxDrawingTime", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "_disputeID", "type": "uint256" }], + "name": "getDispute", + "outputs": [ + { "name": "votesLengths", "type": "uint256[]" }, + { "name": "tokensAtStakePerJuror", "type": "uint256[]" }, + { "name": "totalFeesForJurors", "type": "uint256[]" }, + { "name": "votesInEachRound", "type": "uint256[]" }, + { "name": "repartitionsInEachRound", "type": "uint256[]" }, + { "name": "penaltiesInEachRound", "type": "uint256[]" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "name": "_disputeID", "type": "uint256" }, + { "name": "_appeal", "type": "uint256" } + ], + "name": "getVoteCounter", + "outputs": [ + { "name": "winningChoice", "type": "uint256" }, + { "name": "counts", "type": "uint256[]" }, + { "name": "tied", "type": "bool" } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "_governor", "type": "address" }], + "name": "changeGovernor", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "MIN_JURORS", + "outputs": [{ "name": "", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [ + { "name": "_disputeID", "type": "uint256" }, + { "name": "_extraData", "type": "bytes" } + ], + "name": "appealCost", + "outputs": [{ "name": "cost", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "_owner", "type": "address" }], + "name": "proxyPayment", + "outputs": [{ "name": "allowed", "type": "bool" }], + "payable": true, + "stateMutability": "payable", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "lockInsolventTransfers", + "outputs": [{ "name": "", "type": "bool" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "_extraData", "type": "bytes" }], + "name": "arbitrationCost", + "outputs": [{ "name": "cost", "type": "uint256" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "pinakion", + "outputs": [{ "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "name": "_governor", "type": "address" }, + { "name": "_pinakion", "type": "address" }, + { "name": "_RNGenerator", "type": "address" }, + { "name": "_minStakingTime", "type": "uint256" }, + { "name": "_maxDrawingTime", "type": "uint256" }, + { "name": "_hiddenVotes", "type": "bool" }, + { "name": "_minStake", "type": "uint256" }, + { "name": "_alpha", "type": "uint256" }, + { "name": "_feeForJuror", "type": "uint256" }, + { "name": "_jurorsForCourtJump", "type": "uint256" }, + { "name": "_timesPerPeriod", "type": "uint256[4]" }, + { "name": "_sortitionSumTreeK", "type": "uint256" } + ], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [{ "indexed": false, "name": "_phase", "type": "uint8" }], + "name": "NewPhase", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "_disputeID", "type": "uint256" }, + { "indexed": false, "name": "_period", "type": "uint8" } + ], + "name": "NewPeriod", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "_address", "type": "address" }, + { "indexed": false, "name": "_subcourtID", "type": "uint256" }, + { "indexed": false, "name": "_stake", "type": "uint128" }, + { "indexed": false, "name": "_newTotalStake", "type": "uint256" } + ], + "name": "StakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "_address", "type": "address" }, + { "indexed": true, "name": "_disputeID", "type": "uint256" }, + { "indexed": false, "name": "_appeal", "type": "uint256" }, + { "indexed": false, "name": "_voteID", "type": "uint256" } + ], + "name": "Draw", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "_address", "type": "address" }, + { "indexed": true, "name": "_disputeID", "type": "uint256" }, + { "indexed": false, "name": "_tokenAmount", "type": "int256" }, + { "indexed": false, "name": "_ETHAmount", "type": "int256" } + ], + "name": "TokenAndETHShift", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "_disputeID", "type": "uint256" }, + { "indexed": true, "name": "_arbitrable", "type": "address" } + ], + "name": "DisputeCreation", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "_disputeID", "type": "uint256" }, + { "indexed": true, "name": "_arbitrable", "type": "address" } + ], + "name": "AppealPossible", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "_disputeID", "type": "uint256" }, + { "indexed": true, "name": "_arbitrable", "type": "address" } + ], + "name": "AppealDecision", + "type": "event" + } +] diff --git a/contracts/PolicyRegistry.json b/contracts/PolicyRegistry.json new file mode 100644 index 0000000..cd5aa67 --- /dev/null +++ b/contracts/PolicyRegistry.json @@ -0,0 +1,56 @@ +[ + { + "constant": true, + "inputs": [], + "name": "governor", + "outputs": [{ "name": "", "type": "address" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [{ "name": "", "type": "uint256" }], + "name": "policies", + "outputs": [{ "name": "", "type": "string" }], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": false, + "inputs": [{ "name": "_governor", "type": "address" }], + "name": "changeGovernor", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { "name": "_subcourtID", "type": "uint256" }, + { "name": "_policy", "type": "string" } + ], + "name": "setPolicy", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [{ "name": "_governor", "type": "address" }], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { "indexed": true, "name": "_subcourtID", "type": "uint256" }, + { "indexed": false, "name": "_policy", "type": "string" } + ], + "name": "PolicyUpdate", + "type": "event" + } +] diff --git a/contracts/kleros.json b/contracts/kleros.json deleted file mode 100644 index cb7e104..0000000 --- a/contracts/kleros.json +++ /dev/null @@ -1,310 +0,0 @@ -[ - { - "constant": true, - "inputs": [ - { - "name": "_disputeID", - "type": "uint256" - } - ], - "name": "disputeStatus", - "outputs": [ - { - "name": "status", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_disputeID", - "type": "uint256" - } - ], - "name": "currentRuling", - "outputs": [ - { - "name": "ruling", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_disputeID", - "type": "uint256" - }, - { - "name": "_extraData", - "type": "bytes" - } - ], - "name": "appeal", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_disputeID", - "type": "uint256" - } - ], - "name": "appealPeriod", - "outputs": [ - { - "name": "start", - "type": "uint256" - }, - { - "name": "end", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_choices", - "type": "uint256" - }, - { - "name": "_extraData", - "type": "bytes" - } - ], - "name": "createDispute", - "outputs": [ - { - "name": "disputeID", - "type": "uint256" - } - ], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_disputeID", - "type": "uint256" - }, - { - "name": "_extraData", - "type": "bytes" - } - ], - "name": "appealCost", - "outputs": [ - { - "name": "fee", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_extraData", - "type": "bytes" - } - ], - "name": "arbitrationCost", - "outputs": [ - { - "name": "fee", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_disputeID", - "type": "uint256" - }, - { - "indexed": true, - "name": "_arbitrable", - "type": "address" - } - ], - "name": "DisputeCreation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_disputeID", - "type": "uint256" - }, - { - "indexed": true, - "name": "_arbitrable", - "type": "address" - } - ], - "name": "AppealPossible", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_disputeID", - "type": "uint256" - }, - { - "indexed": true, - "name": "_arbitrable", - "type": "address" - } - ], - "name": "AppealDecision", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_disputeID", - "type": "uint256" - }, - { - "name": "_period", - "type": "uint8" - } - ], - "name": "NewPeriod", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_address", - "type": "address" - }, - { - "indexed": true, - "name": "_disputeID", - "type": "uint256" - }, - { - "name": "_appeal", - "type": "uint256" - }, - { - "name": "_voteID", - "type": "uint256" - } - ], - "name": "Draw", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "_address", - "type": "address" - }, - { - "indexed": true, - "name": "_disputeID", - "type": "uint256" - }, - { - "name": "_tokenAmount", - "type": "int256" - }, - { - "name": "_ETHAmount", - "type": "int256" - } - ], - "name": "TokenAndETHShift", - "type": "event" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "disputes", - "outputs": [ - { - "name": "subcourtID", - "type": "uint96" - }, - { - "name": "arbitrated", - "type": "address" - }, - { - "name": "numberOfChoices", - "type": "uint256" - }, - { - "name": "period", - "type": "uint8" - }, - { - "name": "lastPeriodChange", - "type": "uint256" - }, - { - "name": "drawsInRound", - "type": "uint256" - }, - { - "name": "commitsInRound", - "type": "uint256" - }, - { - "name": "ruled", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/generated/Kleros/Kleros.ts b/generated/Kleros/Kleros.ts deleted file mode 100644 index 6f36460..0000000 --- a/generated/Kleros/Kleros.ts +++ /dev/null @@ -1,513 +0,0 @@ -// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. - -import { - ethereum, - JSONValue, - TypedMap, - Entity, - Bytes, - Address, - BigInt -} from "@graphprotocol/graph-ts"; - -export class DisputeCreation extends ethereum.Event { - get params(): DisputeCreation__Params { - return new DisputeCreation__Params(this); - } -} - -export class DisputeCreation__Params { - _event: DisputeCreation; - - constructor(event: DisputeCreation) { - this._event = event; - } - - get _disputeID(): BigInt { - return this._event.parameters[0].value.toBigInt(); - } - - get _arbitrable(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class AppealPossible extends ethereum.Event { - get params(): AppealPossible__Params { - return new AppealPossible__Params(this); - } -} - -export class AppealPossible__Params { - _event: AppealPossible; - - constructor(event: AppealPossible) { - this._event = event; - } - - get _disputeID(): BigInt { - return this._event.parameters[0].value.toBigInt(); - } - - get _arbitrable(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class AppealDecision extends ethereum.Event { - get params(): AppealDecision__Params { - return new AppealDecision__Params(this); - } -} - -export class AppealDecision__Params { - _event: AppealDecision; - - constructor(event: AppealDecision) { - this._event = event; - } - - get _disputeID(): BigInt { - return this._event.parameters[0].value.toBigInt(); - } - - get _arbitrable(): Address { - return this._event.parameters[1].value.toAddress(); - } -} - -export class NewPeriod extends ethereum.Event { - get params(): NewPeriod__Params { - return new NewPeriod__Params(this); - } -} - -export class NewPeriod__Params { - _event: NewPeriod; - - constructor(event: NewPeriod) { - this._event = event; - } - - get _disputeID(): BigInt { - return this._event.parameters[0].value.toBigInt(); - } - - get _period(): i32 { - return this._event.parameters[1].value.toI32(); - } -} - -export class Draw extends ethereum.Event { - get params(): Draw__Params { - return new Draw__Params(this); - } -} - -export class Draw__Params { - _event: Draw; - - constructor(event: Draw) { - this._event = event; - } - - get _address(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get _disputeID(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get _appeal(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get _voteID(): BigInt { - return this._event.parameters[3].value.toBigInt(); - } -} - -export class TokenAndETHShift extends ethereum.Event { - get params(): TokenAndETHShift__Params { - return new TokenAndETHShift__Params(this); - } -} - -export class TokenAndETHShift__Params { - _event: TokenAndETHShift; - - constructor(event: TokenAndETHShift) { - this._event = event; - } - - get _address(): Address { - return this._event.parameters[0].value.toAddress(); - } - - get _disputeID(): BigInt { - return this._event.parameters[1].value.toBigInt(); - } - - get _tokenAmount(): BigInt { - return this._event.parameters[2].value.toBigInt(); - } - - get _ETHAmount(): BigInt { - return this._event.parameters[3].value.toBigInt(); - } -} - -export class Kleros__appealPeriodResult { - value0: BigInt; - value1: BigInt; - - constructor(value0: BigInt, value1: BigInt) { - this.value0 = value0; - this.value1 = value1; - } - - toMap(): TypedMap { - let map = new TypedMap(); - map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0)); - map.set("value1", ethereum.Value.fromUnsignedBigInt(this.value1)); - return map; - } - - getStart(): BigInt { - return this.value0; - } - - getEnd(): BigInt { - return this.value1; - } -} - -export class Kleros__disputesResult { - value0: BigInt; - value1: Address; - value2: BigInt; - value3: i32; - value4: BigInt; - value5: BigInt; - value6: BigInt; - value7: boolean; - - constructor( - value0: BigInt, - value1: Address, - value2: BigInt, - value3: i32, - value4: BigInt, - value5: BigInt, - value6: BigInt, - value7: boolean - ) { - this.value0 = value0; - this.value1 = value1; - this.value2 = value2; - this.value3 = value3; - this.value4 = value4; - this.value5 = value5; - this.value6 = value6; - this.value7 = value7; - } - - toMap(): TypedMap { - let map = new TypedMap(); - map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0)); - map.set("value1", ethereum.Value.fromAddress(this.value1)); - map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2)); - map.set( - "value3", - ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(this.value3)) - ); - map.set("value4", ethereum.Value.fromUnsignedBigInt(this.value4)); - map.set("value5", ethereum.Value.fromUnsignedBigInt(this.value5)); - map.set("value6", ethereum.Value.fromUnsignedBigInt(this.value6)); - map.set("value7", ethereum.Value.fromBoolean(this.value7)); - return map; - } - - getSubcourtID(): BigInt { - return this.value0; - } - - getArbitrated(): Address { - return this.value1; - } - - getNumberOfChoices(): BigInt { - return this.value2; - } - - getPeriod(): i32 { - return this.value3; - } - - getLastPeriodChange(): BigInt { - return this.value4; - } - - getDrawsInRound(): BigInt { - return this.value5; - } - - getCommitsInRound(): BigInt { - return this.value6; - } - - getRuled(): boolean { - return this.value7; - } -} - -export class Kleros extends ethereum.SmartContract { - static bind(address: Address): Kleros { - return new Kleros("Kleros", address); - } - - disputeStatus(_disputeID: BigInt): i32 { - let result = super.call("disputeStatus", "disputeStatus(uint256):(uint8)", [ - ethereum.Value.fromUnsignedBigInt(_disputeID) - ]); - - return result[0].toI32(); - } - - try_disputeStatus(_disputeID: BigInt): ethereum.CallResult { - let result = super.tryCall( - "disputeStatus", - "disputeStatus(uint256):(uint8)", - [ethereum.Value.fromUnsignedBigInt(_disputeID)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toI32()); - } - - currentRuling(_disputeID: BigInt): BigInt { - let result = super.call( - "currentRuling", - "currentRuling(uint256):(uint256)", - [ethereum.Value.fromUnsignedBigInt(_disputeID)] - ); - - return result[0].toBigInt(); - } - - try_currentRuling(_disputeID: BigInt): ethereum.CallResult { - let result = super.tryCall( - "currentRuling", - "currentRuling(uint256):(uint256)", - [ethereum.Value.fromUnsignedBigInt(_disputeID)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - appealPeriod(_disputeID: BigInt): Kleros__appealPeriodResult { - let result = super.call( - "appealPeriod", - "appealPeriod(uint256):(uint256,uint256)", - [ethereum.Value.fromUnsignedBigInt(_disputeID)] - ); - - return new Kleros__appealPeriodResult( - result[0].toBigInt(), - result[1].toBigInt() - ); - } - - try_appealPeriod( - _disputeID: BigInt - ): ethereum.CallResult { - let result = super.tryCall( - "appealPeriod", - "appealPeriod(uint256):(uint256,uint256)", - [ethereum.Value.fromUnsignedBigInt(_disputeID)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue( - new Kleros__appealPeriodResult(value[0].toBigInt(), value[1].toBigInt()) - ); - } - - appealCost(_disputeID: BigInt, _extraData: Bytes): BigInt { - let result = super.call( - "appealCost", - "appealCost(uint256,bytes):(uint256)", - [ - ethereum.Value.fromUnsignedBigInt(_disputeID), - ethereum.Value.fromBytes(_extraData) - ] - ); - - return result[0].toBigInt(); - } - - try_appealCost( - _disputeID: BigInt, - _extraData: Bytes - ): ethereum.CallResult { - let result = super.tryCall( - "appealCost", - "appealCost(uint256,bytes):(uint256)", - [ - ethereum.Value.fromUnsignedBigInt(_disputeID), - ethereum.Value.fromBytes(_extraData) - ] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - arbitrationCost(_extraData: Bytes): BigInt { - let result = super.call( - "arbitrationCost", - "arbitrationCost(bytes):(uint256)", - [ethereum.Value.fromBytes(_extraData)] - ); - - return result[0].toBigInt(); - } - - try_arbitrationCost(_extraData: Bytes): ethereum.CallResult { - let result = super.tryCall( - "arbitrationCost", - "arbitrationCost(bytes):(uint256)", - [ethereum.Value.fromBytes(_extraData)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue(value[0].toBigInt()); - } - - disputes(param0: BigInt): Kleros__disputesResult { - let result = super.call( - "disputes", - "disputes(uint256):(uint96,address,uint256,uint8,uint256,uint256,uint256,bool)", - [ethereum.Value.fromUnsignedBigInt(param0)] - ); - - return new Kleros__disputesResult( - result[0].toBigInt(), - result[1].toAddress(), - result[2].toBigInt(), - result[3].toI32(), - result[4].toBigInt(), - result[5].toBigInt(), - result[6].toBigInt(), - result[7].toBoolean() - ); - } - - try_disputes(param0: BigInt): ethereum.CallResult { - let result = super.tryCall( - "disputes", - "disputes(uint256):(uint96,address,uint256,uint8,uint256,uint256,uint256,bool)", - [ethereum.Value.fromUnsignedBigInt(param0)] - ); - if (result.reverted) { - return new ethereum.CallResult(); - } - let value = result.value; - return ethereum.CallResult.fromValue( - new Kleros__disputesResult( - value[0].toBigInt(), - value[1].toAddress(), - value[2].toBigInt(), - value[3].toI32(), - value[4].toBigInt(), - value[5].toBigInt(), - value[6].toBigInt(), - value[7].toBoolean() - ) - ); - } -} - -export class AppealCall extends ethereum.Call { - get inputs(): AppealCall__Inputs { - return new AppealCall__Inputs(this); - } - - get outputs(): AppealCall__Outputs { - return new AppealCall__Outputs(this); - } -} - -export class AppealCall__Inputs { - _call: AppealCall; - - constructor(call: AppealCall) { - this._call = call; - } - - get _disputeID(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } - - get _extraData(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class AppealCall__Outputs { - _call: AppealCall; - - constructor(call: AppealCall) { - this._call = call; - } -} - -export class CreateDisputeCall extends ethereum.Call { - get inputs(): CreateDisputeCall__Inputs { - return new CreateDisputeCall__Inputs(this); - } - - get outputs(): CreateDisputeCall__Outputs { - return new CreateDisputeCall__Outputs(this); - } -} - -export class CreateDisputeCall__Inputs { - _call: CreateDisputeCall; - - constructor(call: CreateDisputeCall) { - this._call = call; - } - - get _choices(): BigInt { - return this._call.inputValues[0].value.toBigInt(); - } - - get _extraData(): Bytes { - return this._call.inputValues[1].value.toBytes(); - } -} - -export class CreateDisputeCall__Outputs { - _call: CreateDisputeCall; - - constructor(call: CreateDisputeCall) { - this._call = call; - } - - get disputeID(): BigInt { - return this._call.outputValues[0].value.toBigInt(); - } -} diff --git a/generated/KlerosLiquid/KlerosLiquid.ts b/generated/KlerosLiquid/KlerosLiquid.ts new file mode 100644 index 0000000..d894fac --- /dev/null +++ b/generated/KlerosLiquid/KlerosLiquid.ts @@ -0,0 +1,2453 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + ethereum, + JSONValue, + TypedMap, + Entity, + Bytes, + Address, + BigInt +} from "@graphprotocol/graph-ts"; + +export class NewPhase extends ethereum.Event { + get params(): NewPhase__Params { + return new NewPhase__Params(this); + } +} + +export class NewPhase__Params { + _event: NewPhase; + + constructor(event: NewPhase) { + this._event = event; + } + + get _phase(): i32 { + return this._event.parameters[0].value.toI32(); + } +} + +export class NewPeriod extends ethereum.Event { + get params(): NewPeriod__Params { + return new NewPeriod__Params(this); + } +} + +export class NewPeriod__Params { + _event: NewPeriod; + + constructor(event: NewPeriod) { + this._event = event; + } + + get _disputeID(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get _period(): i32 { + return this._event.parameters[1].value.toI32(); + } +} + +export class StakeSet extends ethereum.Event { + get params(): StakeSet__Params { + return new StakeSet__Params(this); + } +} + +export class StakeSet__Params { + _event: StakeSet; + + constructor(event: StakeSet) { + this._event = event; + } + + get _address(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get _subcourtID(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get _stake(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get _newTotalStake(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class Draw extends ethereum.Event { + get params(): Draw__Params { + return new Draw__Params(this); + } +} + +export class Draw__Params { + _event: Draw; + + constructor(event: Draw) { + this._event = event; + } + + get _address(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get _disputeID(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get _appeal(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get _voteID(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class TokenAndETHShift extends ethereum.Event { + get params(): TokenAndETHShift__Params { + return new TokenAndETHShift__Params(this); + } +} + +export class TokenAndETHShift__Params { + _event: TokenAndETHShift; + + constructor(event: TokenAndETHShift) { + this._event = event; + } + + get _address(): Address { + return this._event.parameters[0].value.toAddress(); + } + + get _disputeID(): BigInt { + return this._event.parameters[1].value.toBigInt(); + } + + get _tokenAmount(): BigInt { + return this._event.parameters[2].value.toBigInt(); + } + + get _ETHAmount(): BigInt { + return this._event.parameters[3].value.toBigInt(); + } +} + +export class DisputeCreation extends ethereum.Event { + get params(): DisputeCreation__Params { + return new DisputeCreation__Params(this); + } +} + +export class DisputeCreation__Params { + _event: DisputeCreation; + + constructor(event: DisputeCreation) { + this._event = event; + } + + get _disputeID(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get _arbitrable(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class AppealPossible extends ethereum.Event { + get params(): AppealPossible__Params { + return new AppealPossible__Params(this); + } +} + +export class AppealPossible__Params { + _event: AppealPossible; + + constructor(event: AppealPossible) { + this._event = event; + } + + get _disputeID(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get _arbitrable(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class AppealDecision extends ethereum.Event { + get params(): AppealDecision__Params { + return new AppealDecision__Params(this); + } +} + +export class AppealDecision__Params { + _event: AppealDecision; + + constructor(event: AppealDecision) { + this._event = event; + } + + get _disputeID(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get _arbitrable(): Address { + return this._event.parameters[1].value.toAddress(); + } +} + +export class KlerosLiquid__courtsResult { + value0: BigInt; + value1: boolean; + value2: BigInt; + value3: BigInt; + value4: BigInt; + value5: BigInt; + + constructor( + value0: BigInt, + value1: boolean, + value2: BigInt, + value3: BigInt, + value4: BigInt, + value5: BigInt + ) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + this.value4 = value4; + this.value5 = value5; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set("value1", ethereum.Value.fromBoolean(this.value1)); + map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2)); + map.set("value3", ethereum.Value.fromUnsignedBigInt(this.value3)); + map.set("value4", ethereum.Value.fromUnsignedBigInt(this.value4)); + map.set("value5", ethereum.Value.fromUnsignedBigInt(this.value5)); + return map; + } + + getParent(): BigInt { + return this.value0; + } + + getHiddenVotes(): boolean { + return this.value1; + } + + getMinStake(): BigInt { + return this.value2; + } + + getAlpha(): BigInt { + return this.value3; + } + + getFeeForJuror(): BigInt { + return this.value4; + } + + getJurorsForCourtJump(): BigInt { + return this.value5; + } +} + +export class KlerosLiquid__getSubcourtResult { + value0: Array; + value1: Array; + + constructor(value0: Array, value1: Array) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromUnsignedBigIntArray(this.value0)); + map.set("value1", ethereum.Value.fromUnsignedBigIntArray(this.value1)); + return map; + } + + getChildren(): Array { + return this.value0; + } + + getTimesPerPeriod(): Array { + return this.value1; + } +} + +export class KlerosLiquid__disputesResult { + value0: BigInt; + value1: Address; + value2: BigInt; + value3: i32; + value4: BigInt; + value5: BigInt; + value6: BigInt; + value7: boolean; + + constructor( + value0: BigInt, + value1: Address, + value2: BigInt, + value3: i32, + value4: BigInt, + value5: BigInt, + value6: BigInt, + value7: boolean + ) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + this.value4 = value4; + this.value5 = value5; + this.value6 = value6; + this.value7 = value7; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set("value1", ethereum.Value.fromAddress(this.value1)); + map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2)); + map.set( + "value3", + ethereum.Value.fromUnsignedBigInt(BigInt.fromI32(this.value3)) + ); + map.set("value4", ethereum.Value.fromUnsignedBigInt(this.value4)); + map.set("value5", ethereum.Value.fromUnsignedBigInt(this.value5)); + map.set("value6", ethereum.Value.fromUnsignedBigInt(this.value6)); + map.set("value7", ethereum.Value.fromBoolean(this.value7)); + return map; + } + + getSubcourtID(): BigInt { + return this.value0; + } + + getArbitrated(): Address { + return this.value1; + } + + getNumberOfChoices(): BigInt { + return this.value2; + } + + getPeriod(): i32 { + return this.value3; + } + + getLastPeriodChange(): BigInt { + return this.value4; + } + + getDrawsInRound(): BigInt { + return this.value5; + } + + getCommitsInRound(): BigInt { + return this.value6; + } + + getRuled(): boolean { + return this.value7; + } +} + +export class KlerosLiquid__getVoteResult { + value0: Address; + value1: Bytes; + value2: BigInt; + value3: boolean; + + constructor(value0: Address, value1: Bytes, value2: BigInt, value3: boolean) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromAddress(this.value0)); + map.set("value1", ethereum.Value.fromFixedBytes(this.value1)); + map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2)); + map.set("value3", ethereum.Value.fromBoolean(this.value3)); + return map; + } + + getAccount(): Address { + return this.value0; + } + + getCommit(): Bytes { + return this.value1; + } + + getChoice(): BigInt { + return this.value2; + } + + getVoted(): boolean { + return this.value3; + } +} + +export class KlerosLiquid__appealPeriodResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set("value1", ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getStart(): BigInt { + return this.value0; + } + + getEnd(): BigInt { + return this.value1; + } +} + +export class KlerosLiquid__delayedSetStakesResult { + value0: Address; + value1: BigInt; + value2: BigInt; + + constructor(value0: Address, value1: BigInt, value2: BigInt) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromAddress(this.value0)); + map.set("value1", ethereum.Value.fromUnsignedBigInt(this.value1)); + map.set("value2", ethereum.Value.fromUnsignedBigInt(this.value2)); + return map; + } + + getAccount(): Address { + return this.value0; + } + + getSubcourtID(): BigInt { + return this.value1; + } + + getStake(): BigInt { + return this.value2; + } +} + +export class KlerosLiquid__jurorsResult { + value0: BigInt; + value1: BigInt; + + constructor(value0: BigInt, value1: BigInt) { + this.value0 = value0; + this.value1 = value1; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set("value1", ethereum.Value.fromUnsignedBigInt(this.value1)); + return map; + } + + getStakedTokens(): BigInt { + return this.value0; + } + + getLockedTokens(): BigInt { + return this.value1; + } +} + +export class KlerosLiquid__getDisputeResult { + value0: Array; + value1: Array; + value2: Array; + value3: Array; + value4: Array; + value5: Array; + + constructor( + value0: Array, + value1: Array, + value2: Array, + value3: Array, + value4: Array, + value5: Array + ) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + this.value3 = value3; + this.value4 = value4; + this.value5 = value5; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromUnsignedBigIntArray(this.value0)); + map.set("value1", ethereum.Value.fromUnsignedBigIntArray(this.value1)); + map.set("value2", ethereum.Value.fromUnsignedBigIntArray(this.value2)); + map.set("value3", ethereum.Value.fromUnsignedBigIntArray(this.value3)); + map.set("value4", ethereum.Value.fromUnsignedBigIntArray(this.value4)); + map.set("value5", ethereum.Value.fromUnsignedBigIntArray(this.value5)); + return map; + } + + getVotesLengths(): Array { + return this.value0; + } + + getTokensAtStakePerJuror(): Array { + return this.value1; + } + + getTotalFeesForJurors(): Array { + return this.value2; + } + + getVotesInEachRound(): Array { + return this.value3; + } + + getRepartitionsInEachRound(): Array { + return this.value4; + } + + getPenaltiesInEachRound(): Array { + return this.value5; + } +} + +export class KlerosLiquid__getVoteCounterResult { + value0: BigInt; + value1: Array; + value2: boolean; + + constructor(value0: BigInt, value1: Array, value2: boolean) { + this.value0 = value0; + this.value1 = value1; + this.value2 = value2; + } + + toMap(): TypedMap { + let map = new TypedMap(); + map.set("value0", ethereum.Value.fromUnsignedBigInt(this.value0)); + map.set("value1", ethereum.Value.fromUnsignedBigIntArray(this.value1)); + map.set("value2", ethereum.Value.fromBoolean(this.value2)); + return map; + } + + getWinningChoice(): BigInt { + return this.value0; + } + + getCounts(): Array { + return this.value1; + } + + getTied(): boolean { + return this.value2; + } +} + +export class KlerosLiquid extends ethereum.SmartContract { + static bind(address: Address): KlerosLiquid { + return new KlerosLiquid("KlerosLiquid", address); + } + + RNBlock(): BigInt { + let result = super.call("RNBlock", "RNBlock():(uint256)", []); + + return result[0].toBigInt(); + } + + try_RNBlock(): ethereum.CallResult { + let result = super.tryCall("RNBlock", "RNBlock():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + disputesWithoutJurors(): BigInt { + let result = super.call( + "disputesWithoutJurors", + "disputesWithoutJurors():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_disputesWithoutJurors(): ethereum.CallResult { + let result = super.tryCall( + "disputesWithoutJurors", + "disputesWithoutJurors():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + governor(): Address { + let result = super.call("governor", "governor():(address)", []); + + return result[0].toAddress(); + } + + try_governor(): ethereum.CallResult
{ + let result = super.tryCall("governor", "governor():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + lastDelayedSetStake(): BigInt { + let result = super.call( + "lastDelayedSetStake", + "lastDelayedSetStake():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_lastDelayedSetStake(): ethereum.CallResult { + let result = super.tryCall( + "lastDelayedSetStake", + "lastDelayedSetStake():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + disputeStatus(_disputeID: BigInt): i32 { + let result = super.call("disputeStatus", "disputeStatus(uint256):(uint8)", [ + ethereum.Value.fromUnsignedBigInt(_disputeID) + ]); + + return result[0].toI32(); + } + + try_disputeStatus(_disputeID: BigInt): ethereum.CallResult { + let result = super.tryCall( + "disputeStatus", + "disputeStatus(uint256):(uint8)", + [ethereum.Value.fromUnsignedBigInt(_disputeID)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toI32()); + } + + maxDrawingTime(): BigInt { + let result = super.call("maxDrawingTime", "maxDrawingTime():(uint256)", []); + + return result[0].toBigInt(); + } + + try_maxDrawingTime(): ethereum.CallResult { + let result = super.tryCall( + "maxDrawingTime", + "maxDrawingTime():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + currentRuling(_disputeID: BigInt): BigInt { + let result = super.call( + "currentRuling", + "currentRuling(uint256):(uint256)", + [ethereum.Value.fromUnsignedBigInt(_disputeID)] + ); + + return result[0].toBigInt(); + } + + try_currentRuling(_disputeID: BigInt): ethereum.CallResult { + let result = super.tryCall( + "currentRuling", + "currentRuling(uint256):(uint256)", + [ethereum.Value.fromUnsignedBigInt(_disputeID)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + courts(param0: BigInt): KlerosLiquid__courtsResult { + let result = super.call( + "courts", + "courts(uint256):(uint96,bool,uint256,uint256,uint256,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + + return new KlerosLiquid__courtsResult( + result[0].toBigInt(), + result[1].toBoolean(), + result[2].toBigInt(), + result[3].toBigInt(), + result[4].toBigInt(), + result[5].toBigInt() + ); + } + + try_courts(param0: BigInt): ethereum.CallResult { + let result = super.tryCall( + "courts", + "courts(uint256):(uint96,bool,uint256,uint256,uint256,uint256)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new KlerosLiquid__courtsResult( + value[0].toBigInt(), + value[1].toBoolean(), + value[2].toBigInt(), + value[3].toBigInt(), + value[4].toBigInt(), + value[5].toBigInt() + ) + ); + } + + ALPHA_DIVISOR(): BigInt { + let result = super.call("ALPHA_DIVISOR", "ALPHA_DIVISOR():(uint256)", []); + + return result[0].toBigInt(); + } + + try_ALPHA_DIVISOR(): ethereum.CallResult { + let result = super.tryCall( + "ALPHA_DIVISOR", + "ALPHA_DIVISOR():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getSubcourt(_subcourtID: BigInt): KlerosLiquid__getSubcourtResult { + let result = super.call( + "getSubcourt", + "getSubcourt(uint96):(uint256[],uint256[4])", + [ethereum.Value.fromUnsignedBigInt(_subcourtID)] + ); + + return new KlerosLiquid__getSubcourtResult( + result[0].toBigIntArray(), + result[1].toBigIntArray() + ); + } + + try_getSubcourt( + _subcourtID: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "getSubcourt", + "getSubcourt(uint96):(uint256[],uint256[4])", + [ethereum.Value.fromUnsignedBigInt(_subcourtID)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new KlerosLiquid__getSubcourtResult( + value[0].toBigIntArray(), + value[1].toBigIntArray() + ) + ); + } + + onTransfer(_from: Address, _to: Address, _amount: BigInt): boolean { + let result = super.call( + "onTransfer", + "onTransfer(address,address,uint256):(bool)", + [ + ethereum.Value.fromAddress(_from), + ethereum.Value.fromAddress(_to), + ethereum.Value.fromUnsignedBigInt(_amount) + ] + ); + + return result[0].toBoolean(); + } + + try_onTransfer( + _from: Address, + _to: Address, + _amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "onTransfer", + "onTransfer(address,address,uint256):(bool)", + [ + ethereum.Value.fromAddress(_from), + ethereum.Value.fromAddress(_to), + ethereum.Value.fromUnsignedBigInt(_amount) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + disputes(param0: BigInt): KlerosLiquid__disputesResult { + let result = super.call( + "disputes", + "disputes(uint256):(uint96,address,uint256,uint8,uint256,uint256,uint256,bool)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + + return new KlerosLiquid__disputesResult( + result[0].toBigInt(), + result[1].toAddress(), + result[2].toBigInt(), + result[3].toI32(), + result[4].toBigInt(), + result[5].toBigInt(), + result[6].toBigInt(), + result[7].toBoolean() + ); + } + + try_disputes( + param0: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "disputes", + "disputes(uint256):(uint96,address,uint256,uint8,uint256,uint256,uint256,bool)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new KlerosLiquid__disputesResult( + value[0].toBigInt(), + value[1].toAddress(), + value[2].toBigInt(), + value[3].toI32(), + value[4].toBigInt(), + value[5].toBigInt(), + value[6].toBigInt(), + value[7].toBoolean() + ) + ); + } + + RN(): BigInt { + let result = super.call("RN", "RN():(uint256)", []); + + return result[0].toBigInt(); + } + + try_RN(): ethereum.CallResult { + let result = super.tryCall("RN", "RN():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + RNGenerator(): Address { + let result = super.call("RNGenerator", "RNGenerator():(address)", []); + + return result[0].toAddress(); + } + + try_RNGenerator(): ethereum.CallResult
{ + let result = super.tryCall("RNGenerator", "RNGenerator():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + NON_PAYABLE_AMOUNT(): BigInt { + let result = super.call( + "NON_PAYABLE_AMOUNT", + "NON_PAYABLE_AMOUNT():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_NON_PAYABLE_AMOUNT(): ethereum.CallResult { + let result = super.tryCall( + "NON_PAYABLE_AMOUNT", + "NON_PAYABLE_AMOUNT():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getVote( + _disputeID: BigInt, + _appeal: BigInt, + _voteID: BigInt + ): KlerosLiquid__getVoteResult { + let result = super.call( + "getVote", + "getVote(uint256,uint256,uint256):(address,bytes32,uint256,bool)", + [ + ethereum.Value.fromUnsignedBigInt(_disputeID), + ethereum.Value.fromUnsignedBigInt(_appeal), + ethereum.Value.fromUnsignedBigInt(_voteID) + ] + ); + + return new KlerosLiquid__getVoteResult( + result[0].toAddress(), + result[1].toBytes(), + result[2].toBigInt(), + result[3].toBoolean() + ); + } + + try_getVote( + _disputeID: BigInt, + _appeal: BigInt, + _voteID: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "getVote", + "getVote(uint256,uint256,uint256):(address,bytes32,uint256,bool)", + [ + ethereum.Value.fromUnsignedBigInt(_disputeID), + ethereum.Value.fromUnsignedBigInt(_appeal), + ethereum.Value.fromUnsignedBigInt(_voteID) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new KlerosLiquid__getVoteResult( + value[0].toAddress(), + value[1].toBytes(), + value[2].toBigInt(), + value[3].toBoolean() + ) + ); + } + + stakeOf(_account: Address, _subcourtID: BigInt): BigInt { + let result = super.call("stakeOf", "stakeOf(address,uint96):(uint256)", [ + ethereum.Value.fromAddress(_account), + ethereum.Value.fromUnsignedBigInt(_subcourtID) + ]); + + return result[0].toBigInt(); + } + + try_stakeOf( + _account: Address, + _subcourtID: BigInt + ): ethereum.CallResult { + let result = super.tryCall("stakeOf", "stakeOf(address,uint96):(uint256)", [ + ethereum.Value.fromAddress(_account), + ethereum.Value.fromUnsignedBigInt(_subcourtID) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + appealPeriod(_disputeID: BigInt): KlerosLiquid__appealPeriodResult { + let result = super.call( + "appealPeriod", + "appealPeriod(uint256):(uint256,uint256)", + [ethereum.Value.fromUnsignedBigInt(_disputeID)] + ); + + return new KlerosLiquid__appealPeriodResult( + result[0].toBigInt(), + result[1].toBigInt() + ); + } + + try_appealPeriod( + _disputeID: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "appealPeriod", + "appealPeriod(uint256):(uint256,uint256)", + [ethereum.Value.fromUnsignedBigInt(_disputeID)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new KlerosLiquid__appealPeriodResult( + value[0].toBigInt(), + value[1].toBigInt() + ) + ); + } + + phase(): i32 { + let result = super.call("phase", "phase():(uint8)", []); + + return result[0].toI32(); + } + + try_phase(): ethereum.CallResult { + let result = super.tryCall("phase", "phase():(uint8)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toI32()); + } + + MAX_STAKE_PATHS(): BigInt { + let result = super.call( + "MAX_STAKE_PATHS", + "MAX_STAKE_PATHS():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_MAX_STAKE_PATHS(): ethereum.CallResult { + let result = super.tryCall( + "MAX_STAKE_PATHS", + "MAX_STAKE_PATHS():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + delayedSetStakes(param0: BigInt): KlerosLiquid__delayedSetStakesResult { + let result = super.call( + "delayedSetStakes", + "delayedSetStakes(uint256):(address,uint96,uint128)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + + return new KlerosLiquid__delayedSetStakesResult( + result[0].toAddress(), + result[1].toBigInt(), + result[2].toBigInt() + ); + } + + try_delayedSetStakes( + param0: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "delayedSetStakes", + "delayedSetStakes(uint256):(address,uint96,uint128)", + [ethereum.Value.fromUnsignedBigInt(param0)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new KlerosLiquid__delayedSetStakesResult( + value[0].toAddress(), + value[1].toBigInt(), + value[2].toBigInt() + ) + ); + } + + lastPhaseChange(): BigInt { + let result = super.call( + "lastPhaseChange", + "lastPhaseChange():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_lastPhaseChange(): ethereum.CallResult { + let result = super.tryCall( + "lastPhaseChange", + "lastPhaseChange():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + minStakingTime(): BigInt { + let result = super.call("minStakingTime", "minStakingTime():(uint256)", []); + + return result[0].toBigInt(); + } + + try_minStakingTime(): ethereum.CallResult { + let result = super.tryCall( + "minStakingTime", + "minStakingTime():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + nextDelayedSetStake(): BigInt { + let result = super.call( + "nextDelayedSetStake", + "nextDelayedSetStake():(uint256)", + [] + ); + + return result[0].toBigInt(); + } + + try_nextDelayedSetStake(): ethereum.CallResult { + let result = super.tryCall( + "nextDelayedSetStake", + "nextDelayedSetStake():(uint256)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + getJuror(_account: Address): Array { + let result = super.call("getJuror", "getJuror(address):(uint96[])", [ + ethereum.Value.fromAddress(_account) + ]); + + return result[0].toBigIntArray(); + } + + try_getJuror(_account: Address): ethereum.CallResult> { + let result = super.tryCall("getJuror", "getJuror(address):(uint96[])", [ + ethereum.Value.fromAddress(_account) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigIntArray()); + } + + onApprove(_owner: Address, _spender: Address, _amount: BigInt): boolean { + let result = super.call( + "onApprove", + "onApprove(address,address,uint256):(bool)", + [ + ethereum.Value.fromAddress(_owner), + ethereum.Value.fromAddress(_spender), + ethereum.Value.fromUnsignedBigInt(_amount) + ] + ); + + return result[0].toBoolean(); + } + + try_onApprove( + _owner: Address, + _spender: Address, + _amount: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "onApprove", + "onApprove(address,address,uint256):(bool)", + [ + ethereum.Value.fromAddress(_owner), + ethereum.Value.fromAddress(_spender), + ethereum.Value.fromUnsignedBigInt(_amount) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + jurors(param0: Address): KlerosLiquid__jurorsResult { + let result = super.call("jurors", "jurors(address):(uint256,uint256)", [ + ethereum.Value.fromAddress(param0) + ]); + + return new KlerosLiquid__jurorsResult( + result[0].toBigInt(), + result[1].toBigInt() + ); + } + + try_jurors(param0: Address): ethereum.CallResult { + let result = super.tryCall("jurors", "jurors(address):(uint256,uint256)", [ + ethereum.Value.fromAddress(param0) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new KlerosLiquid__jurorsResult(value[0].toBigInt(), value[1].toBigInt()) + ); + } + + getDispute(_disputeID: BigInt): KlerosLiquid__getDisputeResult { + let result = super.call( + "getDispute", + "getDispute(uint256):(uint256[],uint256[],uint256[],uint256[],uint256[],uint256[])", + [ethereum.Value.fromUnsignedBigInt(_disputeID)] + ); + + return new KlerosLiquid__getDisputeResult( + result[0].toBigIntArray(), + result[1].toBigIntArray(), + result[2].toBigIntArray(), + result[3].toBigIntArray(), + result[4].toBigIntArray(), + result[5].toBigIntArray() + ); + } + + try_getDispute( + _disputeID: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "getDispute", + "getDispute(uint256):(uint256[],uint256[],uint256[],uint256[],uint256[],uint256[])", + [ethereum.Value.fromUnsignedBigInt(_disputeID)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new KlerosLiquid__getDisputeResult( + value[0].toBigIntArray(), + value[1].toBigIntArray(), + value[2].toBigIntArray(), + value[3].toBigIntArray(), + value[4].toBigIntArray(), + value[5].toBigIntArray() + ) + ); + } + + getVoteCounter( + _disputeID: BigInt, + _appeal: BigInt + ): KlerosLiquid__getVoteCounterResult { + let result = super.call( + "getVoteCounter", + "getVoteCounter(uint256,uint256):(uint256,uint256[],bool)", + [ + ethereum.Value.fromUnsignedBigInt(_disputeID), + ethereum.Value.fromUnsignedBigInt(_appeal) + ] + ); + + return new KlerosLiquid__getVoteCounterResult( + result[0].toBigInt(), + result[1].toBigIntArray(), + result[2].toBoolean() + ); + } + + try_getVoteCounter( + _disputeID: BigInt, + _appeal: BigInt + ): ethereum.CallResult { + let result = super.tryCall( + "getVoteCounter", + "getVoteCounter(uint256,uint256):(uint256,uint256[],bool)", + [ + ethereum.Value.fromUnsignedBigInt(_disputeID), + ethereum.Value.fromUnsignedBigInt(_appeal) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue( + new KlerosLiquid__getVoteCounterResult( + value[0].toBigInt(), + value[1].toBigIntArray(), + value[2].toBoolean() + ) + ); + } + + MIN_JURORS(): BigInt { + let result = super.call("MIN_JURORS", "MIN_JURORS():(uint256)", []); + + return result[0].toBigInt(); + } + + try_MIN_JURORS(): ethereum.CallResult { + let result = super.tryCall("MIN_JURORS", "MIN_JURORS():(uint256)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + appealCost(_disputeID: BigInt, _extraData: Bytes): BigInt { + let result = super.call( + "appealCost", + "appealCost(uint256,bytes):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_disputeID), + ethereum.Value.fromBytes(_extraData) + ] + ); + + return result[0].toBigInt(); + } + + try_appealCost( + _disputeID: BigInt, + _extraData: Bytes + ): ethereum.CallResult { + let result = super.tryCall( + "appealCost", + "appealCost(uint256,bytes):(uint256)", + [ + ethereum.Value.fromUnsignedBigInt(_disputeID), + ethereum.Value.fromBytes(_extraData) + ] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + lockInsolventTransfers(): boolean { + let result = super.call( + "lockInsolventTransfers", + "lockInsolventTransfers():(bool)", + [] + ); + + return result[0].toBoolean(); + } + + try_lockInsolventTransfers(): ethereum.CallResult { + let result = super.tryCall( + "lockInsolventTransfers", + "lockInsolventTransfers():(bool)", + [] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBoolean()); + } + + arbitrationCost(_extraData: Bytes): BigInt { + let result = super.call( + "arbitrationCost", + "arbitrationCost(bytes):(uint256)", + [ethereum.Value.fromBytes(_extraData)] + ); + + return result[0].toBigInt(); + } + + try_arbitrationCost(_extraData: Bytes): ethereum.CallResult { + let result = super.tryCall( + "arbitrationCost", + "arbitrationCost(bytes):(uint256)", + [ethereum.Value.fromBytes(_extraData)] + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toBigInt()); + } + + pinakion(): Address { + let result = super.call("pinakion", "pinakion():(address)", []); + + return result[0].toAddress(); + } + + try_pinakion(): ethereum.CallResult
{ + let result = super.tryCall("pinakion", "pinakion():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } +} + +export class ChangePinakionCall extends ethereum.Call { + get inputs(): ChangePinakionCall__Inputs { + return new ChangePinakionCall__Inputs(this); + } + + get outputs(): ChangePinakionCall__Outputs { + return new ChangePinakionCall__Outputs(this); + } +} + +export class ChangePinakionCall__Inputs { + _call: ChangePinakionCall; + + constructor(call: ChangePinakionCall) { + this._call = call; + } + + get _pinakion(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class ChangePinakionCall__Outputs { + _call: ChangePinakionCall; + + constructor(call: ChangePinakionCall) { + this._call = call; + } +} + +export class PassPhaseCall extends ethereum.Call { + get inputs(): PassPhaseCall__Inputs { + return new PassPhaseCall__Inputs(this); + } + + get outputs(): PassPhaseCall__Outputs { + return new PassPhaseCall__Outputs(this); + } +} + +export class PassPhaseCall__Inputs { + _call: PassPhaseCall; + + constructor(call: PassPhaseCall) { + this._call = call; + } +} + +export class PassPhaseCall__Outputs { + _call: PassPhaseCall; + + constructor(call: PassPhaseCall) { + this._call = call; + } +} + +export class PassPeriodCall extends ethereum.Call { + get inputs(): PassPeriodCall__Inputs { + return new PassPeriodCall__Inputs(this); + } + + get outputs(): PassPeriodCall__Outputs { + return new PassPeriodCall__Outputs(this); + } +} + +export class PassPeriodCall__Inputs { + _call: PassPeriodCall; + + constructor(call: PassPeriodCall) { + this._call = call; + } + + get _disputeID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class PassPeriodCall__Outputs { + _call: PassPeriodCall; + + constructor(call: PassPeriodCall) { + this._call = call; + } +} + +export class ExecuteCall extends ethereum.Call { + get inputs(): ExecuteCall__Inputs { + return new ExecuteCall__Inputs(this); + } + + get outputs(): ExecuteCall__Outputs { + return new ExecuteCall__Outputs(this); + } +} + +export class ExecuteCall__Inputs { + _call: ExecuteCall; + + constructor(call: ExecuteCall) { + this._call = call; + } + + get _disputeID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _appeal(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get _iterations(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class ExecuteCall__Outputs { + _call: ExecuteCall; + + constructor(call: ExecuteCall) { + this._call = call; + } +} + +export class CastVoteCall extends ethereum.Call { + get inputs(): CastVoteCall__Inputs { + return new CastVoteCall__Inputs(this); + } + + get outputs(): CastVoteCall__Outputs { + return new CastVoteCall__Outputs(this); + } +} + +export class CastVoteCall__Inputs { + _call: CastVoteCall; + + constructor(call: CastVoteCall) { + this._call = call; + } + + get _disputeID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _voteIDs(): Array { + return this._call.inputValues[1].value.toBigIntArray(); + } + + get _choice(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get _salt(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } +} + +export class CastVoteCall__Outputs { + _call: CastVoteCall; + + constructor(call: CastVoteCall) { + this._call = call; + } +} + +export class ChangeSubcourtMinStakeCall extends ethereum.Call { + get inputs(): ChangeSubcourtMinStakeCall__Inputs { + return new ChangeSubcourtMinStakeCall__Inputs(this); + } + + get outputs(): ChangeSubcourtMinStakeCall__Outputs { + return new ChangeSubcourtMinStakeCall__Outputs(this); + } +} + +export class ChangeSubcourtMinStakeCall__Inputs { + _call: ChangeSubcourtMinStakeCall; + + constructor(call: ChangeSubcourtMinStakeCall) { + this._call = call; + } + + get _subcourtID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _minStake(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class ChangeSubcourtMinStakeCall__Outputs { + _call: ChangeSubcourtMinStakeCall; + + constructor(call: ChangeSubcourtMinStakeCall) { + this._call = call; + } +} + +export class AppealCall extends ethereum.Call { + get inputs(): AppealCall__Inputs { + return new AppealCall__Inputs(this); + } + + get outputs(): AppealCall__Outputs { + return new AppealCall__Outputs(this); + } +} + +export class AppealCall__Inputs { + _call: AppealCall; + + constructor(call: AppealCall) { + this._call = call; + } + + get _disputeID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _extraData(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class AppealCall__Outputs { + _call: AppealCall; + + constructor(call: AppealCall) { + this._call = call; + } +} + +export class OnTransferCall extends ethereum.Call { + get inputs(): OnTransferCall__Inputs { + return new OnTransferCall__Inputs(this); + } + + get outputs(): OnTransferCall__Outputs { + return new OnTransferCall__Outputs(this); + } +} + +export class OnTransferCall__Inputs { + _call: OnTransferCall; + + constructor(call: OnTransferCall) { + this._call = call; + } + + get _from(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get _to(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get _amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class OnTransferCall__Outputs { + _call: OnTransferCall; + + constructor(call: OnTransferCall) { + this._call = call; + } + + get allowed(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class ChangeSubcourtTimesPerPeriodCall extends ethereum.Call { + get inputs(): ChangeSubcourtTimesPerPeriodCall__Inputs { + return new ChangeSubcourtTimesPerPeriodCall__Inputs(this); + } + + get outputs(): ChangeSubcourtTimesPerPeriodCall__Outputs { + return new ChangeSubcourtTimesPerPeriodCall__Outputs(this); + } +} + +export class ChangeSubcourtTimesPerPeriodCall__Inputs { + _call: ChangeSubcourtTimesPerPeriodCall; + + constructor(call: ChangeSubcourtTimesPerPeriodCall) { + this._call = call; + } + + get _subcourtID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _timesPerPeriod(): Array { + return this._call.inputValues[1].value.toBigIntArray(); + } +} + +export class ChangeSubcourtTimesPerPeriodCall__Outputs { + _call: ChangeSubcourtTimesPerPeriodCall; + + constructor(call: ChangeSubcourtTimesPerPeriodCall) { + this._call = call; + } +} + +export class ChangeSubcourtJurorFeeCall extends ethereum.Call { + get inputs(): ChangeSubcourtJurorFeeCall__Inputs { + return new ChangeSubcourtJurorFeeCall__Inputs(this); + } + + get outputs(): ChangeSubcourtJurorFeeCall__Outputs { + return new ChangeSubcourtJurorFeeCall__Outputs(this); + } +} + +export class ChangeSubcourtJurorFeeCall__Inputs { + _call: ChangeSubcourtJurorFeeCall; + + constructor(call: ChangeSubcourtJurorFeeCall) { + this._call = call; + } + + get _subcourtID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _feeForJuror(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class ChangeSubcourtJurorFeeCall__Outputs { + _call: ChangeSubcourtJurorFeeCall; + + constructor(call: ChangeSubcourtJurorFeeCall) { + this._call = call; + } +} + +export class ChangeSubcourtAlphaCall extends ethereum.Call { + get inputs(): ChangeSubcourtAlphaCall__Inputs { + return new ChangeSubcourtAlphaCall__Inputs(this); + } + + get outputs(): ChangeSubcourtAlphaCall__Outputs { + return new ChangeSubcourtAlphaCall__Outputs(this); + } +} + +export class ChangeSubcourtAlphaCall__Inputs { + _call: ChangeSubcourtAlphaCall; + + constructor(call: ChangeSubcourtAlphaCall) { + this._call = call; + } + + get _subcourtID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _alpha(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class ChangeSubcourtAlphaCall__Outputs { + _call: ChangeSubcourtAlphaCall; + + constructor(call: ChangeSubcourtAlphaCall) { + this._call = call; + } +} + +export class CastCommitCall extends ethereum.Call { + get inputs(): CastCommitCall__Inputs { + return new CastCommitCall__Inputs(this); + } + + get outputs(): CastCommitCall__Outputs { + return new CastCommitCall__Outputs(this); + } +} + +export class CastCommitCall__Inputs { + _call: CastCommitCall; + + constructor(call: CastCommitCall) { + this._call = call; + } + + get _disputeID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _voteIDs(): Array { + return this._call.inputValues[1].value.toBigIntArray(); + } + + get _commit(): Bytes { + return this._call.inputValues[2].value.toBytes(); + } +} + +export class CastCommitCall__Outputs { + _call: CastCommitCall; + + constructor(call: CastCommitCall) { + this._call = call; + } +} + +export class ExecuteGovernorProposalCall extends ethereum.Call { + get inputs(): ExecuteGovernorProposalCall__Inputs { + return new ExecuteGovernorProposalCall__Inputs(this); + } + + get outputs(): ExecuteGovernorProposalCall__Outputs { + return new ExecuteGovernorProposalCall__Outputs(this); + } +} + +export class ExecuteGovernorProposalCall__Inputs { + _call: ExecuteGovernorProposalCall; + + constructor(call: ExecuteGovernorProposalCall) { + this._call = call; + } + + get _destination(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get _amount(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } + + get _data(): Bytes { + return this._call.inputValues[2].value.toBytes(); + } +} + +export class ExecuteGovernorProposalCall__Outputs { + _call: ExecuteGovernorProposalCall; + + constructor(call: ExecuteGovernorProposalCall) { + this._call = call; + } +} + +export class ChangeMinStakingTimeCall extends ethereum.Call { + get inputs(): ChangeMinStakingTimeCall__Inputs { + return new ChangeMinStakingTimeCall__Inputs(this); + } + + get outputs(): ChangeMinStakingTimeCall__Outputs { + return new ChangeMinStakingTimeCall__Outputs(this); + } +} + +export class ChangeMinStakingTimeCall__Inputs { + _call: ChangeMinStakingTimeCall; + + constructor(call: ChangeMinStakingTimeCall) { + this._call = call; + } + + get _minStakingTime(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class ChangeMinStakingTimeCall__Outputs { + _call: ChangeMinStakingTimeCall; + + constructor(call: ChangeMinStakingTimeCall) { + this._call = call; + } +} + +export class SetStakeCall extends ethereum.Call { + get inputs(): SetStakeCall__Inputs { + return new SetStakeCall__Inputs(this); + } + + get outputs(): SetStakeCall__Outputs { + return new SetStakeCall__Outputs(this); + } +} + +export class SetStakeCall__Inputs { + _call: SetStakeCall; + + constructor(call: SetStakeCall) { + this._call = call; + } + + get _subcourtID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _stake(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class SetStakeCall__Outputs { + _call: SetStakeCall; + + constructor(call: SetStakeCall) { + this._call = call; + } +} + +export class ExecuteRulingCall extends ethereum.Call { + get inputs(): ExecuteRulingCall__Inputs { + return new ExecuteRulingCall__Inputs(this); + } + + get outputs(): ExecuteRulingCall__Outputs { + return new ExecuteRulingCall__Outputs(this); + } +} + +export class ExecuteRulingCall__Inputs { + _call: ExecuteRulingCall; + + constructor(call: ExecuteRulingCall) { + this._call = call; + } + + get _disputeID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class ExecuteRulingCall__Outputs { + _call: ExecuteRulingCall; + + constructor(call: ExecuteRulingCall) { + this._call = call; + } +} + +export class ChangeRNGeneratorCall extends ethereum.Call { + get inputs(): ChangeRNGeneratorCall__Inputs { + return new ChangeRNGeneratorCall__Inputs(this); + } + + get outputs(): ChangeRNGeneratorCall__Outputs { + return new ChangeRNGeneratorCall__Outputs(this); + } +} + +export class ChangeRNGeneratorCall__Inputs { + _call: ChangeRNGeneratorCall; + + constructor(call: ChangeRNGeneratorCall) { + this._call = call; + } + + get _RNGenerator(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class ChangeRNGeneratorCall__Outputs { + _call: ChangeRNGeneratorCall; + + constructor(call: ChangeRNGeneratorCall) { + this._call = call; + } +} + +export class ExecuteDelayedSetStakesCall extends ethereum.Call { + get inputs(): ExecuteDelayedSetStakesCall__Inputs { + return new ExecuteDelayedSetStakesCall__Inputs(this); + } + + get outputs(): ExecuteDelayedSetStakesCall__Outputs { + return new ExecuteDelayedSetStakesCall__Outputs(this); + } +} + +export class ExecuteDelayedSetStakesCall__Inputs { + _call: ExecuteDelayedSetStakesCall; + + constructor(call: ExecuteDelayedSetStakesCall) { + this._call = call; + } + + get _iterations(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class ExecuteDelayedSetStakesCall__Outputs { + _call: ExecuteDelayedSetStakesCall; + + constructor(call: ExecuteDelayedSetStakesCall) { + this._call = call; + } +} + +export class ChangeSubcourtJurorsForJumpCall extends ethereum.Call { + get inputs(): ChangeSubcourtJurorsForJumpCall__Inputs { + return new ChangeSubcourtJurorsForJumpCall__Inputs(this); + } + + get outputs(): ChangeSubcourtJurorsForJumpCall__Outputs { + return new ChangeSubcourtJurorsForJumpCall__Outputs(this); + } +} + +export class ChangeSubcourtJurorsForJumpCall__Inputs { + _call: ChangeSubcourtJurorsForJumpCall; + + constructor(call: ChangeSubcourtJurorsForJumpCall) { + this._call = call; + } + + get _subcourtID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _jurorsForCourtJump(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class ChangeSubcourtJurorsForJumpCall__Outputs { + _call: ChangeSubcourtJurorsForJumpCall; + + constructor(call: ChangeSubcourtJurorsForJumpCall) { + this._call = call; + } +} + +export class CreateDisputeCall extends ethereum.Call { + get inputs(): CreateDisputeCall__Inputs { + return new CreateDisputeCall__Inputs(this); + } + + get outputs(): CreateDisputeCall__Outputs { + return new CreateDisputeCall__Outputs(this); + } +} + +export class CreateDisputeCall__Inputs { + _call: CreateDisputeCall; + + constructor(call: CreateDisputeCall) { + this._call = call; + } + + get _numberOfChoices(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _extraData(): Bytes { + return this._call.inputValues[1].value.toBytes(); + } +} + +export class CreateDisputeCall__Outputs { + _call: CreateDisputeCall; + + constructor(call: CreateDisputeCall) { + this._call = call; + } + + get disputeID(): BigInt { + return this._call.outputValues[0].value.toBigInt(); + } +} + +export class DrawJurorsCall extends ethereum.Call { + get inputs(): DrawJurorsCall__Inputs { + return new DrawJurorsCall__Inputs(this); + } + + get outputs(): DrawJurorsCall__Outputs { + return new DrawJurorsCall__Outputs(this); + } +} + +export class DrawJurorsCall__Inputs { + _call: DrawJurorsCall; + + constructor(call: DrawJurorsCall) { + this._call = call; + } + + get _disputeID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _iterations(): BigInt { + return this._call.inputValues[1].value.toBigInt(); + } +} + +export class DrawJurorsCall__Outputs { + _call: DrawJurorsCall; + + constructor(call: DrawJurorsCall) { + this._call = call; + } +} + +export class CreateSubcourtCall extends ethereum.Call { + get inputs(): CreateSubcourtCall__Inputs { + return new CreateSubcourtCall__Inputs(this); + } + + get outputs(): CreateSubcourtCall__Outputs { + return new CreateSubcourtCall__Outputs(this); + } +} + +export class CreateSubcourtCall__Inputs { + _call: CreateSubcourtCall; + + constructor(call: CreateSubcourtCall) { + this._call = call; + } + + get _parent(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _hiddenVotes(): boolean { + return this._call.inputValues[1].value.toBoolean(); + } + + get _minStake(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } + + get _alpha(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get _feeForJuror(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } + + get _jurorsForCourtJump(): BigInt { + return this._call.inputValues[5].value.toBigInt(); + } + + get _timesPerPeriod(): Array { + return this._call.inputValues[6].value.toBigIntArray(); + } + + get _sortitionSumTreeK(): BigInt { + return this._call.inputValues[7].value.toBigInt(); + } +} + +export class CreateSubcourtCall__Outputs { + _call: CreateSubcourtCall; + + constructor(call: CreateSubcourtCall) { + this._call = call; + } +} + +export class OnApproveCall extends ethereum.Call { + get inputs(): OnApproveCall__Inputs { + return new OnApproveCall__Inputs(this); + } + + get outputs(): OnApproveCall__Outputs { + return new OnApproveCall__Outputs(this); + } +} + +export class OnApproveCall__Inputs { + _call: OnApproveCall; + + constructor(call: OnApproveCall) { + this._call = call; + } + + get _owner(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get _spender(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get _amount(): BigInt { + return this._call.inputValues[2].value.toBigInt(); + } +} + +export class OnApproveCall__Outputs { + _call: OnApproveCall; + + constructor(call: OnApproveCall) { + this._call = call; + } + + get allowed(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class ChangeMaxDrawingTimeCall extends ethereum.Call { + get inputs(): ChangeMaxDrawingTimeCall__Inputs { + return new ChangeMaxDrawingTimeCall__Inputs(this); + } + + get outputs(): ChangeMaxDrawingTimeCall__Outputs { + return new ChangeMaxDrawingTimeCall__Outputs(this); + } +} + +export class ChangeMaxDrawingTimeCall__Inputs { + _call: ChangeMaxDrawingTimeCall; + + constructor(call: ChangeMaxDrawingTimeCall) { + this._call = call; + } + + get _maxDrawingTime(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } +} + +export class ChangeMaxDrawingTimeCall__Outputs { + _call: ChangeMaxDrawingTimeCall; + + constructor(call: ChangeMaxDrawingTimeCall) { + this._call = call; + } +} + +export class ChangeGovernorCall extends ethereum.Call { + get inputs(): ChangeGovernorCall__Inputs { + return new ChangeGovernorCall__Inputs(this); + } + + get outputs(): ChangeGovernorCall__Outputs { + return new ChangeGovernorCall__Outputs(this); + } +} + +export class ChangeGovernorCall__Inputs { + _call: ChangeGovernorCall; + + constructor(call: ChangeGovernorCall) { + this._call = call; + } + + get _governor(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class ChangeGovernorCall__Outputs { + _call: ChangeGovernorCall; + + constructor(call: ChangeGovernorCall) { + this._call = call; + } +} + +export class ProxyPaymentCall extends ethereum.Call { + get inputs(): ProxyPaymentCall__Inputs { + return new ProxyPaymentCall__Inputs(this); + } + + get outputs(): ProxyPaymentCall__Outputs { + return new ProxyPaymentCall__Outputs(this); + } +} + +export class ProxyPaymentCall__Inputs { + _call: ProxyPaymentCall; + + constructor(call: ProxyPaymentCall) { + this._call = call; + } + + get _owner(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class ProxyPaymentCall__Outputs { + _call: ProxyPaymentCall; + + constructor(call: ProxyPaymentCall) { + this._call = call; + } + + get allowed(): boolean { + return this._call.outputValues[0].value.toBoolean(); + } +} + +export class ConstructorCall extends ethereum.Call { + get inputs(): ConstructorCall__Inputs { + return new ConstructorCall__Inputs(this); + } + + get outputs(): ConstructorCall__Outputs { + return new ConstructorCall__Outputs(this); + } +} + +export class ConstructorCall__Inputs { + _call: ConstructorCall; + + constructor(call: ConstructorCall) { + this._call = call; + } + + get _governor(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get _pinakion(): Address { + return this._call.inputValues[1].value.toAddress(); + } + + get _RNGenerator(): Address { + return this._call.inputValues[2].value.toAddress(); + } + + get _minStakingTime(): BigInt { + return this._call.inputValues[3].value.toBigInt(); + } + + get _maxDrawingTime(): BigInt { + return this._call.inputValues[4].value.toBigInt(); + } + + get _hiddenVotes(): boolean { + return this._call.inputValues[5].value.toBoolean(); + } + + get _minStake(): BigInt { + return this._call.inputValues[6].value.toBigInt(); + } + + get _alpha(): BigInt { + return this._call.inputValues[7].value.toBigInt(); + } + + get _feeForJuror(): BigInt { + return this._call.inputValues[8].value.toBigInt(); + } + + get _jurorsForCourtJump(): BigInt { + return this._call.inputValues[9].value.toBigInt(); + } + + get _timesPerPeriod(): Array { + return this._call.inputValues[10].value.toBigIntArray(); + } + + get _sortitionSumTreeK(): BigInt { + return this._call.inputValues[11].value.toBigInt(); + } +} + +export class ConstructorCall__Outputs { + _call: ConstructorCall; + + constructor(call: ConstructorCall) { + this._call = call; + } +} diff --git a/generated/PolicyRegistry/PolicyRegistry.ts b/generated/PolicyRegistry/PolicyRegistry.ts new file mode 100644 index 0000000..410041a --- /dev/null +++ b/generated/PolicyRegistry/PolicyRegistry.ts @@ -0,0 +1,167 @@ +// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. + +import { + ethereum, + JSONValue, + TypedMap, + Entity, + Bytes, + Address, + BigInt +} from "@graphprotocol/graph-ts"; + +export class PolicyUpdate extends ethereum.Event { + get params(): PolicyUpdate__Params { + return new PolicyUpdate__Params(this); + } +} + +export class PolicyUpdate__Params { + _event: PolicyUpdate; + + constructor(event: PolicyUpdate) { + this._event = event; + } + + get _subcourtID(): BigInt { + return this._event.parameters[0].value.toBigInt(); + } + + get _policy(): string { + return this._event.parameters[1].value.toString(); + } +} + +export class PolicyRegistry extends ethereum.SmartContract { + static bind(address: Address): PolicyRegistry { + return new PolicyRegistry("PolicyRegistry", address); + } + + governor(): Address { + let result = super.call("governor", "governor():(address)", []); + + return result[0].toAddress(); + } + + try_governor(): ethereum.CallResult
{ + let result = super.tryCall("governor", "governor():(address)", []); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toAddress()); + } + + policies(param0: BigInt): string { + let result = super.call("policies", "policies(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(param0) + ]); + + return result[0].toString(); + } + + try_policies(param0: BigInt): ethereum.CallResult { + let result = super.tryCall("policies", "policies(uint256):(string)", [ + ethereum.Value.fromUnsignedBigInt(param0) + ]); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } +} + +export class ChangeGovernorCall extends ethereum.Call { + get inputs(): ChangeGovernorCall__Inputs { + return new ChangeGovernorCall__Inputs(this); + } + + get outputs(): ChangeGovernorCall__Outputs { + return new ChangeGovernorCall__Outputs(this); + } +} + +export class ChangeGovernorCall__Inputs { + _call: ChangeGovernorCall; + + constructor(call: ChangeGovernorCall) { + this._call = call; + } + + get _governor(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class ChangeGovernorCall__Outputs { + _call: ChangeGovernorCall; + + constructor(call: ChangeGovernorCall) { + this._call = call; + } +} + +export class SetPolicyCall extends ethereum.Call { + get inputs(): SetPolicyCall__Inputs { + return new SetPolicyCall__Inputs(this); + } + + get outputs(): SetPolicyCall__Outputs { + return new SetPolicyCall__Outputs(this); + } +} + +export class SetPolicyCall__Inputs { + _call: SetPolicyCall; + + constructor(call: SetPolicyCall) { + this._call = call; + } + + get _subcourtID(): BigInt { + return this._call.inputValues[0].value.toBigInt(); + } + + get _policy(): string { + return this._call.inputValues[1].value.toString(); + } +} + +export class SetPolicyCall__Outputs { + _call: SetPolicyCall; + + constructor(call: SetPolicyCall) { + this._call = call; + } +} + +export class ConstructorCall extends ethereum.Call { + get inputs(): ConstructorCall__Inputs { + return new ConstructorCall__Inputs(this); + } + + get outputs(): ConstructorCall__Outputs { + return new ConstructorCall__Outputs(this); + } +} + +export class ConstructorCall__Inputs { + _call: ConstructorCall; + + constructor(call: ConstructorCall) { + this._call = call; + } + + get _governor(): Address { + return this._call.inputValues[0].value.toAddress(); + } +} + +export class ConstructorCall__Outputs { + _call: ConstructorCall; + + constructor(call: ConstructorCall) { + this._call = call; + } +} diff --git a/generated/schema.ts b/generated/schema.ts index 8e83da6..3a7ed89 100644 --- a/generated/schema.ts +++ b/generated/schema.ts @@ -210,8 +210,34 @@ export class Dispute extends Entity { this.set("createdAtBlock", Value.fromBigInt(value)); } - get lastPeriodChange(): BigInt { - let value = this.get("lastPeriodChange"); + get court(): string { + let value = this.get("court"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } + } + + set court(value: string) { + this.set("court", Value.fromString(value)); + } + + get periodDeadline(): BigInt { + let value = this.get("periodDeadline"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } + } + + set periodDeadline(value: BigInt) { + this.set("periodDeadline", Value.fromBigInt(value)); + } + + get periodNotificationIndex(): BigInt { + let value = this.get("periodNotificationIndex"); if (!value || value.kind == ValueKind.NULL) { throw new Error("Cannot return null for a required field."); } else { @@ -219,8 +245,34 @@ export class Dispute extends Entity { } } - set lastPeriodChange(value: BigInt) { - this.set("lastPeriodChange", Value.fromBigInt(value)); + set periodNotificationIndex(value: BigInt) { + this.set("periodNotificationIndex", Value.fromBigInt(value)); + } + + get lastPeriodChangeTs(): BigInt { + let value = this.get("lastPeriodChangeTs"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } + } + + set lastPeriodChangeTs(value: BigInt) { + this.set("lastPeriodChangeTs", Value.fromBigInt(value)); + } + + get lastPeriodChangeBlock(): BigInt { + let value = this.get("lastPeriodChangeBlock"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } + } + + set lastPeriodChangeBlock(value: BigInt) { + this.set("lastPeriodChangeBlock", Value.fromBigInt(value)); } get nbChoices(): BigInt { @@ -249,6 +301,19 @@ export class Dispute extends Entity { this.set("nbRounds", Value.fromBigInt(value)); } + get currentRound(): Bytes { + let value = this.get("currentRound"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBytes(); + } + } + + set currentRound(value: Bytes) { + this.set("currentRound", Value.fromBytes(value)); + } + get rounds(): RoundLoader { return new RoundLoader("Dispute", this.get("id")!.toString(), "rounds"); } @@ -303,6 +368,32 @@ export class Round extends Entity { this.set("id", Value.fromBytes(value)); } + get round(): BigInt { + let value = this.get("round"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } + } + + set round(value: BigInt) { + this.set("round", Value.fromBigInt(value)); + } + + get isCurrentRound(): boolean { + let value = this.get("isCurrentRound"); + if (!value || value.kind == ValueKind.NULL) { + return false; + } else { + return value.toBoolean(); + } + } + + set isCurrentRound(value: boolean) { + this.set("isCurrentRound", Value.fromBoolean(value)); + } + get dispute(): string { let value = this.get("dispute"); if (!value || value.kind == ValueKind.NULL) { @@ -330,6 +421,376 @@ export class Round extends Entity { } } +export class UserDisputeInfo extends Entity { + constructor(id: string) { + super(); + this.set("id", Value.fromString(id)); + } + + save(): void { + let id = this.get("id"); + assert(id != null, "Cannot save UserDisputeInfo entity without an ID"); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type UserDisputeInfo must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set("UserDisputeInfo", id.toString(), this); + } + } + + static loadInBlock(id: string): UserDisputeInfo | null { + return changetype( + store.get_in_block("UserDisputeInfo", id) + ); + } + + static load(id: string): UserDisputeInfo | null { + return changetype(store.get("UserDisputeInfo", id)); + } + + get id(): string { + let value = this.get("id"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set("id", Value.fromString(value)); + } + + get dispute(): string { + let value = this.get("dispute"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } + } + + set dispute(value: string) { + this.set("dispute", Value.fromString(value)); + } + + get juror(): string { + let value = this.get("juror"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } + } + + set juror(value: string) { + this.set("juror", Value.fromString(value)); + } +} + +export class UserRoundInfo extends Entity { + constructor(id: string) { + super(); + this.set("id", Value.fromString(id)); + } + + save(): void { + let id = this.get("id"); + assert(id != null, "Cannot save UserRoundInfo entity without an ID"); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type UserRoundInfo must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set("UserRoundInfo", id.toString(), this); + } + } + + static loadInBlock(id: string): UserRoundInfo | null { + return changetype( + store.get_in_block("UserRoundInfo", id) + ); + } + + static load(id: string): UserRoundInfo | null { + return changetype(store.get("UserRoundInfo", id)); + } + + get id(): string { + let value = this.get("id"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set("id", Value.fromString(value)); + } + + get dispute(): string { + let value = this.get("dispute"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } + } + + set dispute(value: string) { + this.set("dispute", Value.fromString(value)); + } + + get drawNotificationIndex(): BigInt { + let value = this.get("drawNotificationIndex"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } + } + + set drawNotificationIndex(value: BigInt) { + this.set("drawNotificationIndex", Value.fromBigInt(value)); + } + + get juror(): string { + let value = this.get("juror"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } + } + + set juror(value: string) { + this.set("juror", Value.fromString(value)); + } + + get round(): Bytes { + let value = this.get("round"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBytes(); + } + } + + set round(value: Bytes) { + this.set("round", Value.fromBytes(value)); + } +} + +export class Counter extends Entity { + constructor(id: string) { + super(); + this.set("id", Value.fromString(id)); + } + + save(): void { + let id = this.get("id"); + assert(id != null, "Cannot save Counter entity without an ID"); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Counter must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set("Counter", id.toString(), this); + } + } + + static loadInBlock(id: string): Counter | null { + return changetype(store.get_in_block("Counter", id)); + } + + static load(id: string): Counter | null { + return changetype(store.get("Counter", id)); + } + + get id(): string { + let value = this.get("id"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set("id", Value.fromString(value)); + } + + get counter(): BigInt { + let value = this.get("counter"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } + } + + set counter(value: BigInt) { + this.set("counter", Value.fromBigInt(value)); + } +} + +export class Court extends Entity { + constructor(id: string) { + super(); + this.set("id", Value.fromString(id)); + } + + save(): void { + let id = this.get("id"); + assert(id != null, "Cannot save Court entity without an ID"); + if (id) { + assert( + id.kind == ValueKind.STRING, + `Entities of type Court must have an ID of type String but the id '${id.displayData()}' is of type ${id.displayKind()}` + ); + store.set("Court", id.toString(), this); + } + } + + static loadInBlock(id: string): Court | null { + return changetype(store.get_in_block("Court", id)); + } + + static load(id: string): Court | null { + return changetype(store.get("Court", id)); + } + + get id(): string { + let value = this.get("id"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toString(); + } + } + + set id(value: string) { + this.set("id", Value.fromString(value)); + } + + get timesPerPeriod(): Array | null { + let value = this.get("timesPerPeriod"); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toBigIntArray(); + } + } + + set timesPerPeriod(value: Array | null) { + if (!value) { + this.unset("timesPerPeriod"); + } else { + this.set("timesPerPeriod", Value.fromBigIntArray(>value)); + } + } + + get hiddenVotes(): boolean { + let value = this.get("hiddenVotes"); + if (!value || value.kind == ValueKind.NULL) { + return false; + } else { + return value.toBoolean(); + } + } + + set hiddenVotes(value: boolean) { + this.set("hiddenVotes", Value.fromBoolean(value)); + } + + get policy(): string | null { + let value = this.get("policy"); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set policy(value: string | null) { + if (!value) { + this.unset("policy"); + } else { + this.set("policy", Value.fromString(value)); + } + } + + get name(): string | null { + let value = this.get("name"); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set name(value: string | null) { + if (!value) { + this.unset("name"); + } else { + this.set("name", Value.fromString(value)); + } + } + + get description(): string | null { + let value = this.get("description"); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set description(value: string | null) { + if (!value) { + this.unset("description"); + } else { + this.set("description", Value.fromString(value)); + } + } + + get summary(): string | null { + let value = this.get("summary"); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set summary(value: string | null) { + if (!value) { + this.unset("summary"); + } else { + this.set("summary", Value.fromString(value)); + } + } + + get requiredSkills(): string | null { + let value = this.get("requiredSkills"); + if (!value || value.kind == ValueKind.NULL) { + return null; + } else { + return value.toString(); + } + } + + set requiredSkills(value: string | null) { + if (!value) { + this.unset("requiredSkills"); + } else { + this.set("requiredSkills", Value.fromString(value)); + } + } +} + export class Draw extends Entity { constructor(id: string) { super(); diff --git a/mappings/arbitrable.ts b/mappings/arbitrable.ts new file mode 100644 index 0000000..f43f896 --- /dev/null +++ b/mappings/arbitrable.ts @@ -0,0 +1,87 @@ +import { + MetaEvidence as MetaEvidenceEv, + Dispute as DisputeEv, + Evidence as EvidenceEv, + Ruling as RulingEv, +} from "../generated/templates/Arbitrable/Arbitrable"; +import { + ArbitrableHistory, + Evidence, + Dispute, + EvidenceGroup + } from "../generated/schema" +import { ONE, ZERO} from "./const"; +import { + Bytes, + crypto + } from "@graphprotocol/graph-ts"; +import { biToBytes } from "./kleros-liquid"; + + export function handleMetaEvidence(ev: MetaEvidenceEv): void { + const arbitrableHistory = new ArbitrableHistory( + Bytes.fromByteArray( + crypto.keccak256(ev.address.concat(biToBytes(ev.params._metaEvidenceID))) + ) + ); + arbitrableHistory.metaEvidence = ev.params._evidence; + arbitrableHistory.save(); + } + + export function handleDispute(ev: DisputeEv): void { + const arbitrableHistory = ArbitrableHistory.load( + Bytes.fromByteArray( + crypto.keccak256(ev.address.concat(biToBytes(ev.params._metaEvidenceID))) + ) + ); + + const dispute = Dispute.load(ev.params._disputeID.toString()); + if (dispute == null) return; + dispute.metaEvidenceId = ev.params._metaEvidenceID; + if (arbitrableHistory != null) + dispute.arbitrableHistory = arbitrableHistory.id; + dispute.save(); + + const evidenceGroupId = Bytes.fromByteArray( + crypto.keccak256(ev.address.concat(biToBytes(ev.params._evidenceGroupID))) + ); + let evidenceGroup = EvidenceGroup.load(evidenceGroupId); + if (evidenceGroup == null) { + evidenceGroup = new EvidenceGroup(evidenceGroupId); + evidenceGroup.length = ZERO; + } + evidenceGroup.dispute = dispute.id; + evidenceGroup.save(); + } + + export function handleEvidence(ev: EvidenceEv): void { + const evidenceGroupId = Bytes.fromByteArray( + crypto.keccak256(ev.address.concat(biToBytes(ev.params._evidenceGroupID))) + ); + let evidenceGroup = EvidenceGroup.load(evidenceGroupId); + if (evidenceGroup == null) { + evidenceGroup = new EvidenceGroup(evidenceGroupId); + evidenceGroup.length = ZERO; + } + evidenceGroup.length = evidenceGroup.length.plus(ONE); + evidenceGroup.save(); + + const evidence = new Evidence( + Bytes.fromByteArray( + crypto.keccak256(evidenceGroupId.concat(biToBytes(evidenceGroup.length))) + ) + ); + evidence.URI = ev.params._evidence; + evidence.group = evidenceGroup.id; + evidence.creationTime = ev.block.timestamp; + evidence.sender = ev.params._party; + evidence.save(); + } + + export function handleRuling(ev: RulingEv): void { + const dispute = Dispute.load(ev.params._disputeID.toString()); + if (dispute == null) return; + dispute.ruling = ev.params._ruling; + dispute.ruled = true; + dispute.save(); + } + \ No newline at end of file diff --git a/mappings/const.template.ts b/mappings/const.template.ts deleted file mode 100644 index e3322be..0000000 --- a/mappings/const.template.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { Address, BigInt, Bytes } from "@graphprotocol/graph-ts"; - -export const ADDRESS = Address.fromBytes(Bytes.fromHexString("{{address}}")); - -export const ZERO_B = Bytes.fromI32(0); -export const ZERO = BigInt.fromI32(0); -export const ONE = BigInt.fromI32(1); diff --git a/mappings/index.ts b/mappings/index.ts deleted file mode 100644 index f1184a7..0000000 --- a/mappings/index.ts +++ /dev/null @@ -1,233 +0,0 @@ -import { - AppealDecision as AppealDecisionEv, - AppealPossible as AppealPossibleEv, - DisputeCreation as DisputeCreationEv, - NewPeriod as NewPeriodEv, - Draw as DrawEv, - TokenAndETHShift as TokenAndETHShiftEv, - Kleros, -} from "../generated/Kleros/Kleros"; -import { - MetaEvidence as MetaEvidenceEv, - Dispute as DisputeEv, - Evidence as EvidenceEv, - Ruling as RulingEv, -} from "../generated/templates/Arbitrable/Arbitrable"; -import { Arbitrable as ArbitrableContract } from "../generated/templates"; -import { - ArbitrableHistory, - Dispute, - Draw, - Evidence, - EvidenceGroup, - Round, - TokenAndETHShift, -} from "../generated/schema"; -import { ADDRESS, ONE, ZERO, ZERO_B } from "./const"; -import { BigInt, Bytes, crypto } from "@graphprotocol/graph-ts"; - -export class Period { - static readonly EVIDENCE: string = "EVIDENCE"; - static readonly COMMIT: string = "COMMIT"; - static readonly VOTE: string = "VOTE"; - static readonly APPEAL: string = "APPEAL"; - static readonly EXECUTED: string = "EXECUTED"; - - static parse(status: i32): string { - switch (status) { - case 0: - return this.EVIDENCE; - case 1: - return this.COMMIT; - case 2: - return this.VOTE; - case 3: - return this.APPEAL; - case 4: - return this.EXECUTED; - default: - return "Error"; - } - } -} - -export function biToBytes(bi: BigInt): Bytes { - return bi.isZero() ? ZERO_B : Bytes.fromByteArray(Bytes.fromBigInt(bi)); -} - -export function handleDisputeCreation(ev: DisputeCreationEv): void { - ArbitrableContract.create(ev.params._arbitrable); - - const dispute = new Dispute(ev.params._disputeID.toString()); - dispute.arbitrated = ev.params._arbitrable; - dispute.metaEvidenceId = ZERO; - dispute.ruling = ZERO; - dispute.ruled = false; - dispute.period = Period.EVIDENCE; - dispute.createdAtBlock = ev.block.number; - dispute.lastPeriodChange = ev.block.timestamp; - dispute.nbRounds = ONE; - dispute.nbChoices = Kleros.bind(ADDRESS) - .disputes(ev.params._disputeID) - .getNumberOfChoices(); - dispute.save(); - - const round = new Round( - Bytes.fromByteArray( - crypto.keccak256(biToBytes(ev.params._disputeID).concat(ZERO_B)) - ) - ); - round.dispute = dispute.id; - round.jurors = []; - round.save(); -} - -export function handleAppealPossible(ev: AppealPossibleEv): void { - const dispute = Dispute.load(ev.params._disputeID.toString()); - if (dispute == null) return; - dispute.period = Period.APPEAL; - dispute.lastPeriodChange = ev.block.timestamp; - dispute.save(); -} - -export function handleAppealDecision(ev: AppealDecisionEv): void { - const dispute = Dispute.load(ev.params._disputeID.toString()); - if (dispute == null) return; - - const round = new Round( - Bytes.fromByteArray( - crypto.keccak256( - biToBytes(ev.params._disputeID).concat(biToBytes(dispute.nbRounds)) - ) - ) - ); - round.dispute = dispute.id; - round.jurors = []; - round.save(); - - dispute.period = Period.EVIDENCE; - dispute.lastPeriodChange = ev.block.timestamp; - dispute.nbRounds = dispute.nbRounds.plus(ONE); - dispute.save(); -} - -export function handleNewPeriod(ev: NewPeriodEv): void { - const dispute = Dispute.load(ev.params._disputeID.toString()); - if (dispute == null) return; - - dispute.period = Period.parse(ev.params._period); - dispute.lastPeriodChange = ev.block.timestamp; - dispute.save(); -} - -export function handleDraw(ev: DrawEv): void { - const round = Round.load( - Bytes.fromByteArray( - crypto.keccak256( - biToBytes(ev.params._disputeID).concat(biToBytes(ev.params._appeal)) - ) - ) - ); - if (round == null) return; - - const draw = new Draw( - `${ev.params._disputeID}-${ev.params._appeal}-${ev.params._voteID}` - ); - draw.disputeID = ev.params._disputeID; - draw.appeal = ev.params._appeal; - draw.voteID = ev.params._voteID; - draw.address = ev.params._address; - draw.save(); - - round.jurors.push(ev.params._address); - round.save(); -} - -export function handleTokenAndETHShift(ev: TokenAndETHShiftEv): void { - // Keep rolling until we find a free ID - let i = 0; - while (true) { - const shift = TokenAndETHShift.load( - `${ev.params._disputeID}-${ev.params._address.toHexString()}-${i}` - ); - if (shift == null) break; - i++; - } - - const shift = new TokenAndETHShift( - `${ev.params._disputeID}-${ev.params._address.toHexString()}-${i}` - ); - shift.ETHAmount = ev.params._ETHAmount; - shift.address = ev.params._address; - shift.disputeID = ev.params._disputeID; - shift.tokenAmount = ev.params._tokenAmount; - shift.save(); -} - -export function handleMetaEvidence(ev: MetaEvidenceEv): void { - const arbitrableHistory = new ArbitrableHistory( - Bytes.fromByteArray( - crypto.keccak256(ev.address.concat(biToBytes(ev.params._metaEvidenceID))) - ) - ); - arbitrableHistory.metaEvidence = ev.params._evidence; - arbitrableHistory.save(); -} - -export function handleDispute(ev: DisputeEv): void { - const arbitrableHistory = ArbitrableHistory.load( - Bytes.fromByteArray( - crypto.keccak256(ev.address.concat(biToBytes(ev.params._metaEvidenceID))) - ) - ); - - const dispute = Dispute.load(ev.params._disputeID.toString()); - if (dispute == null) return; - dispute.metaEvidenceId = ev.params._metaEvidenceID; - if (arbitrableHistory != null) - dispute.arbitrableHistory = arbitrableHistory.id; - dispute.save(); - - const evidenceGroupId = Bytes.fromByteArray( - crypto.keccak256(ev.address.concat(biToBytes(ev.params._evidenceGroupID))) - ); - let evidenceGroup = EvidenceGroup.load(evidenceGroupId); - if (evidenceGroup == null) { - evidenceGroup = new EvidenceGroup(evidenceGroupId); - evidenceGroup.length = ZERO; - } - evidenceGroup.dispute = dispute.id; - evidenceGroup.save(); -} - -export function handleEvidence(ev: EvidenceEv): void { - const evidenceGroupId = Bytes.fromByteArray( - crypto.keccak256(ev.address.concat(biToBytes(ev.params._evidenceGroupID))) - ); - let evidenceGroup = EvidenceGroup.load(evidenceGroupId); - if (evidenceGroup == null) { - evidenceGroup = new EvidenceGroup(evidenceGroupId); - evidenceGroup.length = ZERO; - } - evidenceGroup.length = evidenceGroup.length.plus(ONE); - evidenceGroup.save(); - - const evidence = new Evidence( - Bytes.fromByteArray( - crypto.keccak256(evidenceGroupId.concat(biToBytes(evidenceGroup.length))) - ) - ); - evidence.URI = ev.params._evidence; - evidence.group = evidenceGroup.id; - evidence.creationTime = ev.block.timestamp; - evidence.sender = ev.params._party; - evidence.save(); -} - -export function handleRuling(ev: RulingEv): void { - const dispute = Dispute.load(ev.params._disputeID.toString()); - if (dispute == null) return; - dispute.ruling = ev.params._ruling; - dispute.ruled = true; - dispute.save(); -} diff --git a/mappings/kleros-liquid.ts b/mappings/kleros-liquid.ts new file mode 100644 index 0000000..7d04762 --- /dev/null +++ b/mappings/kleros-liquid.ts @@ -0,0 +1,287 @@ +import { + AppealDecision as AppealDecisionEv, + AppealPossible as AppealPossibleEv, + DisputeCreation as DisputeCreationEv, + NewPeriod as NewPeriodEv, + Draw as DrawEv, + TokenAndETHShift as TokenAndETHShiftEv, + KlerosLiquid, + ChangeSubcourtTimesPerPeriodCall, + CreateSubcourtCall} from "../generated/KlerosLiquid/KlerosLiquid"; +import { Arbitrable as ArbitrableContract } from "../generated/templates"; +import { + Dispute, + Draw, + Round, + TokenAndETHShift, + Counter, + Court, + UserRoundInfo, + UserDisputeInfo, +} from "../generated/schema"; +import { ONE, ZERO, ZERO_B } from "./const"; +import { BigInt, Bytes, crypto, log } from "@graphprotocol/graph-ts"; + +export class Period { + static readonly EVIDENCE: string = "EVIDENCE"; + static readonly COMMIT: string = "COMMIT"; + static readonly VOTE: string = "VOTE"; + static readonly APPEAL: string = "APPEAL"; + static readonly EXECUTED: string = "EXECUTED"; + + static parse(status: i32): string { + switch (status) { + case 0: + return this.EVIDENCE; + case 1: + return this.COMMIT; + case 2: + return this.VOTE; + case 3: + return this.APPEAL; + case 4: + return this.EXECUTED; + default: + return "Error"; + } + } +} + + +export function ChangeSubcourtTimesPerPeriodCallHandler(call: ChangeSubcourtTimesPerPeriodCall): void { + const subcourt = call.inputs._subcourtID.toString(); + let court = Court.load(subcourt) + + if (!court) { + log.error("Court {} does not existC", [subcourt]); + return; + } + + court.timesPerPeriod = call.inputs._timesPerPeriod; + court.save(); +} + +export function CreateSubcourtCallHandler(call: CreateSubcourtCall): void { + let counter = Counter.load("Court"); + if (!counter) { + counter = new Counter("Court"); + // general court created in constructor + counter.counter = BigInt.fromU32(1); + } + + const court = new Court(counter.counter.toString()); + + court.hiddenVotes = call.inputs._hiddenVotes; + court.timesPerPeriod = call.inputs._timesPerPeriod; + + counter.counter = counter.counter.plus(BigInt.fromI32(1)); + counter.save(); + court.save(); +} + + +export function biToBytes(bi: BigInt): Bytes { + return bi.isZero() ? ZERO_B : Bytes.fromByteArray(Bytes.fromBigInt(bi)); +} + +export function handleDisputeCreation(ev: DisputeCreationEv): void { + ArbitrableContract.create(ev.params._arbitrable); + const contract = KlerosLiquid.bind(ev.address) + + if (ev.params._disputeID.equals(ZERO)) { + const court = new Court(ZERO.toString()); + const subcourtData = contract.getSubcourt(ZERO); + court.timesPerPeriod = subcourtData.getTimesPerPeriod(); + const subcourtData2 = contract.courts(ZERO); + court.hiddenVotes = subcourtData2.getHiddenVotes(); + court.save(); + } + + const dispute = new Dispute(ev.params._disputeID.toString()); + dispute.arbitrated = ev.params._arbitrable; + dispute.metaEvidenceId = ZERO; + dispute.ruling = ZERO; + dispute.ruled = false; + dispute.period = Period.EVIDENCE; + dispute.createdAtBlock = ev.block.number; + let counter = Counter.load(dispute.period); + if (counter == null) { + counter = new Counter(dispute.period); + counter.counter = ZERO; + } + dispute.periodNotificationIndex = counter.counter; + counter.counter = counter.counter.plus(ONE); + counter.save(); + dispute.lastPeriodChangeTs = ev.block.timestamp; + dispute.lastPeriodChangeBlock = ev.block.number; + contract.disputes(ev.params._disputeID).getSubcourtID(); + dispute.court = contract.disputes(ev.params._disputeID).getSubcourtID().toString(); + const court = Court.load(dispute.court); + if (court == null) { + log.error("Court {} does not existB", [dispute.court]); + return; + } + dispute.periodDeadline = ev.block.timestamp.plus( + court.timesPerPeriod![0] + ); + dispute.nbRounds = ONE; + dispute.nbChoices = contract + .disputes(ev.params._disputeID) + .getNumberOfChoices(); + + const roundID = Bytes.fromByteArray( + crypto.keccak256(biToBytes(ev.params._disputeID).concat(ZERO_B)) + ) + dispute.currentRound = roundID + dispute.save(); + + const round = new Round(roundID); + round.dispute = dispute.id; + round.round = ZERO + round.isCurrentRound = true; + round.jurors = []; + round.save(); +} + +export function handleAppealPossible(ev: AppealPossibleEv): void { + const dispute = Dispute.load(ev.params._disputeID.toString()); + if (dispute == null) return; + dispute.period = Period.APPEAL; + dispute.lastPeriodChangeTs = ev.block.timestamp; + dispute.lastPeriodChangeBlock = ev.block.number; + dispute.save(); +} + +export function handleAppealDecision(ev: AppealDecisionEv): void { + const dispute = Dispute.load(ev.params._disputeID.toString()); + if (dispute == null) return; + + const roundOld = new Round( + Bytes.fromByteArray( + crypto.keccak256( + biToBytes(ev.params._disputeID).concat(biToBytes(dispute.nbRounds.minus(ONE))) + ) + ) + ); + + if (!roundOld) return; + roundOld.isCurrentRound = false; + + const round = new Round( + Bytes.fromByteArray( + crypto.keccak256( + biToBytes(ev.params._disputeID).concat(biToBytes(dispute.nbRounds)) + ) + ) + ); + round.dispute = dispute.id; + round.jurors = []; + round.isCurrentRound = true; + round.round = dispute.nbRounds; + round.save(); + + dispute.period = Period.EVIDENCE; + dispute.lastPeriodChangeTs = ev.block.timestamp; + dispute.lastPeriodChangeBlock = ev.block.number; + dispute.nbRounds = dispute.nbRounds.plus(ONE); + dispute.save(); +} + +export function handleNewPeriod(ev: NewPeriodEv): void { + const dispute = Dispute.load(ev.params._disputeID.toString()); + if (dispute == null) return; + + dispute.period = Period.parse(ev.params._period); + + if (dispute.period != Period.EXECUTED) { + const court = Court.load(dispute.court); + if (court == null) { + log.error("Court {} does not existA", [dispute.court]); + return; + } + dispute.periodDeadline = ev.block.timestamp.plus( + court.timesPerPeriod![ev.params._period] + ); + } + + let counter = Counter.load(dispute.period); + if (counter == null) { + counter = new Counter(dispute.period); + counter.counter = ZERO; + } + + dispute.periodNotificationIndex = counter.counter; + counter.counter = counter.counter.plus(ONE); + counter.save(); + dispute.lastPeriodChangeTs = ev.block.timestamp; + dispute.lastPeriodChangeBlock = ev.block.number; + dispute.save(); +} + +export function handleDraw(ev: DrawEv): void { + const roundID = Bytes.fromByteArray( + crypto.keccak256( + biToBytes(ev.params._disputeID).concat(biToBytes(ev.params._appeal)) + ) + ) + const round = Round.load(roundID); + if (round == null) return; + + let userDisputeInfo = UserDisputeInfo.load(ev.params._disputeID.toString()+"-"+ev.params._address.toHexString()); + if (userDisputeInfo == null) { + userDisputeInfo = new UserDisputeInfo(ev.params._disputeID.toString()+ev.params._address.toHexString()); + userDisputeInfo.dispute = ev.params._disputeID.toString(); + userDisputeInfo.juror = ev.params._address.toHexString(); + userDisputeInfo.save(); + } + + let userRoundInfo = UserRoundInfo.load(ev.params._disputeID.toString()+"-"+ev.params._address.toHexString()+"-"+ev.params._appeal.toString()); + if (userRoundInfo == null) { + userRoundInfo = new UserRoundInfo(ev.params._disputeID.toString()+ev.params._address.toHexString()); + userRoundInfo.dispute = ev.params._disputeID.toString(); + userRoundInfo.juror = ev.params._address.toHexString(); + userRoundInfo.round = roundID; + let counter = Counter.load("draws"); + if (counter == null) { + counter = new Counter("draws"); + counter.counter = ZERO; + } + userRoundInfo.drawNotificationIndex = counter.counter; + counter.counter = counter.counter.plus(ONE); + counter.save(); + userRoundInfo.save(); + } + + const draw = new Draw( + `${ev.params._disputeID}-${ev.params._appeal}-${ev.params._voteID}` + ); + draw.disputeID = ev.params._disputeID; + draw.appeal = ev.params._appeal; + draw.voteID = ev.params._voteID; + draw.address = ev.params._address; + draw.save(); + + round.jurors.push(ev.params._address); + round.save(); +} + +export function handleTokenAndETHShift(ev: TokenAndETHShiftEv): void { + // Keep rolling until we find a free ID + let i = 0; + while (true) { + const shift = TokenAndETHShift.load( + `${ev.params._disputeID}-${ev.params._address.toHexString()}-${i}` + ); + if (shift == null) break; + i++; + } + + const shift = new TokenAndETHShift( + `${ev.params._disputeID}-${ev.params._address.toHexString()}-${i}` + ); + shift.ETHAmount = ev.params._ETHAmount; + shift.address = ev.params._address; + shift.disputeID = ev.params._disputeID; + shift.tokenAmount = ev.params._tokenAmount; + shift.save(); +} diff --git a/mappings/policy-registry.ts b/mappings/policy-registry.ts new file mode 100644 index 0000000..4da89c0 --- /dev/null +++ b/mappings/policy-registry.ts @@ -0,0 +1,49 @@ +import { PolicyUpdate as PolicyUpdateEvent } from "../generated/PolicyRegistry/PolicyRegistry" +import { Court } from "../generated/schema" +import { ipfs, log, json, Bytes } from "@graphprotocol/graph-ts"; + +export function handlePolicyUpdate(event: PolicyUpdateEvent): void { + let court = Court.load( + event.params._subcourtID.toString() + ) + + if (!court) { + court = new Court( + event.params._subcourtID.toString() + ) + } + court.policy = event.params._policy + + let jsonStr = ipfs.cat(event.params._policy); + if (!jsonStr) { + log.error('Failed to fetch policy #{} SubcourtID: {}', [event.params._policy, event.params._subcourtID.toString()]); + court.save(); + return; + } + + let jsonObjValueAndSuccess = json.try_fromBytes(jsonStr as Bytes); + if (!jsonObjValueAndSuccess.isOk) { + log.error(`Error getting json object value for policy #{} SubcourtID: {}`, [event.params._policy, event.params._subcourtID.toString()]); + court.save(); + return; + } + + let jsonObj = jsonObjValueAndSuccess.value.toObject(); + if (!jsonObj) { + log.error(`Error converting object value for policy #{} SubcourtID: {}`, [event.params._policy, event.params._subcourtID.toString()]); + court.save(); + return; + } + + const name = jsonObj.get('name'); + court.name = name? name.toString() : null; + + const description = jsonObj.get('description'); + court.description = description? description.toString() : null; + + const requiredSkills = jsonObj.get('requiredSkills'); + court.requiredSkills = requiredSkills? requiredSkills.toString() : null; + + court.save(); + +} diff --git a/package.json b/package.json index ab8b7bf..ac84da8 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "build": "graph build", "gen": "graph codegen --output-dir generated", - "deploy-gnosis": "mustache config/xdai.json subgraph.template.yaml > subgraph.yaml && mustache config/xdai.json mappings/const.template.ts > mappings/const.ts && yarn gen && graph deploy --product hosted-service kleros/kleros-display-gnosis", - "deploy-mainnet": "mustache config/mainnet.json subgraph.template.yaml > subgraph.yaml && mustache config/mainnet.json mappings/const.template.ts > mappings/const.ts && yarn gen && graph deploy --product hosted-service kleros/kleros-display-mainnet" + "deploy-gnosis": "mustache config/xdai.json subgraph.template.yaml > subgraph.yaml && yarn gen && graph deploy --product hosted-service kleros/kleros-display-gnosis", + "deploy-mainnet": "mustache config/mainnet.json subgraph.template.yaml > subgraph.yaml && yarn gen && graph deploy --product hosted-service kleros/kleros-display-mainnet" } } diff --git a/schema.graphql b/schema.graphql index a2d30f9..40607ea 100644 --- a/schema.graphql +++ b/schema.graphql @@ -21,19 +21,56 @@ type Dispute @entity { ruled: Boolean! period: Period! createdAtBlock: BigInt! - lastPeriodChange: BigInt! + court: Court! + periodDeadline: BigInt! + periodNotificationIndex: BigInt! + lastPeriodChangeTs: BigInt! + lastPeriodChangeBlock: BigInt! nbChoices: BigInt! nbRounds: BigInt! + currentRound: Round! rounds: [Round!]! @derivedFrom(field: "dispute") evidenceGroup: EvidenceGroup! @derivedFrom(field: "dispute") } type Round @entity { id: Bytes! + round: BigInt! + isCurrentRound: Boolean! dispute: Dispute! jurors: [Bytes!]! } +type UserDisputeInfo @entity { + id: String! + dispute: Dispute! + juror: String! +} + +type UserRoundInfo @entity { + id: String! + dispute: Dispute! + drawNotificationIndex: BigInt! + juror: String! + round: Round! +} + +type Counter @entity { + id: String! + counter: BigInt! +} + +type Court @entity { + id: String! + timesPerPeriod: [BigInt!] + hiddenVotes: Boolean + policy: String + name: String + description: String + summary: String + requiredSkills: String +} + type Draw @entity { "disputeID-appeal-voteID" id: ID! @@ -69,4 +106,4 @@ type Evidence @entity(immutable: true) { creationTime: BigInt! URI: String! sender: Bytes! -} +} \ No newline at end of file diff --git a/subgraph.template.yaml b/subgraph.template.yaml index 7b0f9b5..0f0bd07 100644 --- a/subgraph.template.yaml +++ b/subgraph.template.yaml @@ -1,38 +1,65 @@ -specVersion: 0.0.4 -description: Kleros subgraph +specVersion: 0.0.5 schema: file: ./schema.graphql +features: + - ipfsOnEthereumContracts dataSources: - - name: Kleros - kind: ethereum + - kind: ethereum + name: KlerosLiquid network: {{chain}} source: - address: "{{address}}" - abi: Kleros - startBlock: {{startBlock}} + address: "{{kleros.address}}" + abi: KlerosLiquid + startBlock: {{kleros.startBlock}} mapping: kind: ethereum/events apiVersion: 0.0.7 language: wasm/assemblyscript - file: ./mappings/index.ts entities: - - Dispute + - Draw + - DisputeCreation + - Counter + - AppealDecision abis: - - name: Kleros - file: ./contracts/kleros.json + - name: KlerosLiquid + file: ./contracts/KlerosLiquid.json eventHandlers: + - event: Draw(indexed address,indexed uint256,uint256,uint256) + handler: handleDraw - event: DisputeCreation(indexed uint256,indexed address) handler: handleDisputeCreation - - event: AppealPossible(indexed uint256,indexed address) - handler: handleAppealPossible - - event: AppealDecision(indexed uint256,indexed address) - handler: handleAppealDecision - event: NewPeriod(indexed uint256,uint8) handler: handleNewPeriod - - event: Draw(indexed address,indexed uint256,uint256,uint256) - handler: handleDraw + - event: AppealDecision(indexed uint256,indexed address) + handler: handleAppealDecision - event: TokenAndETHShift(indexed address,indexed uint256,int256,int256) handler: handleTokenAndETHShift + callHandlers: + - function: "createSubcourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256)" + handler: CreateSubcourtCallHandler + - function: "changeSubcourtTimesPerPeriod(uint96,uint256[4])" + handler: ChangeSubcourtTimesPerPeriodCallHandler + file: ./mappings/kleros-liquid.ts + - kind: ethereum + name: PolicyRegistry + network: {{chain}} + source: + address: "{{policyRegistry.address}}" + abi: PolicyRegistry + startBlock: {{policyRegistry.startBlock}} + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - PolicyUpdate + abis: + - name: PolicyRegistry + file: ./contracts/PolicyRegistry.json + eventHandlers: + - event: PolicyUpdate(indexed uint256,string) + handler: handlePolicyUpdate + file: ./mappings/policy-registry.ts templates: - name: Arbitrable kind: ethereum/contract @@ -43,14 +70,14 @@ templates: kind: ethereum/events apiVersion: 0.0.7 language: wasm/assemblyscript - file: ./mappings/index.ts + file: ./mappings/arbitrable.ts entities: - Dispute - EvidenceGroup - Evidence abis: - name: Arbitrable - file: ./contracts/arbitrable.json + file: ./contracts/Arbitrable.json eventHandlers: - event: MetaEvidence(indexed uint256,string) handler: handleMetaEvidence diff --git a/subgraph.yaml b/subgraph.yaml index 0dba9c8..a7670a9 100644 --- a/subgraph.yaml +++ b/subgraph.yaml @@ -1,56 +1,83 @@ -specVersion: 0.0.4 -description: Kleros subgraph +specVersion: 0.0.5 schema: file: ./schema.graphql +features: + - ipfsOnEthereumContracts dataSources: - - name: Kleros - kind: ethereum - network: xdai + - kind: ethereum + name: KlerosLiquid + network: mainnet source: - address: "0x9c1da9a04925bdfdedf0f6421bc7eea8305f9002" - abi: Kleros - startBlock: 16895601 + address: "0x988b3A538b618C7A603e1c11Ab82Cd16dbE28069" + abi: KlerosLiquid + startBlock: 7303699 mapping: kind: ethereum/events apiVersion: 0.0.7 language: wasm/assemblyscript - file: ./mappings/index.ts entities: - - Dispute + - Draw + - DisputeCreation + - Counter + - AppealDecision abis: - - name: Kleros - file: ./contracts/kleros.json + - name: KlerosLiquid + file: ./contracts/KlerosLiquid.json eventHandlers: + - event: Draw(indexed address,indexed uint256,uint256,uint256) + handler: handleDraw - event: DisputeCreation(indexed uint256,indexed address) handler: handleDisputeCreation - - event: AppealPossible(indexed uint256,indexed address) - handler: handleAppealPossible - - event: AppealDecision(indexed uint256,indexed address) - handler: handleAppealDecision - event: NewPeriod(indexed uint256,uint8) handler: handleNewPeriod - - event: Draw(indexed address,indexed uint256,uint256,uint256) - handler: handleDraw + - event: AppealDecision(indexed uint256,indexed address) + handler: handleAppealDecision - event: TokenAndETHShift(indexed address,indexed uint256,int256,int256) handler: handleTokenAndETHShift + callHandlers: + - function: "createSubcourt(uint96,bool,uint256,uint256,uint256,uint256,uint256[4],uint256)" + handler: CreateSubcourtCallHandler + - function: "changeSubcourtTimesPerPeriod(uint96,uint256[4])" + handler: ChangeSubcourtTimesPerPeriodCallHandler + file: ./mappings/kleros-liquid.ts + - kind: ethereum + name: PolicyRegistry + network: mainnet + source: + address: "0xcf1f07713d5193fae5c1653c9f61953d048bece4" + abi: PolicyRegistry + startBlock: 10175794 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - PolicyUpdate + abis: + - name: PolicyRegistry + file: ./contracts/PolicyRegistry.json + eventHandlers: + - event: PolicyUpdate(indexed uint256,string) + handler: handlePolicyUpdate + file: ./mappings/policy-registry.ts templates: - name: Arbitrable kind: ethereum/contract - network: xdai + network: mainnet source: abi: Arbitrable mapping: kind: ethereum/events apiVersion: 0.0.7 language: wasm/assemblyscript - file: ./mappings/index.ts + file: ./mappings/arbitrable.ts entities: - Dispute - EvidenceGroup - Evidence abis: - name: Arbitrable - file: ./contracts/arbitrable.json + file: ./contracts/Arbitrable.json eventHandlers: - event: MetaEvidence(indexed uint256,string) handler: handleMetaEvidence From 876261986934d6c594bd563dea464436fcc0a77f Mon Sep 17 00:00:00 2001 From: shotaronowhere Date: Tue, 17 Oct 2023 21:06:30 -0700 Subject: [PATCH 2/2] fix: add disputeid as bigint for filtering --- generated/schema.ts | 13 +++++++++++++ mappings/kleros-liquid.ts | 1 + schema.graphql | 1 + 3 files changed, 15 insertions(+) diff --git a/generated/schema.ts b/generated/schema.ts index 3a7ed89..19b31db 100644 --- a/generated/schema.ts +++ b/generated/schema.ts @@ -115,6 +115,19 @@ export class Dispute extends Entity { this.set("id", Value.fromString(value)); } + get disputeIDNumber(): BigInt { + let value = this.get("disputeIDNumber"); + if (!value || value.kind == ValueKind.NULL) { + throw new Error("Cannot return null for a required field."); + } else { + return value.toBigInt(); + } + } + + set disputeIDNumber(value: BigInt) { + this.set("disputeIDNumber", Value.fromBigInt(value)); + } + get arbitrated(): Bytes { let value = this.get("arbitrated"); if (!value || value.kind == ValueKind.NULL) { diff --git a/mappings/kleros-liquid.ts b/mappings/kleros-liquid.ts index 7d04762..e9aae27 100644 --- a/mappings/kleros-liquid.ts +++ b/mappings/kleros-liquid.ts @@ -98,6 +98,7 @@ export function handleDisputeCreation(ev: DisputeCreationEv): void { } const dispute = new Dispute(ev.params._disputeID.toString()); + dispute.disputeIDNumber = ev.params._disputeID dispute.arbitrated = ev.params._arbitrable; dispute.metaEvidenceId = ZERO; dispute.ruling = ZERO; diff --git a/schema.graphql b/schema.graphql index 40607ea..18a1cdb 100644 --- a/schema.graphql +++ b/schema.graphql @@ -14,6 +14,7 @@ type ArbitrableHistory @entity { type Dispute @entity { id: ID! + disputeIDNumber: BigInt! arbitrated: Bytes! metaEvidenceId: BigInt! arbitrableHistory: ArbitrableHistory