Skip to content
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

Updated the dispute templates and data mappings #44

Merged
merged 3 commits into from
Jun 23, 2024
Merged
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
107 changes: 75 additions & 32 deletions contracts/deploy/00-curate-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,56 +4,99 @@ import { DeployFunction } from "hardhat-deploy/types";
import { HomeChains, isSkipped } from "./utils";
import { CurateFactory, CurateV2 } from "../typechain-types";

const sharedTemplateProperties = `
"policyURI": "{{{policyURI}}}",
"frontendUrl": "https://curate-v2.kleros.builders/#/lists/item/{{itemID}}",
"arbitrableChainID": "421614",
"arbitrableAddress": "{{arbitrableAddress}}",
"arbitratorChainID": "421614",
"arbitratorAddress": "0xD08Ab99480d02bf9C092828043f611BcDFEA917b",
"metadata": {
"itemName": "{{itemName}}",
"itemDescription": "{{itemDescription}}",
"registryTitle": "{{registryTitle}}",
"registryDescription": "{{registryDescription}}"
},
"category": "Curated Lists",
"version": "1.0"`;
kemuru marked this conversation as resolved.
Show resolved Hide resolved

const registrationTemplate = `{
"$schema": "../NewDisputeTemplate.schema.json",
"title": "Let's do this",
"description": "We want to do this: %s",
"question": "Does it comply with the policy?",
"title": "Add a {{itemName}} to {{registryTitle}}",
"description": "Someone requested to add an {{itemName}} to {{registryTitle}}",
"question": "Does the {{itemName}} comply with the required criteria?",
"answers": [
{
"title": "Yes",
"description": "Select this if you agree that it must be done."
"title": "Yes, Add It",
"description": "Select this if you think that the {{itemName}} does comply with the required criteria and should be added."
},
{
"title": "No",
"description": "Select this if you do not agree that it must be done."
"title": "No, Don't Add It",
"description": "Select this if you think that the {{itemName}} does not comply with the required criteria and should not be added."
}
],
"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"
], ${sharedTemplateProperties}
}
`;

const removalTemplate = `{
"$schema": "../NewDisputeTemplate.schema.json",
"title": "Let's do this",
"description": "We want to do this: %s",
"question": "Should this be removed?",
"title": "Remove a {{itemName}} from {{registryTitle}}",
"description": "Someone requested to remove a {{itemName}} from {{registryTitle}}",
"question": "Does the {{itemName}} comply with the required criteria?",
"answers": [
{
"title": "Yes",
"description": "Select this if you agree that it must be done."
"title": "Yes, Remove It",
"description": "Select this if you think that the {{itemName}} does not comply with the required criteria and should be removed."
},
{
"title": "No",
"description": "Select this if you do not agree that it must be done."
"title": "No, Don't Remove It",
"description": "Select this if you think that the {{itemName}} does comply with the required criteria and should not be removed."
}
],
"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"
], ${sharedTemplateProperties}
}
`;

const dataMappings = `[
{
"type": "graphql",
"endpoint": "https://gateway-arbitrum.network.thegraph.com/api/{{{graphApiKey}}}/subgraphs/id/H93eWJbDpYKAtkLmsMn7Su3ZLZwAwLN5VoyvQH4NbGAv",
"query": "query SearchRequestByDisputeID($externalDisputeID: BigInt!) { requests(where: { externalDisputeID: $externalDisputeID }) { id disputeID submissionTime resolved requester { id } challenger { id } arbitrator arbitratorExtraData deposit disputeOutcome requestType item { id itemID data status registry { id title description policyURI } } } }",
"variables": {
"externalDisputeID": "{{externalDisputeID}}"
},
"seek": [
"requests[0].item.registry.title",
"requests[0].item.registry.description",
"requests[0].item.registry.policyURI",
"requests[0].item.id",
"requests[0].item.data",
"requests[0].item.status",
"requests[0].item.registry.id"
],
"populate": [
"registryTitle",
"registryDescription",
"policyURI",
"itemID",
"itemData",
"itemStatus",
"listAddress"
]
},
{
"type": "json",
"value": "{{{itemData}}}",
"seek": [
"columns[0].label",
"columns[0].description"
],
"populate": [
"itemName",
"itemDescription"
]
}
]`;

const listMetadata = `{
"title": "Kleros Curate",
"description": "A list of all curated lists on Curate V2",
Expand Down Expand Up @@ -107,8 +150,8 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
ethers.ZeroAddress, // _connectedTCR
{
templateRegistry: disputeTemplateRegistry.address,
registrationTemplateParameters: [registrationTemplate, ""],
removalTemplateParameters: [removalTemplate, ""],
registrationTemplateParameters: [registrationTemplate, dataMappings],
removalTemplateParameters: [removalTemplate, dataMappings],
},
[fee, fee, fee, fee],
timeout,
Expand Down
Loading