Skip to main content
Helpful?

AddressStringUtil

Git Source - Generated with forge doc

provides utility functions for converting addresses to strings

Reference: https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/AddressStringUtil.sol

Functions

toAsciiString

Converts an address to the uppercase hex string, extracting only len bytes (up to 20, multiple of 2)

function toAsciiString(address addr, uint256 len) internal pure returns (string memory);

Parameters

NameTypeDescription
addraddressthe address to convert
lenuint256the number of bytes to extract

Returns

NameTypeDescription
<none>stringthe hex string

char

Converts a value into is corresponding ASCII character for the hex representation

function char(uint8 b) private pure returns (bytes1 c);

Parameters

NameTypeDescription
buint8the value to convert

Returns

NameTypeDescription
cbytes1the ASCII character

Errors

InvalidAddressLength

error InvalidAddressLength(uint256 len);
Helpful?