Skip to content

Repository files navigation

Array Util

Library for Array


Lib for solidity arrays.

Installation

forge install grappafinance/array-lib@v0.1.0 --no-commit

Add to remapping.txt

array-lib=lib/array-lib/src

Usage

Array Utils

import {UintArrayLib} from"array-lib/UintArrayLib.sol";
using UintArrayLibforuint256[];
function zeroSum(uint256[] memoryarr) internalpurereturns (bool) {
return arr.sum() ==0;
}

Sorting

import {QuickSort} from"array-lib/sorting/QuickSort.sol";
using QuickSortforuint256[];
function calculateSomethingHard() internalpurereturns (bool) {
uint256[] memory arr =_getArr();
// get a new sorting arrayuint256[] sorted = arr.getSorted();
// sort in memory
arr.sort();
}

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages