caelum0x 2b68bde5d5 Predikt: full Polymarket-style prediction market — web + mobile + on-chain + bots
Working tree is now the canonical repo. Off-chain play-money + trustless on-chain
(FPMM AMM + CLOB via UMA settlement), AI market factory, creator/social/distribution,
mobile shell + push, one-command demo + deploy-kit. Secrets excluded (see ENV-AND-KEYS.md).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-06 23:29:50 +03:00

5.8 KiB

LibMap

Library for storage of packed unsigned integers.

Structs

Uint8Map

struct Uint8Map {
    mapping(uint256 => uint256) map;
}

A uint8 map in storage.

Uint16Map

struct Uint16Map {
    mapping(uint256 => uint256) map;
}

A uint16 map in storage.

Uint32Map

struct Uint32Map {
    mapping(uint256 => uint256) map;
}

A uint32 map in storage.

Uint40Map

struct Uint40Map {
    mapping(uint256 => uint256) map;
}

A uint40 map in storage. Useful for storing timestamps up to 34841 A.D.

Uint64Map

struct Uint64Map {
    mapping(uint256 => uint256) map;
}

A uint64 map in storage.

Uint128Map

struct Uint128Map {
    mapping(uint256 => uint256) map;
}

A uint128 map in storage.

Getters / Setters

get(Uint8Map,uint256)

function get(Uint8Map storage map, uint256 index)
    internal
    view
    returns (uint8 result)

Returns the uint8 value at index in map.

set(Uint8Map,uint256,uint8)

function set(Uint8Map storage map, uint256 index, uint8 value) internal

Updates the uint8 value at index in map.

get(Uint16Map,uint256)

function get(Uint16Map storage map, uint256 index)
    internal
    view
    returns (uint16 result)

Returns the uint16 value at index in map.

set(Uint16Map,uint256,uint16)

function set(Uint16Map storage map, uint256 index, uint16 value) internal

Updates the uint16 value at index in map.

get(Uint32Map,uint256)

function get(Uint32Map storage map, uint256 index)
    internal
    view
    returns (uint32 result)

Returns the uint32 value at index in map.

set(Uint32Map,uint256,uint32)

function set(Uint32Map storage map, uint256 index, uint32 value) internal

Updates the uint32 value at index in map.

get(Uint40Map,uint256)

function get(Uint40Map storage map, uint256 index)
    internal
    view
    returns (uint40 result)

Returns the uint40 value at index in map.

set(Uint40Map,uint256,uint40)

function set(Uint40Map storage map, uint256 index, uint40 value) internal

Updates the uint40 value at index in map.

get(Uint64Map,uint256)

function get(Uint64Map storage map, uint256 index)
    internal
    view
    returns (uint64 result)

Returns the uint64 value at index in map.

set(Uint64Map,uint256,uint64)

function set(Uint64Map storage map, uint256 index, uint64 value) internal

Updates the uint64 value at index in map.

get(Uint128Map,uint256)

function get(Uint128Map storage map, uint256 index)
    internal
    view
    returns (uint128 result)

Returns the uint128 value at index in map.

set(Uint128Map,uint256,uint128)

function set(Uint128Map storage map, uint256 index, uint128 value)
    internal

Updates the uint128 value at index in map.

get(mapping(uint256)

function get(
    mapping(uint256 => uint256) storage map,
    uint256 index,
    uint256 bitWidth
) internal view returns (uint256 result)

Returns the value at index in map.

set(mapping(uint256)

function set(
    mapping(uint256 => uint256) storage map,
    uint256 index,
    uint256 value,
    uint256 bitWidth
) internal

Updates the value at index in map.

The following functions search in the range of [start, end)
(i.e. start <= index < end).
The range must be sorted in ascending order.
index precedence: equal to > nearest before > nearest after.
An invalid search range will simply return (found = false, index = start).

searchSorted(Uint8Map,uint8,uint256,uint256)

function searchSorted(
    Uint8Map storage map,
    uint8 needle,
    uint256 start,
    uint256 end
) internal view returns (bool found, uint256 index)

Returns whether map contains needle, and the index of needle.

searchSorted(Uint16Map,uint16,uint256,uint256)

function searchSorted(
    Uint16Map storage map,
    uint16 needle,
    uint256 start,
    uint256 end
) internal view returns (bool found, uint256 index)

Returns whether map contains needle, and the index of needle.

searchSorted(Uint32Map,uint32,uint256,uint256)

function searchSorted(
    Uint32Map storage map,
    uint32 needle,
    uint256 start,
    uint256 end
) internal view returns (bool found, uint256 index)

Returns whether map contains needle, and the index of needle.

searchSorted(Uint40Map,uint40,uint256,uint256)

function searchSorted(
    Uint40Map storage map,
    uint40 needle,
    uint256 start,
    uint256 end
) internal view returns (bool found, uint256 index)

Returns whether map contains needle, and the index of needle.

searchSorted(Uint64Map,uint64,uint256,uint256)

function searchSorted(
    Uint64Map storage map,
    uint64 needle,
    uint256 start,
    uint256 end
) internal view returns (bool found, uint256 index)

Returns whether map contains needle, and the index of needle.

searchSorted(Uint128Map,uint128,uint256,uint256)

function searchSorted(
    Uint128Map storage map,
    uint128 needle,
    uint256 start,
    uint256 end
) internal view returns (bool found, uint256 index)

Returns whether map contains needle, and the index of needle.

searchSorted(mapping(uint256)

function searchSorted(
    mapping(uint256 => uint256) storage map,
    uint256 needle,
    uint256 start,
    uint256 end,
    uint256 bitWidth
) internal view returns (bool found, uint256 index)

Returns whether map contains needle, and the index of needle.