kleros / escrow-v2

Kleros Escrow v2 monorepo
https://escrow-v2.kleros.builders
1 stars 4 forks source link

Escrow dispute template and mappings #12

Open jaybuidl opened 6 months ago

jaybuidl commented 6 months ago

Blocked by https://github.com/kleros/kleros-v2/issues/1082, https://github.com/kleros/kleros-v2/issues/1083, https://github.com/kleros/kleros-v2/issues/1111 Relates to https://github.com/kleros/kleros-v2/issues/1353

Draft Specification

disputeDetails.jsonc

{
  "$schema": "../NewDisputeTemplate.schema.json",
  "title": "{{title}}", // from the form
  "description": "{{description}}", // from the contract terms form
  "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/XxxxxXXX/escrow-general-policy.pdf", // not transaction-specific
  "attachment": { // transaction-specific
    "label": "Transaction Terms",
    "uri": "{{extraDescriptionUri}}"
  },
  "frontendUrl": "https://escrow-v2.kleros.builders/#/myTransactions/%s/overview", // deployment specific, might break over time
  "arbitrableChainID": "421614",
  "arbitrableAddress": "0x??", // Escrow, hardcode after deploy-time
  "arbitratorChainID": "421614",
  "arbitratorAddress": "0x??", // KlerosCore, hardcode after deploy-time
  "metadata": {
    "buyer": "{{buyer}}",
    "seller": "{{seller}}",
    "amount": "{{amount}}",
    "currency": "{{currency}}",
    "deadline": "{{deadline}}",
    "transactionUri": "{{transactionUri}}" // transaction-specific
  },
  "category": "Escrow",
  "specification": "KIPXXX",
  "aliases": {
    "Buyer": "{{buyer}}",
    "Seller": "{{seller}}"
  },
  "version": "1.0"
}

mappings.jsonc

[
  {
    "type": "abi/event",
    "abi": "event TransactionCreated(uint256 indexed _transactionID, string _transactionUri, address indexed _buyer, address indexed _seller, uint256 _amount, uint256 _currency, uint256 deadline)",
    "address": "[FIX AFTER DEPLOY]",
    "eventFilter": {
      "fromBlock": "[FIX AFTER DEPLOY]",
      "toBlock": "latest",
      "args": {
        "_transactionID": "[FROM EXTERNAL DISPUTE ID]"
      }
    },
    "seek": [
      "transactionUri",
      "buyer",
      "seller",
      "amount",
      "currency",
      "deadline"
    ],
    "populate": [
      "_transactionUri",
      "_buyer",
      "_seller",
      "_amount",
      "_currency",
      "_deadline"
    ]
  },
  {
    "type":"fetch/ipfsJson",
    "todo": "get title, description, extraDescriptionUri from _transactionUri"
  }
]
kemuru commented 2 months ago

LATEST ESCROW V2 TEMPLATE AND DATA MAPPINGS AS OF 25th June 2024:

externalDisputeID:

0

template:

{
  "$schema": "../NewDisputeTemplate.schema.json",
  "title": "Escrow dispute: {{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/XxxxxXXX/escrow-general-policy.pdf", 
  "attachment": { 
    "label": "Transaction Terms",
    "uri": "{{{extraDescriptionUri}}}"
  },
  "frontendUrl": "https://escrow-v2.kleros.builders/#/transactions/{{externalDisputeID}}", 
  "arbitrableChainID": "421614",
  "arbitrableAddress": "0x??", 
  "arbitratorChainID": "421614",
  "arbitratorAddress": "0x??", 
  "metadata": {
    "buyer": "{{buyer}}",
    "seller": "{{seller}}",
    "amount": "{{amount}}",
    "token": "{{token}}",
    "deadline": "{{deadline}}",
    "transactionUri": "{{{transactionUri}}}" 
  },
  "category": "Escrow",
  "specification": "KIPXXX",
  "aliases": {
    "Buyer": "{{buyer}}",
    "Seller": "{{seller}}"
  },
  "version": "1.0"
}

data mappings:

[
  {
    "type": "graphql",
    "endpoint": "https://api.studio.thegraph.com/query/61738/escrow-v2-devnet/version/latest",
    "query": "query GetTransaction($transactionId: ID!) { escrow(id: $transactionId) { transactionUri buyer seller amount token deadline } }",
    "variables": {
      "transactionId": "{{externalDisputeID}}"
    },
    "seek": ["escrow.transactionUri", "escrow.buyer", "escrow.seller", "escrow.amount", "escrow.token", "escrow.deadline"],
    "populate": ["transactionUri", "buyer", "seller", "amount", "token", "deadline"]
  },
  {
    "type": "fetch/ipfs/json",
    "ipfsUri": "{{{transactionUri}}}",
    "seek": ["title", "description", "extraDescriptionUri"],
    "populate": ["escrowTitle", "deliverableText", "extraDescriptionUri"]
  }
]
jaybuidl commented 3 weeks ago

Updated: https://sepolia.arbiscan.io/tx/0xcc4a8ad4cc37320a9cc8a26d50546ea109880cfa294c0b06918e02eb47ad221c#eventlog