Skip to content

feat(RealitioProxy): update contract for V2 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions .vscode/contract-decorators.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
{
// Place your kleros-v2 workspace snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
// "Print to console": {
// "scope": "javascript,typescript",
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
"Decorator for the Enums / Structs section": {
"scope": "solidity",
"prefix": "/struct",
"body": [
"// ************************************* //",
"// * Enums / Structs * //",
"// ************************************* //",
"$0"
]
},
"Decorator for the Storage section": {
"scope": "solidity",
"prefix": "/stor",
"body": [
"// ************************************* //",
"// * Storage * //",
"// ************************************* //",
"$0"
]
},
"Decorator for the Events section": {
"scope": "solidity",
"prefix": "/event",
"body": [
"// ************************************* //",
"// * Events * //",
"// ************************************* //",
"$0"
]
},
"Decorator for the Function Modifiers section": {
"scope": "solidity",
"prefix": "/modif",
"body": [
"// ************************************* //",
"// * Function Modifiers * //",
"// ************************************* //",
"$0"
]
},
"Decorator for the Constructor section": {
"scope": "solidity",
"prefix": "/constr",
"body": [
"// ************************************* //",
"// * Constructor * //",
"// ************************************* //",
"$0"
]
},
"Decorator for the Initializer section": {
"scope": "solidity",
"prefix": "/init",
"body": [
"// ************************************* //",
"// * Initializer * //",
"// ************************************* //",
"$0"
]
},
"Decorator for the Governance section": {
"scope": "solidity",
"prefix": "/gov",
"body": [
"// ************************************* //",
"// * Governance * //",
"// ************************************* //",
"$0"
]
},
"Decorator for the State Modifiers section": {
"scope": "solidity",
"prefix": "/state",
"body": [
"// ************************************* //",
"// * State Modifiers * //",
"// ************************************* //",
"$0"
]
},
"Decorator for the Public Views section": {
"scope": "solidity",
"prefix": "/view",
"body": [
"// ************************************* //",
"// * Public Views * //",
"// ************************************* //",
"$0"
]
},
"Decorator for the Internal section": {
"scope": "solidity",
"prefix": "/intern",
"body": [
"// ************************************* //",
"// * Internal * //",
"// ************************************* //",
"$0"
]
},
}
58 changes: 31 additions & 27 deletions contracts/deploy/00-reality-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,36 @@ import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { HomeChains, isSkipped } from "./utils";

const disputeTemplate = `{
"$schema": "../NewDisputeTemplate.schema.json",
"title": "Let's do this",
"description": "We want to do this: %s",
"question": "Does it comply with the policy?",
"answers": [
{
"title": "Yes",
"description": "Select this if you agree that it must be done."
},
{
"title": "No",
"description": "Select this if you do not agree that it must be done."
}
],
"policyURI": "/ipfs/Qmdvk...rSD6cE/policy.pdf",
"frontendUrl": "https://kleros-v2.netlify.app/#/cases/%s/overview",
"arbitratorChainID": "421614",
"arbitratorAddress": "0xD08Ab99480d02bf9C092828043f611BcDFEA917b",
"category": "Others",
"specification": "KIP001",
"lang": "en_US"
}
`;
const disputeTemplateFn = (chainId: number, arbitratorAddress: string) => `{
"title": "A reality.eth question",
"description": "A reality.eth question has been raised to arbitration.",
"question": "{{ question }}",
"type": "{{ type }}",
"answers": [
{
"title": "Answered Too Soon",
"description": "Answered Too Soon.",
},
{{# answers }}
{
"title": "{{ title }}",
"description": "{{ description }}",
}{{^ last }},{{/ last }}
{{/ answers }}
],
"policyURI": "/ipfs/QmZ5XaV2RVgBADq5qMpbuEwgCuPZdRgCeu8rhGtJWLV6yz",
"frontendUrl": "https://reality.eth.limo/app/#!/question/{{ realityAddress }}-{{ questionId }}",
"arbitratorChainID": "${chainId}",
"arbitratorAddress": "${arbitratorAddress}",
"category": "Oracle",
"lang": "en_US",
"specification": "KIP99",
"version": "1.0"
}`;

// General court, 3 jurors
const extraData =
"0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003";
"0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003";

const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployments, getNamedAccounts, getChainId } = hre;
Expand All @@ -42,14 +44,16 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {

const klerosCore = await deployments.get("KlerosCore");
const disputeTemplateRegistry = await deployments.get("DisputeTemplateRegistry");

const disputeTemplate = disputeTemplateFn(chainId, klerosCore.address);
const disputeTemplateMappings = "TODO";

await deploy("RealityV2", {
from: deployer,
args: [
klerosCore.address,
extraData,
disputeTemplate,
"disputeTemplateMapping: TODO",
disputeTemplateMappings,
disputeTemplateRegistry.address,
600, // feeTimeout: 10 minutes
],
Expand Down
2 changes: 1 addition & 1 deletion contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dotenv.config();

const config: HardhatUserConfig = {
solidity: {
version: "0.8.18",
version: "0.8.24",
settings: {
optimizer: {
enabled: true,
Expand Down
3 changes: 2 additions & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"typescript": "^5.1.3"
},
"dependencies": {
"@kleros/kleros-v2-contracts": "^0.3.2"
"@kleros/kleros-v2-contracts": "^0.7.0",
"@openzeppelin/contracts": "^5.2.0"
}
}
Loading
Loading