Skip to main content
Helpful?

Path

Functions

hasMultiplePools

  function hasMultiplePools(
bytes path
) internal returns (bool)

Returns true iff the path contains two or more pools

Parameters:

NameTypeDescription
pathbytesThe encoded swap path

Return Values:

TypeDescription
boolif path contains two or more pools, otherwise false

decodeFirstPool

  function decodeFirstPool(
bytes path
) internal returns (address tokenA, address tokenB, uint24 fee)

Decodes the first pool in path

Parameters:

NameTypeDescription
pathbytesThe bytes encoded swap path

Return Values:

NameTypeDescription
tokenAaddressThe first token of the given pool
tokenBaddressThe second token of the given pool
feeuint24The fee level of the pool

getFirstPool

  function getFirstPool(
bytes path
) internal returns (bytes)

Gets the segment corresponding to the first pool in the path

Parameters:

NameTypeDescription
pathbytesThe bytes encoded swap path

Return Values:

TypeDescription
bytessegment containing all data necessary to target the first pool in the path

skipToken

  function skipToken(
bytes path
) internal returns (bytes)

Skips a token + fee element from the buffer and returns the remainder

Parameters:

NameTypeDescription
pathbytesThe swap path

Return Values:

TypeDescription
bytesremaining token + fee elements in the path
Helpful?