Skip to content

Commit 6e3fbb7

Browse files
authored
Merge pull request #67 from kleros/chore/update-mappings-in-create-transaction-flow
chore: update mappings in create transaction flow
2 parents 60495b2 + e258943 commit 6e3fbb7

File tree

11 files changed

+64
-166
lines changed

11 files changed

+64
-166
lines changed

contracts/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Refresh the list of deployed contracts by running `./scripts/generateDeployments
1616
### Devnet
1717
#### Arbitrum Sepolia
1818

19-
- [EscrowUniversal](https://sepolia.arbiscan.io/address/0xd3d61eB06c96F69D03B285392C269d5577ff2342)
19+
- [EscrowUniversal](https://sepolia.arbiscan.io/address/0x9B56c711C54F00276787574B6CEE97C33e690BCb)
2020

2121
#### Sepolia
2222

contracts/deploy/00-escrow.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const disputeTemplate = `{
2020
"policyURI": "/ipfs/XxxxxXXX/escrow-general-policy.pdf",
2121
"attachment": {
2222
"label": "Transaction Terms",
23-
"uri": "{{extraDescriptionUri}}"
23+
"uri": "{{{extraDescriptionUri}}}"
2424
},
2525
"frontendUrl": "https://escrow-v2.kleros.builders/#/transactions/{{externalDisputeID}}",
2626
"arbitrableChainID": "421614",
@@ -33,7 +33,7 @@ const disputeTemplate = `{
3333
"amount": "{{amount}}",
3434
"token": "{{token}}",
3535
"deadline": "{{deadline}}",
36-
"transactionUri": "{{transactionUri}}"
36+
"transactionUri": "{{{transactionUri}}}"
3737
},
3838
"category": "Escrow",
3939
"specification": "KIPXXX",
@@ -66,7 +66,7 @@ const mapping = `[
6666

6767
// General court, 3 jurors
6868
const extraData =
69-
"0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003";
69+
"0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003";
7070

7171
const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
7272
const { deployments, getNamedAccounts, getChainId } = hre;
@@ -81,7 +81,7 @@ const deploy: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
8181
const disputeTemplateRegistry = await deployments.get("DisputeTemplateRegistry");
8282
const feeTimeout = 600; // 10 minutes
8383
const settlementTimeout = 600; // 10 minutes
84-
84+
8585
await deploy("EscrowUniversal", {
8686
from: deployer,
8787
args: [

contracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.json

+55-86
Large diffs are not rendered by default.

contracts/src/EscrowUniversal.sol

-4
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,6 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
135135
transaction.amount = msg.value;
136136
transaction.token = NATIVE;
137137
transaction.deadline = _deadline;
138-
transaction.templateData = _templateData;
139-
transaction.templateDataMappings = _templateDataMappings;
140138

141139
transactionID = transactions.length - 1;
142140

@@ -168,8 +166,6 @@ contract EscrowUniversal is IEscrow, IArbitrableV2 {
168166
transaction.amount = _amount;
169167
transaction.token = _token;
170168
transaction.deadline = _deadline;
171-
transaction.templateData = _templateData;
172-
transaction.templateDataMappings = _templateDataMappings;
173169

174170
transactionID = transactions.length - 1;
175171

contracts/src/interfaces/Types.sol

-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ struct Transaction {
4040
uint256 buyerFee; // Total fees paid by the buyer.
4141
uint256 sellerFee; // Total fees paid by the seller.
4242
uint256 lastFeePaymentTime; // Last time the dispute fees were paid by either party or settlement proposed.
43-
string templateData;
44-
string templateDataMappings;
4543
Status status;
4644
IERC20 token; // Token to pay the seller with.
4745
}

subgraph/mappings/escrow.ts

-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ function createEscrow(id: string, transactionHash: Bytes): Escrow {
3131
escrow.buyerFee = ZERO;
3232
escrow.sellerFee = ZERO;
3333
escrow.lastFeePaymentTime = ZERO;
34-
escrow.templateData = "";
35-
escrow.templateDataMappings = "";
3634
escrow.status = "NoDispute";
3735
escrow.transactionHash = transactionHash;
3836
return escrow;

subgraph/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@kleros/escrow-v2-subgraph",
3-
"version": "2.0.3",
3+
"version": "2.0.4",
44
"license": "MIT",
55
"scripts": {
66
"update:arbitrum-sepolia-devnet": "./scripts/update.sh arbitrumSepoliaDevnet arbitrum-sepolia",

subgraph/schema.graphql

-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ type Escrow @entity {
3636
feeTimeout: BigInt
3737
settlementTimeout: BigInt
3838
arbitratorExtraData: Bytes
39-
templateData: String
40-
templateDataMappings: String
4139
token: Bytes
4240
status: Status
4341
timestamp: BigInt

subgraph/subgraph.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ dataSources:
66
name: EscrowUniversal
77
network: arbitrum-sepolia
88
source:
9-
address: '0xd3d61eB06c96F69D03B285392C269d5577ff2342'
9+
address: '0x9B56c711C54F00276787574B6CEE97C33e690BCb'
1010
abi: EscrowUniversal
11-
startBlock: 56637255
11+
startBlock: 58521526
1212
mapping:
1313
kind: ethereum/events
1414
apiVersion: 0.0.6

web/src/hooks/queries/useTransactionsQuery.ts

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export const transactionFragment = graphql(`
1717
buyerFee
1818
sellerFee
1919
lastFeePaymentTime
20-
templateData
21-
templateDataMappings
2220
status
2321
transactionHash
2422
payments {

web/src/pages/NewTransaction/NavigationButtons/DepositPaymentButton.tsx

+1-60
Original file line numberDiff line numberDiff line change
@@ -74,66 +74,9 @@ const DepositPaymentButton: React.FC = () => {
7474
}
7575
}, [allowance, transactionValue]);
7676

77-
const templateData = useMemo(
78-
() =>
79-
JSON.stringify({
80-
$schema: "../NewDisputeTemplate.schema.json",
81-
title: escrowTitle,
82-
description: deliverableText,
83-
question: "Which party abided by the terms of the contract?",
84-
answers: [
85-
{
86-
title: "Refund the Buyer",
87-
description: "Select this to return the funds to the Buyer.",
88-
},
89-
{
90-
title: "Pay the Seller",
91-
description: "Select this to release the funds to the Seller.",
92-
},
93-
],
94-
policyURI: "ipfs://TODO",
95-
attachment: {
96-
label: "Transaction Terms",
97-
uri: extraDescriptionUri,
98-
},
99-
frontendUrl: `https://escrow-v2.kleros.builders/#/transactions/%s`,
100-
arbitrableChainID: "421614",
101-
arbitrableAddress: "0x250AB0477346aDFC010585b58FbF61cff1d8f3ea",
102-
arbitratorChainID: "421614",
103-
arbitratorAddress: "0xA54e7A16d7460e38a8F324eF46782FB520d58CE8",
104-
metadata: {
105-
buyer: address,
106-
seller: sellerAddress,
107-
amount: sendingQuantity,
108-
token: isNativeTransaction ? "native" : sendingToken?.address,
109-
deadline: deadlineTimestamp.toString(),
110-
transactionUri: transactionUri,
111-
},
112-
category: "Escrow",
113-
specification: "KIPXXX",
114-
aliases: {
115-
Buyer: address,
116-
Seller: sellerAddress,
117-
},
118-
version: "1.0",
119-
}),
120-
[
121-
escrowTitle,
122-
deliverableText,
123-
extraDescriptionUri,
124-
sendingQuantity,
125-
sellerAddress,
126-
address,
127-
isNativeTransaction,
128-
sendingToken?.address,
129-
deadlineTimestamp,
130-
transactionUri,
131-
]
132-
);
133-
13477
const { config: createNativeTransactionConfig } = usePrepareEscrowUniversalCreateNativeTransaction({
13578
enabled: isNativeTransaction && ethAddressPattern.test(finalRecipientAddress),
136-
args: [deadlineTimestamp, transactionUri, finalRecipientAddress, templateData, ""],
79+
args: [deadlineTimestamp, transactionUri, finalRecipientAddress],
13780
value: transactionValue,
13881
});
13982

@@ -149,8 +92,6 @@ const DepositPaymentButton: React.FC = () => {
14992
deadlineTimestamp,
15093
transactionUri,
15194
finalRecipientAddress,
152-
templateData,
153-
"",
15495
],
15596
});
15697

0 commit comments

Comments
 (0)