Skip to content
solidity
import "solidity-scale-codec/src/Utils/UnsignedUtils.sol";

UnsignedUtils

Kind: library

Functions

toU8(uint256 value)

solidity
function toU8(uint256 value) internal pure returns (uint8)

Safely downcasts a `uint256` to `uint8`, reverting if the value exceeds `uint8`'s maximum.

toU16(uint256 value)

solidity
function toU16(uint256 value) internal pure returns (uint16)

Safely downcasts a `uint256` to `uint16`, reverting if the value exceeds `uint16`'s maximum.

toU32(uint256 value)

solidity
function toU32(uint256 value) internal pure returns (uint32)

Safely downcasts a `uint256` to `uint32`, reverting if the value exceeds `uint32`'s maximum.

toU64(uint256 value)

solidity
function toU64(uint256 value) internal pure returns (uint64)

Safely downcasts a `uint256` to `uint64`, reverting if the value exceeds `uint64`'s maximum.

toU128(uint256 value)

solidity
function toU128(uint256 value) internal pure returns (uint128)

Safely downcasts a `uint256` to `uint128`, reverting if the value exceeds `uint128`'s maximum.