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

Name
Type
Description

path

bytes

The encoded swap path.

Returns

Name
Type
Description

<none>

bool

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

decodeFirstPool

Decodes the first pool in path.

Parameters

Name
Type
Description

path

bytes

The bytes encoded swap path.

decodeNextPoolAddress

skipToken

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

Parameters

Name
Type
Description

path

bytes

The swap path.

Returns

Name
Type
Description

<none>

bytes

The remaining token + pool elements in the path.

Last updated