U256Map

U256 to U256 Hash Map

The U256Map contract allows users to manage a mapping between uint256 keys and uint256 values.

Constructor

U256Map()

constructor()

Constructor for the U256Map contract.

Public Functions

exist

function exist(uint256 key) public virtual returns(bool)

Check if a given key exists in the U256Map.

  • Parameters:

    • key (uint256): The uint256 key to check for existence.

  • Returns:

    • bool: true if the key exists, false otherwise.

at

function at(uint256 idx) public virtual returns(uint256 value)

Retrieves the value stored at the specified index.

  • Parameters:

    • idx (uint256): The index of the element to retrieve.

  • Returns:

    • uint256: The value retrieved from the storage array at the given index.

set

function set(uint256 key, uint256 value)

Set a key-value pair in the U256Map.

  • Parameters:

    • key: The uint256 key to set.

    • value : The uint256 value associated with the key.

get

function get(uint256 key) returns (bool success, uint256 value)

Get the value associated with a given key in the U256Map.

  • Parameters:

    • key: The uint256 key to retrieve the associated value.

  • Returns:

    • value: The uint256 value associated with the key.

keyAt

function keyAt(uint256 idx) returns (bytes memory)

Get the key based on its index.

  • Parameters:

    • idx: The uint256 index to retrieve the associated key.

  • Returns:

    • bytes: The key value associated with the index.

valueAt

function valueAt(uint256 idx) public virtual returns(uint256) 

Get the value based on its index.

  • Parameters:

    • idx: The uint256 key to retrieve the associated index.

  • Returns:

    • The value retrieved from the map at the given index.

del

function del(uint256 key)

Delete a key-value pair from the U256Map.

  • Parameters:

    • key: The uint256 key to delete.

Last updated