[utils] Remove Utils

No longer required
This commit is contained in:
Mark Spanbroek 2022-11-28 11:52:16 +01:00 committed by markspanbroek
parent 4f75159e02
commit 0ecce3094a
2 changed files with 0 additions and 29 deletions

View File

@ -6,11 +6,9 @@ import "@openzeppelin/contracts/utils/math/Math.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "./Collateral.sol";
import "./Proofs.sol";
import "./libs/Utils.sol";
contract Marketplace is Collateral, Proofs {
using EnumerableSet for EnumerableSet.Bytes32Set;
using Utils for EnumerableSet.Bytes32Set;
type RequestId is bytes32;
type SlotId is bytes32;

View File

@ -1,27 +0,0 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
library Utils {
using EnumerableSet for EnumerableSet.Bytes32Set;
function filter(
EnumerableSet.Bytes32Set storage set,
function(bytes32) internal view returns (bool) include
) internal view returns (bytes32[] memory result) {
bytes32[] memory selected = new bytes32[](set.length());
uint256 amount = 0;
for (uint256 i = 0; i < set.length(); i++) {
if (include(set.at(i))) {
selected[amount++] = set.at(i);
}
}
result = new bytes32[](amount);
for (uint256 i = 0; i < result.length; i++) {
result[i] = selected[i];
}
}
}