Path

Path is [pool_addr, tokenAIn, pool_addr, tokenAIn ...], alternating 20 bytes and then one byte for the tokenAIn bool.

State Variables

ADDR_SIZE

The length of the bytes encoded address.

uint256 private constant ADDR_SIZE = 20;

BOOL_SIZE

The length of the bytes encoded bool.

uint256 private constant BOOL_SIZE = 1;

NEXT_OFFSET

The offset of a single token address and pool address.

uint256 private constant NEXT_OFFSET = ADDR_SIZE + BOOL_SIZE;

Functions

hasMultiplePools

Returns true iff the path contains two or more pools.

function hasMultiplePools(bytes memory path) internal pure returns (bool);

Parameters

NameTypeDescription

path

bytes

The encoded swap path.

Returns

NameTypeDescription

<none>

bool

True if path contains two or more pools, otherwise false.

decodeFirstPool

Decodes the first pool in path.

function decodeFirstPool(bytes memory path) internal pure returns (IMaverickV2Pool pool, bool tokenAIn);

Parameters

NameTypeDescription

path

bytes

The bytes encoded swap path.

decodeNextPoolAddress

function decodeNextPoolAddress(bytes memory path) internal pure returns (address pool);

skipToken

Skips a token + pool element from the buffer and returns the remainder.

function skipToken(bytes memory path) internal pure returns (bytes memory);

Parameters

NameTypeDescription

path

bytes

The swap path.

Returns

NameTypeDescription

<none>

bytes

The remaining token + pool elements in the path.

Last updated