Skip to content

Commit 738a6f5

Browse files
Revert "feat: new-list-metadata-flow"
This reverts commit 85ed0ad.
1 parent 85ed0ad commit 738a6f5

File tree

13 files changed

+530
-287
lines changed

13 files changed

+530
-287
lines changed

contracts/deployments/arbitrumSepoliaDevnet/CurateFactory.json

+44-62
Large diffs are not rendered by default.

contracts/deployments/arbitrumSepoliaDevnet/CurateV2.json

+81-81
Large diffs are not rendered by default.

contracts/deployments/arbitrumSepoliaDevnet/CurateView.json

+15-15
Large diffs are not rendered by default.

contracts/src/CurateFactory.sol

+15-27
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,7 @@ contract CurateFactory {
1919

2020
/// @dev Emitted when a new Curate contract is deployed using this factory. TODO: change TCR mentions.
2121
/// @param _address The address of the newly deployed Curate contract.
22-
/// @param _listMetadata A link to registry / list metadata (title,description) using its URI
23-
event NewList(CurateV2 indexed _address, string _listMetadata);
24-
25-
// ************************************* //
26-
// * Enums / Structs * //
27-
// ************************************* //
28-
29-
struct TemplateRegistryParams {
30-
address templateRegistry; // The current status of the item.
31-
string[2] registrationTemplateParameters; // Template and data mappings json for registration requests.
32-
string[2] removalTemplateParameters; // Template and data mappings json for removal requests.
33-
}
22+
event NewGTCR(CurateV2 indexed _address);
3423

3524
// ************************************* //
3625
// * Storage * //
@@ -58,47 +47,46 @@ contract CurateFactory {
5847
/// @param _arbitrator Arbitrator to resolve potential disputes. The arbitrator is trusted to support appeal periods and not reenter.
5948
/// @param _arbitratorExtraData Extra data for the trusted arbitrator contract.
6049
/// @param _evidenceModule The evidence contract for the arbitrator.
61-
/// @param _connectedList The address of the Curate contract that stores related Curate addresses. This parameter can be left empty.
62-
/// @param _templateRegistryParams The dispute template registry.
63-
/// - templateRegistry : The dispute template registry.
64-
/// - registrationTemplateParameters : Template and data mappings json for registration requests.
65-
/// - removalTemplateParameters : Template and data mappings json for removal requests.
50+
/// @param _connectedTCR The address of the Curate contract that stores related Curate addresses. This parameter can be left empty.
51+
/// @param _registrationTemplateParameters Template and data mappings json for registration requests.
52+
/// @param _removalTemplateParameters Template and data mappings json for removal requests.
53+
/// @param _templateRegistry The dispute template registry.
6654
/// @param _baseDeposits The base deposits for requests/challenges as follows:
6755
/// - The base deposit to submit an item.
6856
/// - The base deposit to remove an item.
6957
/// - The base deposit to challenge a submission.
7058
/// - The base deposit to challenge a removal request.
7159
/// @param _challengePeriodDuration The time in seconds parties have to challenge a request.
7260
/// @param _relayerContract The address of the relay contract to add/remove items directly.
73-
/// @param _listMetadata A link to registry / list metadata (title,description) using its URI
7461
function deploy(
7562
address _governor,
7663
IArbitratorV2 _arbitrator,
7764
bytes calldata _arbitratorExtraData,
7865
EvidenceModule _evidenceModule,
79-
address _connectedList,
80-
TemplateRegistryParams calldata _templateRegistryParams,
66+
address _connectedTCR,
67+
string[2] calldata _registrationTemplateParameters,
68+
string[2] calldata _removalTemplateParameters,
69+
address _templateRegistry,
8170
uint256[4] calldata _baseDeposits,
8271
uint256 _challengePeriodDuration,
83-
address _relayerContract,
84-
string memory _listMetadata
72+
address _relayerContract
8573
) public {
8674
CurateV2 instance = clone(curate);
8775
instance.initialize(
8876
_governor,
8977
_arbitrator,
9078
_arbitratorExtraData,
9179
_evidenceModule,
92-
_connectedList,
93-
_templateRegistryParams.registrationTemplateParameters,
94-
_templateRegistryParams.removalTemplateParameters,
95-
_templateRegistryParams.templateRegistry,
80+
_connectedTCR,
81+
_registrationTemplateParameters,
82+
_removalTemplateParameters,
83+
_templateRegistry,
9684
_baseDeposits,
9785
_challengePeriodDuration,
9886
_relayerContract
9987
);
10088
instances.push(instance);
101-
emit NewList(instance, _listMetadata);
89+
emit NewGTCR(instance);
10290
}
10391

10492
/// @notice Adaptation of https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/proxy/Clones.sol.

contracts/src/CurateV2.sol

+10-10
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ contract CurateV2 is IArbitrableV2 {
129129
event RequestSubmitted(bytes32 indexed _itemID, uint256 _requestID);
130130

131131
/// @dev Emitted when the address of the connected Curate contract is set. The Curate is an instance of the Curate contract where each item is the address of a Curate contract related to this one.
132-
/// @param _connectedList The address of the connected Curate.
133-
event ConnectedListSet(address indexed _connectedList);
132+
/// @param _connectedTCR The address of the connected Curate. TODO: change TCR mentions.
133+
event ConnectedTCRSet(address indexed _connectedTCR);
134134

135135
// ************************************* //
136136
// * Initializer * //
@@ -141,7 +141,7 @@ contract CurateV2 is IArbitrableV2 {
141141
/// @param _arbitrator Arbitrator to resolve potential disputes. The arbitrator is trusted to support appeal periods and not reenter.
142142
/// @param _arbitratorExtraData Extra data for the trusted arbitrator contract.
143143
/// @param _evidenceModule The evidence contract for the arbitrator.
144-
/// @param _connectedList The address of the Curate contract that stores related Curate addresses. This parameter can be left empty.
144+
/// @param _connectedTCR The address of the Curate contract that stores related Curate addresses. This parameter can be left empty.
145145
/// @param _registrationTemplateParameters Template and data mappings json for registration requests.
146146
/// @param _removalTemplateParameters Template and data mappings json for removal requests.
147147
/// @param _templateRegistry The dispute template registry.
@@ -157,7 +157,7 @@ contract CurateV2 is IArbitrableV2 {
157157
IArbitratorV2 _arbitrator,
158158
bytes calldata _arbitratorExtraData,
159159
EvidenceModule _evidenceModule,
160-
address _connectedList,
160+
address _connectedTCR,
161161
string[2] calldata _registrationTemplateParameters,
162162
string[2] calldata _removalTemplateParameters,
163163
address _templateRegistry,
@@ -196,8 +196,8 @@ contract CurateV2 is IArbitrableV2 {
196196
})
197197
);
198198

199-
if (_connectedList != address(0)) {
200-
emit ConnectedListSet(_connectedList);
199+
if (_connectedTCR != address(0)) {
200+
emit ConnectedTCRSet(_connectedTCR);
201201
}
202202
}
203203

@@ -241,10 +241,10 @@ contract CurateV2 is IArbitrableV2 {
241241
governor = _governor;
242242
}
243243

244-
/// @dev Change the address of connectedList, the Curate instance that stores addresses of Curate contracts related to this one.
245-
/// @param _connectedList The address of the connectedList contract to use.
246-
function changeConnectedList(address _connectedList) external onlyGovernor {
247-
emit ConnectedListSet(_connectedList);
244+
/// @dev Change the address of connectedTCR, the Curate instance that stores addresses of Curate contracts related to this one.
245+
/// @param _connectedTCR The address of the connectedTCR contract to use.
246+
function changeConnectedTCR(address _connectedTCR) external onlyGovernor {
247+
emit ConnectedTCRSet(_connectedTCR);
248248
}
249249

250250
/// @dev Change the address of the relay contract.

subgraph/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
"node": "20.11.0"
2525
},
2626
"dependencies": {
27-
"@graphprotocol/graph-ts": "^0.33.0"
27+
"@graphprotocol/graph-ts": "^0.32.0"
2828
},
2929
"devDependencies": {
30-
"@graphprotocol/graph-cli": "0.68.5",
30+
"@graphprotocol/graph-cli": "0.64.0",
3131
"@kleros/curate-v2-eslint-config": "workspace:^",
3232
"@kleros/curate-v2-prettier-config": "workspace:^",
3333
"gluegun": "^5.1.2",

subgraph/schema.graphql

+5-11
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
enum Status {
2-
"The item is not registered on the List and there are no pending requests."
2+
"The item is not registered on the TCR and there are no pending requests."
33
absent
44
"The item is registered and there are no pending requests."
55
registered
6-
"The item is not registered on the List, but there is a pending registration request."
6+
"The item is not registered on the TCR, but there is a pending registration request."
77
registrationRequested
8-
"The item is registered on the List, but there is a pending removal request. These are sometimes also called removal requests."
8+
"The item is registered on the TCR, but there is a pending removal request. These are sometimes also called removal requests."
99
clearingRequested
1010
}
1111

@@ -46,16 +46,10 @@ type Registry @entity {
4646
items: [Item!]! @derivedFrom(field: "registry")
4747
"The requests submitted to this list"
4848
requests: [Request!]! @derivedFrom(field: "registry")
49-
"Connected List. Can be the 0 address. In practice, will never be null."
50-
connectedList: Bytes
49+
"Connected TCR. Can be the 0 address. In practice, will never be null."
50+
connectedTCR: Bytes
5151
"The address that registered the curate"
5252
registerer: User!
53-
"Registry metadata"
54-
title: String
55-
description: String
56-
logoURI: String
57-
policyURI: String
58-
metadataURI: String!
5953
}
6054

6155
type Item @entity {

subgraph/src/Curate.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@ import {
77
RequestSubmitted,
88
NewItem,
99
Ruling,
10+
ConnectedTCRSet as ConnectedTCRSetEvent,
1011
Curate,
1112
DisputeRequest,
12-
ConnectedListSet,
1313
} from "../generated/templates/Curate/Curate";
1414
import { ItemStatus, ONE, ZERO, getFinalRuling, getStatus } from "./utils";
1515
import { createRequestFromEvent } from "./entities/Request";
1616
import { createItemFromEvent } from "./entities/Item";
1717
import { ensureUser } from "./entities/User";
1818

19-
// Items on a List can be in 1 of 4 states:
20-
// - (0) Absent: The item is not registered on the List and there are no pending requests.
19+
// Items on a TCR can be in 1 of 4 states:
20+
// - (0) Absent: The item is not registered on the TCR and there are no pending requests.
2121
// - (1) Registered: The item is registered and there are no pending requests.
22-
// - (2) Registration Requested: The item is not registered on the List, but there is a pending
22+
// - (2) Registration Requested: The item is not registered on the TCR, but there is a pending
2323
// registration request.
24-
// - (3) Clearing Requested: The item is registered on the List, but there is a pending removal
24+
// - (3) Clearing Requested: The item is registered on the TCR, but there is a pending removal
2525
// request. These are sometimes also called removal requests.
2626
//
2727
// Registration and removal requests can be challenged. Once the request resolves (either by
@@ -35,7 +35,7 @@ import { ensureUser } from "./entities/User";
3535
//
3636
// Example:
3737
// requestIndex: 0
38-
// requestID: <itemID>@<listAddress>-0
38+
// requestID: <itemID>@<tcrAddress>-0
3939
//
4040
// The only exception to this rule is the itemID, which is the in-contract itemID.
4141
//
@@ -121,13 +121,13 @@ export function handleStatusUpdated(event: ItemStatusChange): void {
121121
request.save();
122122
}
123123

124-
export function handleConnectedListSet(event: ConnectedListSet): void {
124+
export function handleConnectedTCRSet(event: ConnectedTCRSetEvent): void {
125125
let registry = Registry.load(event.address.toHexString());
126126
if (!registry) {
127127
log.error(`Registry {} not found.`, [event.address.toHexString()]);
128128
return;
129129
}
130-
registry.connectedList = event.params._connectedList;
130+
registry.connectedTCR = event.params._connectedTCR;
131131

132132
registry.save();
133133
}

subgraph/src/CurateFactory.ts

+3-31
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
/* eslint-disable prefer-const */
2-
import { Bytes, ipfs, json, log } from "@graphprotocol/graph-ts";
3-
import { NewList } from "../generated/CurateFactory/CurateFactory";
2+
import { NewGTCR } from "../generated/CurateFactory/CurateFactory";
43
import { Registry, User } from "../generated/schema";
54
import { Curate } from "../generated/templates";
65
import { ensureCounter } from "./entities/Counters";
76
import { ensureUser } from "./entities/User";
8-
import { JSONValueToMaybeString, ONE } from "./utils";
7+
import { ONE } from "./utils";
98

10-
export function handleNewCurate(event: NewList): void {
9+
export function handleNewCurate(event: NewGTCR): void {
1110
Curate.create(event.params._address);
1211

1312
let registry = new Registry(event.params._address.toHexString());
@@ -18,33 +17,6 @@ export function handleNewCurate(event: NewList): void {
1817
if (!doesCuratorExist) counter.numberOfCurators = counter.numberOfCurators.plus(ONE);
1918

2019
registry.registerer = ensureUser(event.transaction.from.toHexString()).id;
21-
registry.metadataURI = event.params._listMetadata;
22-
23-
let jsonStr = ipfs.cat(registry.metadataURI);
24-
if (!jsonStr) {
25-
log.error("Failed to fetch registry metadata #{} JSON: {}", [registry.id, registry.metadataURI]);
26-
registry.save();
27-
return;
28-
}
29-
30-
let jsonObjValueAndSuccess = json.try_fromBytes(jsonStr as Bytes);
31-
if (!jsonObjValueAndSuccess.isOk) {
32-
log.error(`Error getting json object value for registry metadata {}`, [registry.id]);
33-
registry.save();
34-
return;
35-
}
36-
37-
let jsonObj = jsonObjValueAndSuccess.value.toObject();
38-
if (!jsonObj) {
39-
log.error(`Error converting object for registry metadata {}`, [registry.id]);
40-
registry.save();
41-
return;
42-
}
43-
44-
registry.title = JSONValueToMaybeString(jsonObj.get("title"));
45-
registry.description = JSONValueToMaybeString(jsonObj.get("description"));
46-
registry.logoURI = JSONValueToMaybeString(jsonObj.get("logoURI"));
47-
registry.policyURI = JSONValueToMaybeString(jsonObj.get("policyURI"));
4820

4921
counter.save();
5022
registry.save();

subgraph/subgraph.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
specVersion: 0.0.7
1+
specVersion: 0.0.4
22
description: Curate
33
features:
44
- fullTextSearch
@@ -11,9 +11,9 @@ dataSources:
1111
name: CurateFactory
1212
network: arbitrum-sepolia
1313
source:
14-
address: "0xF5B335323e1b8c219A9e0bF798a2bFf8325e1cE1"
14+
address: "0x5D03d22229899cd7Af84a3F0f9c39B24F51c8E21"
1515
abi: CurateFactory
16-
startBlock: 23023734
16+
startBlock: 14782094
1717
mapping:
1818
kind: ethereum/events
1919
apiVersion: 0.0.6
@@ -24,7 +24,7 @@ dataSources:
2424
- name: CurateFactory
2525
file: ./../contracts/deployments/arbitrumSepoliaDevnet/CurateFactory.json
2626
eventHandlers:
27-
- event: NewList(indexed address,string)
27+
- event: NewGTCR(indexed address)
2828
handler: handleNewCurate
2929
file: ./src/CurateFactory.ts
3030
templates:
@@ -55,6 +55,6 @@ templates:
5555
handler: handleStatusUpdated
5656
- event: Ruling(indexed address,indexed uint256,uint256)
5757
handler: handleRuling
58-
- event: ConnectedListSet(indexed address)
59-
handler: handleConnectedListSet
58+
- event: ConnectedTCRSet(indexed address)
59+
handler: handleConnectedTCRSet
6060
file: ./src/Curate.ts

web/.env.devnet.public

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Do not enter sensitive information here.
22
export REACT_APP_DEPLOYMENT=devnet
3-
export REACT_APP_ARBSEPOLIA_SUBGRAPH=https://api.thegraph.com/subgraphs/name/harman-singh-waraich/curate-test-graph
3+
export REACT_APP_ARBSEPOLIA_SUBGRAPH=https://api.thegraph.com/subgraphs/name/kemuru/curate-v2-devnet
44
export REACT_APP_STATUS_URL=https://curate-v2-devnet.betteruptime.com/badge
55
export REACT_APP_GENESIS_BLOCK_ARBSEPOLIA=14782082

web/src/hooks/queries/useRegistriesQuery.ts

-5
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@ export type { RegistryDetailsFragment };
88
export const registryFragment = graphql(`
99
fragment RegistryDetails on Registry {
1010
id
11-
title
12-
description
13-
logoURI
14-
policyURI
15-
metadataURI
1611
}
1712
`);
1813

0 commit comments

Comments
 (0)