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

chore: indications for the template and data mappings #95

Merged
merged 6 commits into from
Feb 5, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 7 additions & 7 deletions contracts/deploy/00-escrow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { HomeChains, isSkipped } from "./utils";

const disputeTemplate = `{
export const disputeTemplate = `{
"$schema": "../NewDisputeTemplate.schema.json",
"title": "Escrow dispute: {{escrowTitle}}",
"description": "{{deliverableText}}",
Expand All @@ -17,14 +17,14 @@ const disputeTemplate = `{
"description": "Select this to release the funds to the Seller."
}
],
"policyURI": "/ipfs/XxxxxXXX/escrow-general-policy.pdf",
"policyURI": "/ipfs/XxxxxXXX/escrow-general-policy.pdf", // we need a general policy for escrows, ask the policy writer?
"attachment": {
"label": "Transaction Terms",
"uri": "{{{extraDescriptionUri}}}"
},
"frontendUrl": "https://escrow-v2.kleros.builders/#/transactions/{{externalDisputeID}}",
"arbitratorChainID": "421614",
"arbitratorAddress": "0xA54e7A16d7460e38a8F324eF46782FB520d58CE8",
"arbitratorChainID": "42161",
"arbitratorAddress": "0x991d2df165670b9cac3B022f4B68D65b664222ea",
"metadata": {
"buyer": "{{buyer}}",
"seller": "{{seller}}",
Expand All @@ -34,7 +34,7 @@ const disputeTemplate = `{
"transactionUri": "{{{transactionUri}}}"
},
"category": "Escrow",
"specification": "KIPXXX",
"specification": "KIPXXX", // what do we set this to, or do we just delete it?
"aliases": {
"Buyer": "{{buyer}}",
"Seller": "{{seller}}"
Expand All @@ -43,10 +43,10 @@ const disputeTemplate = `{
}
`;

const mapping = `[
export const mapping = `[
{
"type": "graphql",
"endpoint": "https://gateway-arbitrum.network.thegraph.com/api/{{{graphApiKey}}}/subgraphs/id/3aZxYcZpZL5BuVhuUupqVrCV8VeNyZEvjmPXibyPHDFQ",
"endpoint": "https://gateway-arbitrum.network.thegraph.com/api/{{{graphApiKey}}}/subgraphs/id/3aZxYcZpZL5BuVhuUupqVrCV8VeNyZEvjmPXibyPHDFQ", // we need to create a subgraph in arbitrum one, then change the id here.
"query": "query GetTransaction($transactionId: ID!) { escrow(id: $transactionId) { transactionUri buyer seller amount token deadline } }",
"variables": {
"transactionId": "{{externalDisputeID}}"
Expand Down
47 changes: 2 additions & 45 deletions contracts/scripts/setDisputeTemplate.ts
Original file line number Diff line number Diff line change
@@ -1,56 +1,13 @@
// import { BigNumber, utils } from "ethers";
import { task } from "hardhat/config";
import { Escrow } from "../typechain-types";

const disputeTemplate = {
title: "{{escrowTitle}}",
description: "{{deliverableText}}",
question: "Which party abided by the terms of the contract?",
answers: [
{
title: "Refund the Buyer",
description: "Select this to return the funds to the Buyer.",
},
{
title: "Pay the Seller",
description: "Select this to release the funds to the Seller.",
},
],
policyURI: "ipfs://TODO",
attachment: {
label: "Transaction Terms",
uri: "{{extraDescriptionUri}}",
},
frontendUrl: "https://escrow-v2.kleros.builders/#/myTransactions/{{transactionId}}",
arbitrableChainID: "421614",
arbitrableAddress: "0x250AB0477346aDFC010585b58FbF61cff1d8f3ea",
arbitratorChainID: "421614",
arbitratorAddress: "0xA54e7A16d7460e38a8F324eF46782FB520d58CE8",
metadata: {
buyer: "{{address}}",
seller: "{{sendingRecipientAddress}}",
amount: "{{sendingQuantity}}",
asset: "{{asset}}",
deadline: "{{deadline}}",
transactionUri: "{{transactionUri}}",
},
category: "Escrow",
specification: "KIPXXX",
aliases: {
Buyer: "{{address}}",
Seller: "{{sendingRecipientAddress}}",
},
version: "1.0",
};
import { disputeTemplate, mapping } from "../deploy/00-escrow";

task("setDisputeTemplate", "Sets the dispute template").setAction(async (args, hre) => {
const { ethers } = hre;
const escrow = (await ethers.getContract("Escrow")) as Escrow;

const disputeTemplateJson = JSON.stringify(disputeTemplate, null, 0);
const mappingJson = "{}";

const tx = await escrow.changeDisputeTemplate(disputeTemplateJson, mappingJson);
const tx = await escrow.changeDisputeTemplate(disputeTemplate, mapping);
await tx.wait().then((receipt) => {
console.log(`Transaction receipt: ${JSON.stringify(receipt)}`);
});
Expand Down
Loading