unshETH - Dependencies

Strings.sol

This is a solidity file which provides a library named 'Strings' for performing string operations. It contains functions that convert uint256 data type and addresses to their corresponding ASCII string representations in decimal and hexadecimal forms. The library uses solidity's memory-safe-assembly for efficient and safe memory access and manipulation. It also uses functions from the 'Math' library.

Strings

A library for string operations. It contains functions for converting uint256 and address data types to their string representations in decimal and hexadecimal forms.

toString

function toString(uint256 value) internal pure returns (string memory)

Converts a uint256 to its ASCII string decimal representation.

Parameters

  • value uint256: The value to be converted to string.

Return Values

  • string: The decimal string representation of the given uint256 value.

toHexString

function toHexString(uint256 value) internal pure returns (string memory)

Converts a uint256 to its ASCII string hexadecimal representation.

Parameters

  • value uint256: The value to be converted to hexadecimal string.

Return Values

  • string: The hexadecimal string representation of the given uint256 value.

toHexString

function toHexString(uint256 value, uint256 length) internal pure returns (string memory)

Converts a uint256 to its ASCII string hexadecimal representation with fixed length.

Parameters

  • value uint256: The value to be converted to hexadecimal string.
  • length uint256: The fixed length for the hexadecimal string.

Return Values

  • string: The fixed length hexadecimal string representation of the given uint256 value.

Errors

  • Strings: hex length insufficient: Thrown when the length of the hexadecimal string is not sufficient to represent the given value.

toHexString

function toHexString(address addr) internal pure returns (string memory)

Converts an address with fixed length of 20 bytes to its not checksummed ASCII string hexadecimal representation.

Parameters

  • addr address: The address to be converted to hexadecimal string.

Return Values

  • string: The hexadecimal string representation of the given address.
Previous
Owned.sol