Miscellaneous contracts containing utility functions, often related to working with different data types.



Collection of functions related to the address type

isContract(address account) → bool

Returns true if account is a contract.

This test is non-exhaustive, and there may be false-negatives: during the execution of a contract’s constructor, its address will be reported as not containing a contract.

It is unsafe to assume that an address for which this function returns false is an externally-owned account (EOA) and not a contract.

toPayable(address account) → address payable

Converts an address into address payable. Note that this is simply a type cast: the actual underlying value is not changed.

This is a feature of the next version of OpenZeppelin Contracts. Get it via npm install @openzeppelin/contracts@next.


Collection of functions related to array types.


findUpperBound(uint256[] array, uint256 element) → uint256

Searches a sorted array and returns the first index that contains a value greater or equal to element. If no such index exists (i.e. all values in the array are strictly less than element), the array length is returned. Time complexity O(log n).

array is expected to be sorted in ascending order, and to contain no repeated elements.


Contract module that helps prevent reentrant calls to a function.

Inheriting from ReentrancyGuard will make the nonReentrant modifier available, which can be applied to functions to make sure there are no nested (reentrant) calls to them.

Note that because there is a single nonReentrant guard, functions marked as nonReentrant may not call one another. This can be worked around by making those functions private, and then adding external nonReentrant entry points to them.



Prevents a contract from calling itself, directly or indirectly. Calling a nonReentrant function from another nonReentrant function is not supported. It is possible to prevent this from happening by making the nonReentrant function external, and make it call a private function that does the actual work.