11// SPDX-License-Identifier: MIT
22
3- /// @custom:authors: [@unknownunknown1, @mtsalenc* , @hbarcelos* ]
3+ /// @custom:authors: [@unknownunknown1, @mtsalenc, @hbarcelos]
44/// @custom:reviewers: []
55/// @custom:auditors: []
66/// @custom:bounties: []
@@ -72,6 +72,12 @@ contract CurateV2 is IArbitrableV2 {
7272 EvidenceModule evidenceModule; // The evidence module for the arbitrator.
7373 }
7474
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+
7581 // ************************************* //
7682 // * Storage * //
7783 // ************************************* //
@@ -119,7 +125,7 @@ contract CurateV2 is IArbitrableV2 {
119125
120126 /// @dev Emitted when someone submits an item for the first time.
121127 /// @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 .
123129 /// @param _addedDirectly Whether the item was added via `addItemDirectly`.
124130 event NewItem (bytes32 indexed _itemID , string _data , bool _addedDirectly );
125131
@@ -129,8 +135,12 @@ contract CurateV2 is IArbitrableV2 {
129135 event RequestSubmitted (bytes32 indexed _itemID , uint256 _requestID );
130136
131137 /// @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 );
134144
135145 // ************************************* //
136146 // * Initializer * //
@@ -141,29 +151,30 @@ contract CurateV2 is IArbitrableV2 {
141151 /// @param _arbitrator Arbitrator to resolve potential disputes. The arbitrator is trusted to support appeal periods and not reenter.
142152 /// @param _arbitratorExtraData Extra data for the trusted arbitrator contract.
143153 /// @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.
148159 /// @param _baseDeposits The base deposits for requests/challenges as follows:
149160 /// - The base deposit to submit an item.
150161 /// - The base deposit to remove an item.
151162 /// - The base deposit to challenge a submission.
152163 /// - The base deposit to challenge a removal request.
153164 /// @param _challengePeriodDuration The time in seconds parties have to challenge a request.
154165 /// @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
155167 function initialize (
156168 address _governor ,
157169 IArbitratorV2 _arbitrator ,
158170 bytes calldata _arbitratorExtraData ,
159171 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 ,
164174 uint256 [4 ] calldata _baseDeposits ,
165175 uint256 _challengePeriodDuration ,
166- address _relayerContract
176+ address _relayerContract ,
177+ string calldata _listMetadata
167178 ) external {
168179 require (! initialized, "Already initialized. " );
169180 initialized = true ;
@@ -176,16 +187,16 @@ contract CurateV2 is IArbitrableV2 {
176187 challengePeriodDuration = _challengePeriodDuration;
177188 relayerContract = _relayerContract;
178189
179- templateRegistry = IDisputeTemplateRegistry (_templateRegistry );
190+ templateRegistry = IDisputeTemplateRegistry (_templateRegistryParams.templateRegistry );
180191 templateIdRegistration = templateRegistry.setDisputeTemplate (
181192 "Registration " ,
182- _registrationTemplateParameters [0 ],
183- _registrationTemplateParameters [1 ]
193+ _templateRegistryParams.registrationTemplateParameters [0 ],
194+ _templateRegistryParams.registrationTemplateParameters [1 ]
184195 );
185196 templateIdRemoval = templateRegistry.setDisputeTemplate (
186197 "Removal " ,
187- _removalTemplateParameters [0 ],
188- _removalTemplateParameters [1 ]
198+ _templateRegistryParams.removalTemplateParameters [0 ],
199+ _templateRegistryParams.removalTemplateParameters [1 ]
189200 );
190201
191202 arbitrationParamsChanges.push (
@@ -196,9 +207,11 @@ contract CurateV2 is IArbitrableV2 {
196207 })
197208 );
198209
199- if (_connectedTCR != address (0 )) {
200- emit ConnectedTCRSet (_connectedTCR );
210+ if (_connectedList != address (0 )) {
211+ emit ConnectedListSet (_connectedList );
201212 }
213+
214+ emit ListMetadataSet (_listMetadata);
202215 }
203216
204217 // ************************************* //
@@ -241,10 +254,16 @@ contract CurateV2 is IArbitrableV2 {
241254 governor = _governor;
242255 }
243256
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);
248267 }
249268
250269 /// @dev Change the address of the relay contract.
@@ -307,7 +326,7 @@ contract CurateV2 is IArbitrableV2 {
307326 // ************************************* //
308327
309328 /// @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
311330 function addItemDirectly (string calldata _item ) external onlyRelayer {
312331 bytes32 itemID = keccak256 (abi.encodePacked (_item));
313332 Item storage item = items[itemID];
@@ -324,7 +343,7 @@ contract CurateV2 is IArbitrableV2 {
324343 }
325344
326345 /// @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
328347 function removeItemDirectly (bytes32 _itemID ) external onlyRelayer {
329348 Item storage item = items[_itemID];
330349 require (item.status == Status.Registered, "Item must be registered to be removed. " );
@@ -335,7 +354,7 @@ contract CurateV2 is IArbitrableV2 {
335354 }
336355
337356 /// @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
339358 function addItem (string calldata _item ) external payable {
340359 bytes32 itemID = keccak256 (abi.encodePacked (_item));
341360 Item storage item = items[itemID];
0 commit comments