1
1
// SPDX-License-Identifier: MIT
2
2
3
- /// @custom:authors: [@unknownunknown1, @mtsalenc* , @hbarcelos* ]
3
+ /// @custom:authors: [@unknownunknown1, @mtsalenc, @hbarcelos]
4
4
/// @custom:reviewers: []
5
5
/// @custom:auditors: []
6
6
/// @custom:bounties: []
@@ -72,6 +72,12 @@ contract CurateV2 is IArbitrableV2 {
72
72
EvidenceModule evidenceModule; // The evidence module for the arbitrator.
73
73
}
74
74
75
+ struct TemplateRegistryParams {
76
+ address templateRegistry; // Dispute Template registry address
77
+ string [2 ] registrationTemplateParameters; // Template and data mappings json for registration requests.
78
+ string [2 ] removalTemplateParameters; // Template and data mappings json for removal requests.
79
+ }
80
+
75
81
// ************************************* //
76
82
// * Storage * //
77
83
// ************************************* //
@@ -119,7 +125,7 @@ contract CurateV2 is IArbitrableV2 {
119
125
120
126
/// @dev Emitted when someone submits an item for the first time.
121
127
/// @param _itemID The ID of the new item.
122
- /// @param _data The item data URI .
128
+ /// @param _data Stringified JSON Object containing item data. Example at :- https://cloudflare-ipfs.com/ipfs/QmTypFX9416z5V87Fsnf6A89rrskh2X8BSVdaKhwzXNiDb/item.json .
123
129
/// @param _addedDirectly Whether the item was added via `addItemDirectly`.
124
130
event NewItem (bytes32 indexed _itemID , string _data , bool _addedDirectly );
125
131
@@ -129,8 +135,12 @@ contract CurateV2 is IArbitrableV2 {
129
135
event RequestSubmitted (bytes32 indexed _itemID , uint256 _requestID );
130
136
131
137
/// @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 _connectedTCR The address of the connected Curate. TODO: change TCR mentions.
133
- event ConnectedTCRSet (address indexed _connectedTCR );
138
+ /// @param _connectedList The address of the connected Curate.
139
+ event ConnectedListSet (address indexed _connectedList );
140
+
141
+ /// @dev Emitted when the list metadata ipfs uri is updated.
142
+ /// @param _listMetadata Ipfs uri to list metadata.
143
+ event ListMetadataSet (string _listMetadata );
134
144
135
145
// ************************************* //
136
146
// * Initializer * //
@@ -141,29 +151,30 @@ contract CurateV2 is IArbitrableV2 {
141
151
/// @param _arbitrator Arbitrator to resolve potential disputes. The arbitrator is trusted to support appeal periods and not reenter.
142
152
/// @param _arbitratorExtraData Extra data for the trusted arbitrator contract.
143
153
/// @param _evidenceModule The evidence contract for the arbitrator.
144
- /// @param _connectedTCR The address of the Curate contract that stores related Curate addresses. This parameter can be left empty.
145
- /// @param _registrationTemplateParameters Template and data mappings json for registration requests.
146
- /// @param _removalTemplateParameters Template and data mappings json for removal requests.
147
- /// @param _templateRegistry The dispute template registry.
154
+ /// @param _connectedList The address of the Curate contract that stores related Curate addresses. This parameter can be left empty.
155
+ /// @param _templateRegistryParams The dispute template registry.
156
+ /// - templateRegistry : The dispute template registry.
157
+ /// - registrationTemplateParameters : Template and data mappings json for registration requests.
158
+ /// - removalTemplateParameters : Template and data mappings json for removal requests.
148
159
/// @param _baseDeposits The base deposits for requests/challenges as follows:
149
160
/// - The base deposit to submit an item.
150
161
/// - The base deposit to remove an item.
151
162
/// - The base deposit to challenge a submission.
152
163
/// - The base deposit to challenge a removal request.
153
164
/// @param _challengePeriodDuration The time in seconds parties have to challenge a request.
154
165
/// @param _relayerContract The address of the relayer contract to add/remove items directly.
166
+ /// @param _listMetadata Stringified JSON object containing list metadata (title, description, isListOfLists, etc.). Example at :- https://cloudflare-ipfs.com/ipfs/QmekLsbXtQfm2jJjdeC5TF1cJcr5qxarZ9bhKmCS9s3ebK/list-metadata.json
155
167
function initialize (
156
168
address _governor ,
157
169
IArbitratorV2 _arbitrator ,
158
170
bytes calldata _arbitratorExtraData ,
159
171
EvidenceModule _evidenceModule ,
160
- address _connectedTCR ,
161
- string [2 ] calldata _registrationTemplateParameters ,
162
- string [2 ] calldata _removalTemplateParameters ,
163
- address _templateRegistry ,
172
+ address _connectedList ,
173
+ TemplateRegistryParams calldata _templateRegistryParams ,
164
174
uint256 [4 ] calldata _baseDeposits ,
165
175
uint256 _challengePeriodDuration ,
166
- address _relayerContract
176
+ address _relayerContract ,
177
+ string calldata _listMetadata
167
178
) external {
168
179
require (! initialized, "Already initialized. " );
169
180
initialized = true ;
@@ -176,16 +187,16 @@ contract CurateV2 is IArbitrableV2 {
176
187
challengePeriodDuration = _challengePeriodDuration;
177
188
relayerContract = _relayerContract;
178
189
179
- templateRegistry = IDisputeTemplateRegistry (_templateRegistry );
190
+ templateRegistry = IDisputeTemplateRegistry (_templateRegistryParams.templateRegistry );
180
191
templateIdRegistration = templateRegistry.setDisputeTemplate (
181
192
"Registration " ,
182
- _registrationTemplateParameters [0 ],
183
- _registrationTemplateParameters [1 ]
193
+ _templateRegistryParams.registrationTemplateParameters [0 ],
194
+ _templateRegistryParams.registrationTemplateParameters [1 ]
184
195
);
185
196
templateIdRemoval = templateRegistry.setDisputeTemplate (
186
197
"Removal " ,
187
- _removalTemplateParameters [0 ],
188
- _removalTemplateParameters [1 ]
198
+ _templateRegistryParams.removalTemplateParameters [0 ],
199
+ _templateRegistryParams.removalTemplateParameters [1 ]
189
200
);
190
201
191
202
arbitrationParamsChanges.push (
@@ -196,9 +207,11 @@ contract CurateV2 is IArbitrableV2 {
196
207
})
197
208
);
198
209
199
- if (_connectedTCR != address (0 )) {
200
- emit ConnectedTCRSet (_connectedTCR );
210
+ if (_connectedList != address (0 )) {
211
+ emit ConnectedListSet (_connectedList );
201
212
}
213
+
214
+ emit ListMetadataSet (_listMetadata);
202
215
}
203
216
204
217
// ************************************* //
@@ -241,10 +254,16 @@ contract CurateV2 is IArbitrableV2 {
241
254
governor = _governor;
242
255
}
243
256
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);
257
+ /// @dev Change the address of connectedList, the Curate instance that stores addresses of Curate contracts related to this one.
258
+ /// @param _connectedList The address of the connectedList contract to use.
259
+ function changeConnectedList (address _connectedList ) external onlyGovernor {
260
+ emit ConnectedListSet (_connectedList);
261
+ }
262
+
263
+ /// @dev Update list metadata ipfs uri.
264
+ /// @param _listMetadata Ipfs uri to list metadata
265
+ function changeListMetadata (string calldata _listMetadata ) external onlyGovernor {
266
+ emit ListMetadataSet (_listMetadata);
248
267
}
249
268
250
269
/// @dev Change the address of the relay contract.
@@ -307,7 +326,7 @@ contract CurateV2 is IArbitrableV2 {
307
326
// ************************************* //
308
327
309
328
/// @dev Directly add an item to the list bypassing request-challenge. Can only be used by the relayer contract.
310
- /// @param _item The URI to the item data.
329
+ /// @param _item Stringified JSON Object containing Item data
311
330
function addItemDirectly (string calldata _item ) external onlyRelayer {
312
331
bytes32 itemID = keccak256 (abi.encodePacked (_item));
313
332
Item storage item = items[itemID];
@@ -324,7 +343,7 @@ contract CurateV2 is IArbitrableV2 {
324
343
}
325
344
326
345
/// @dev Directly remove an item from the list bypassing request-challenge. Can only be used by the relayer contract.
327
- /// @param _itemID The ID of the item to remove.
346
+ /// @param _itemID The ID of the item to remove. Example at :- https://cloudflare-ipfs.com/ipfs/QmTypFX9416z5V87Fsnf6A89rrskh2X8BSVdaKhwzXNiDb/item.json
328
347
function removeItemDirectly (bytes32 _itemID ) external onlyRelayer {
329
348
Item storage item = items[_itemID];
330
349
require (item.status == Status.Registered, "Item must be registered to be removed. " );
@@ -335,7 +354,7 @@ contract CurateV2 is IArbitrableV2 {
335
354
}
336
355
337
356
/// @dev Submit a request to register an item. Accepts enough ETH to cover the deposit, reimburses the rest.
338
- /// @param _item The URI to the item data.
357
+ /// @param _item Stringified JSON object containing item data. Example at :- https://cloudflare-ipfs.com/ipfs/QmTypFX9416z5V87Fsnf6A89rrskh2X8BSVdaKhwzXNiDb/item.json
339
358
function addItem (string calldata _item ) external payable {
340
359
bytes32 itemID = keccak256 (abi.encodePacked (_item));
341
360
Item storage item = items[itemID];
0 commit comments