mirror of
https://github.com/status-im/dagger-contracts.git
synced 2025-02-11 14:17:05 +00:00
- Marketplace tests for requestsForHost, and additional tests for myRequests and mySlots - Added Utils lib with tests - Added additional Bytes32AddressSetMap.keys expectations
24 lines
504 B
Solidity
24 lines
504 B
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.8;
|
|
|
|
library Utils {
|
|
function _resize(bytes32[] memory array, uint8 newSize)
|
|
internal
|
|
pure
|
|
returns (bytes32[] memory)
|
|
{
|
|
require(newSize <= array.length, "size out of bounds");
|
|
|
|
if (newSize == 0) {
|
|
bytes32[] memory empty;
|
|
return empty;
|
|
} else {
|
|
bytes32[] memory sized = new bytes32[](newSize);
|
|
for (uint8 i = 0; i < newSize; i++) {
|
|
sized[i] = array[i];
|
|
}
|
|
return sized;
|
|
}
|
|
}
|
|
}
|