Skip to content

Commit 1deb2be

Browse files
committed
feat: save the item's position on the list
1 parent 5d66530 commit 1deb2be

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

contracts/GeneralizedTCR.sol

+10-2
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
9191
bytes32[] public itemList; // List of IDs of all submitted items.
9292
mapping(bytes32 => Item) public items; // Maps the item ID to its data. items[_itemID].
9393
mapping(address => mapping(uint => bytes32)) public arbitratorDisputeIDToItem; // Maps a dispute ID to the ID of the item with the disputed request. arbitratorDisputeIDToItem[arbitrator][disputeID].
94+
mapping(bytes32 => uint) public itemIDtoIndex; // Maps an item's ID to its position in the list.
9495

9596
/* Modifiers */
9697

@@ -106,7 +107,13 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
106107
*/
107108
event ItemStatusChange(bytes32 indexed _itemID, uint _requestIndex, uint _roundIndex);
108109

109-
event ItemSubmitted(bytes32 indexed _itemID, bytes data);
110+
/**
111+
* @dev Emitted when a party requests an item to be registered for the first time.
112+
* @param _itemID The ID of the affected item.
113+
* @param _submitter The address of the requester.
114+
* @param _data The item data.
115+
*/
116+
event ItemSubmitted(bytes32 indexed _itemID, address indexed _submitter, bytes _data);
110117

111118
/**
112119
* @dev Constructs the arbitrable curated registry.
@@ -492,8 +499,9 @@ contract GeneralizedTCR is IArbitrable, IEvidence {
492499
if (item.requests.length == 0) {
493500
item.data = _item;
494501
itemList.push(itemID);
502+
itemIDtoIndex[itemID] = itemList.length - 1;
495503

496-
emit ItemSubmitted(itemID, item.data);
504+
emit ItemSubmitted(itemID, msg.sender, item.data);
497505
}
498506
if (item.status == Status.Absent)
499507
item.status = Status.RegistrationRequested;

0 commit comments

Comments
 (0)