ODCutils

OmnichainAddresses

OmnichainAddresses

Library with utility functions to encode and decode OmnichainAddress

PREFIX_AND_RESERVED_BYTES

bytes8 PREFIX_AND_RESERVED_BYTES

represent PPPPVVRR prefix

PREFIX_AND_RESERVED_BYTES_BIT_OFFSET

uint256 PREFIX_AND_RESERVED_BYTES_BIT_OFFSET

Offset of the OmnichainAddresses prefix

CHAINID_BIT_OFFSET

uint256 CHAINID_BIT_OFFSET

Offset of the OmnichainAddresses chainid

UnsupportedOmnichainAddressesStructure

error UnsupportedOmnichainAddressesStructure()

Error thrown when OmnichainAddress structure is not supported

encode

function encode(address account) internal view returns (OmnichainAddress)

Encode OmnichainAddress

Parameters

NameTypeDescription
accountaddressAddress of the user

Return Values

NameTypeDescription
[0]OmnichainAddressEncoded OmnichainAddress

encode

function encode(uint32 chainid, address account) internal pure returns (OmnichainAddress)

Encode OmnichainAddress

Parameters

NameTypeDescription
chainiduint32Chain ID to encode
accountaddressAddress of the user

Return Values

NameTypeDescription
[0]OmnichainAddressEncoded OmnichainAddress

decode

function decode(OmnichainAddress oa) internal pure returns (uint32 chainid, address account)

Decode OmnichainAddress

Parameters

NameTypeDescription
oaOmnichainAddressOmnichainAddress to decode

Return Values

NameTypeDescription
chainiduint32Chain ID of the OmnichainAddress
accountaddressAddress of the user

On this page