Skip to content

Commit 1f88766

Browse files
committed
feat: allow filtering items by status
1 parent 8ad4c05 commit 1f88766

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contracts/view/GeneralizedTCRView.sol

+3-3
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ contract GeneralizedTCRView {
189189
* @param _rlpEncodedMatch The RLP encoded item to match against the items on the list.
190190
* @param _cursor The index from where to start looking for matches.
191191
* @param _count The number of items to iterate and return while searching.
192-
* @param _onlyRegistered Only include items in the registered state. Note that this includes registed items with pending removal requests.
192+
* @param _skipState Boolean tuple defining whether to skip items in a given state. [Absent, Registered, RegistrationRequested, ClearingRequested].
193193
* @param _ignoreColumns Columns to ignore when searching. If this is an array with only false items, then every column must match exactly.
194194
* @return An array with items that match the query.
195195
*/
@@ -198,7 +198,7 @@ contract GeneralizedTCRView {
198198
bytes memory _rlpEncodedMatch,
199199
uint _cursor,
200200
uint _count,
201-
bool _onlyRegistered,
201+
bool[4] memory _skipState,
202202
bool[] memory _ignoreColumns
203203
)
204204
public
@@ -212,7 +212,7 @@ contract GeneralizedTCRView {
212212

213213
for(uint i = _cursor; i < (_count == 0 ? gtcr.itemCount() : _count); i++) { // Iterate over every item in storage.
214214
QueryResult memory item = getItem(_address, gtcr.itemList(i));
215-
if (_onlyRegistered && (item.status == GeneralizedTCR.Status.Absent || item.status == GeneralizedTCR.Status.RegistrationRequested))
215+
if (_skipState[uint(item.status)])
216216
continue;
217217

218218
RLPReader.RLPItem[] memory itemData = item.data.toRlpItem().toList();

0 commit comments

Comments
 (0)