forge install grappafinance/[email protected] --no-commit
Add to remapping.txt
array-lib=lib/array-lib/src
import {UintArrayLib} from "array-lib/UintArrayLib.sol";
using UintArrayLib for uint256[];
function zeroSum(uint256[] memory arr) internal pure returns (bool) {
return arr.sum() == 0;
}
import {QuickSort} from "array-lib/sorting/QuickSort.sol";
using QuickSort for uint256[];
function calculateSomethingHard() internal pure returns (bool) {
uint256[] memory arr = _getArr();
// get a new sorting array
uint256[] sorted = arr.getSorted();
// sort in memory
arr.sort();
}