For the complete documentation index, see llms.txt. This page is also available as Markdown.

IBlueshiftRouter

Parameter Structs
Functions

Parameter Structs

Signature

struct Signature {
        uint8 v;
        bytes32 r;
        bytes32 s;
    }

Standard ECDSA signature structure.

PermitStruct

Structure that holds all the data for token spend permit operation.

Fields description

Name

Type

Description

owner

address

Token's owner

spender

address

Token's spender

value

uint256

Amount of tokens that owner approves to be spent by spender

deadline

uint256

Timestamp indicates when the signature expires

signature

struct

PS.Signature

Standard ECDSA signature. Signer (owner) signs all other structure's fields together and then adds a signature field

Functions

WETH

Returns current network's wrapped native token`s address.

swapExactTokensForTokensWithPortfolios

Swaps an exact amount of input tokens for as many output tokens as possible, along the route determined by the path. The first element of the path is the input token, the last is the output token, and any intermediate elements represent intermediate pairs to trade through (if, for example, a direct pair does not exist). Properly works with fee-on-transfer tokens.

Parameters

Name

Type

Description

amountIn

uint256

Amount of swap's input token

amountOutMin

uint256

Minimal amount of swap's output token. If less tokens are received by swap transaction is reverted

path

address[]

Tokens' addresses to perform swap through

to

address

Output token's receiver address

deadline

uint256

Timestamp indicates when the swap becomes irrelevant

portfolios

address[]

Addresses of portfolios that should perform chain swaps (swap path[i] token on path[i+1] token through portfolios[i] portfolio)

destinationChainId

uint256

A destination chain identifier for cross-chain swaps. Must be 0 for local swaps.

Return values

Name

Type

Description

amounts

uint256[]

Amounts out of all the tokens during swap. amounts[i] of path[i+1] token is the input amount for path[i+1] -> path[i+2] swap. amounts[amounts.length - 1] is the output token amount out.

amounts.length == path.length - 1

swapTokensForExactTokensWithPortfolios

Receive an exact amount of output tokens for as few input tokens as possible, along the route determined by the path. The first element of the path is the input token, the last is the output token, and any intermediate elements represent intermediate tokens to trade through (if, for example, a direct pair does not exist).

Parameters

Name

Type

Description

amountOut

uint256

Amount of swap`s output token

amountInMax

uint256

Maximal amount of swap`s input token. If more tokens are required by swap transaction is reverted

path

address[]

Tokens` addresses to perform swap through

to

address

Output token`s receiver address

deadline

uint256

Timestamp indicates when the swap becomes irrelevant

portfolios

address[]

Addresses of portfolios that should perform chain swaps (swap path[i] token on path[i+1] token through portfolios[i] portfolio)

destinationChainId

uint256

Must be 0.

Return values

Name

Type

Description

amounts

uint256[]

Amounts out of all the tokens during swap. amounts[i] of path[i+1] token is the input amount for path[i+1] -> path[i+2] swap. amounts[0] is the input token amount in.

amounts.length == path.length - 1

swapExactETHForTokensWithPortfolios

Swaps an exact amount of ETH for as many output tokens as possible, along the route determined by the path. The first element of the path must be WETH (wrapped native token), the last is the output token, and any intermediate elements represent intermediate pairs to trade through (if, for example, a direct pair does not exist). Properly works with fee-on-transfer tokens.

Parameters

Name

Type

Description

amountOutMin

uint256

Minimal amount of swap`s output token. If less tokens are received by swap transaction is reverted

path

address[]

Tokens` addresses to perform swap through. path[0] must be WETH address, otherwise transaction is reverted

to

address

Output token`s receiver address

deadline

uint256

Timestamp indicates when the swap becomes irrelevant

portfolios

address[]

Addresses of portfolios that should perform chain swaps (swap path[i] token on path[i+1] token through portfolios[i] portfolio)

destinationChainId

uint256

A destination chain identifier for cross-chain swaps. Must be 0 for local swaps.

Return values

Name

Type

Description

amounts

uint256[]

Amounts out of all the tokens during swap. amounts[i] of path[i+1] token is the input amount for path[i+1] -> path[i+2] swap. amounts[amounts.length - 1] is the output token amount out.

amounts.length == path.length - 1

swapTokensForExactETHWithPortfolios

Receive an exact amount of ETH for as few input tokens as possible, along the route determined by the path. The first element of the path is the input token, the last must be WETH (wrapped native token), and any intermediate elements represent intermediate pairs to trade through (if, for example, a direct pair does not exist).

Parameters

Name

Type

Description

amountOut

uint256

Amount of ETH received through swap

amountInMax

uint256

Maximal amount of swap`s input token. If more tokens are required by swap transaction is reverted

path

address[]

Tokens` addresses to perform swap through. path[path.length - 1] must be WETH address, otherwise transaction is reverted

to

address

ETH`s receiver address

deadline

uint256

Timestamp indicates when the swap becomes irrelevant

portfolios

address[]

Addresses of portfolios that should perform chain swaps (swap path[i] token on path[i+1] token through portfolios[i] portfolio)

destinationChainId

uint256

Must be 0.

Return values

Name

Type

Description

amounts

uint256[]

Amounts out of all the tokens during swap. amounts[i] of path[i+1] token is the input amount for path[i+1] -> path[i+2] swap. amounts[0] is the input token amount in.

amounts.length == path.length - 1

swapExactTokensForETHWithPortfolios

Swaps an exact amount of tokens for as much ETH as possible, along the route determined by the path. The first element of the path is the input token, the last must be WETH, and any intermediate elements represent intermediate pairs to trade through (if, for example, a direct pair does not exist). Properly works with fee-on-transfer tokens.

Parameters

Name

Type

Description

amountIn

uint256

Amount of swap`s input token

amountOutMin

uint256

Minimal amount of ETH received by swap. If less tokens are received by swap transaction is reverted

path

address[]

Tokens` addresses to perform swap through. path[path.length - 1] must be WETH address, otherwise transaction is reverted

to

address

ETH`s receiver address

deadline

uint256

Timestamp indicates when the swap becomes irrelevant

portfolios

address[]

Addresses of portfolios that should perform chain swaps (swap path[i] token on path[i+1] token through portfolios[i] portfolio)

destinationChainId

uint256

A destination chain identifier for cross-chain swaps. Must be 0 for local swaps.

Return values

Name

Type

Description

amounts

uint256[]

Amounts out of all the tokens during swap. amounts[i] of path[i+1] token is the input amount for path[i+1] -> path[i+2] swap. amounts[amounts.length - 1] is the ETH amount out.

amounts.length == path.length - 1

swapETHForExactTokensWithPortfolios

Receive an exact amount of tokens for as little ETH as possible, along the route determined by the path. The first element of the path must be WETH, the last is the output token and any intermediate elements represent intermediate pairs to trade through (if, for example, a direct pair does not exist). If the required amount of ETH for swap exceeds msg.value transaction is reverted.

Parameters

Name

Type

Description

amountOut

uint256

Amount of swap`s output token

path

address[]

Tokens` addresses to perform swap through. path[0] must be WETH address, otherwise transaction is reverted

to

address

Output token`s receiver address

deadline

uint256

Timestamp indicates when the swap becomes irrelevant

portfolios

address[]

Addresses of portfolios that should perform chain swaps (swap path[i] token on path[i+1] token through portfolios[i] portfolio)

destinationChainId

uint256

Must be 0.

Return values

Name

Type

Description

amounts

uint256[]

Amounts out of all the tokens during swap. amounts[i] of path[i+1] token is the input amount for path[i+1] -> path[i+2] swap. amounts[0] is the ETH amount in.

amounts.length == path.length - 1

getAmountsOutWithPortfolios

Returns swap`s output token`s amount out with given amount in and token`s path to swap through.

Parameters

Name

Type

Description

amountIn

uint256

Amount of swap`s input token

path

address[]

Tokens` addresses to perform swap through.

portfolios

address[]

Addresses of portfolios that should perform chain swaps (swap path[i] token on path[i+1] token through portfolios[i] portfolio)

destinationChainId

uint256

A destination chain identifier for cross-chain swaps. Must be 0 for local swaps.

Return values

Name

Type

Description

amounts

uint256[]

Amounts out of all the tokens during swap. amounts[i] of path[i+1] token is the input amount for path[i+1] -> path[i+2] swap. amounts[amounts.length - 1] is the output token amount out.

amounts.length == path.length - 1

fees

uint16[]

Amounts of fees withheld from all swaps.

fees.length == path.length - 1

getAmountsInWithPortfolios

Returns swap`s input token`s amount in with given amount out and token`s path to swap through.

Parameters

Name

Type

Description

amountOut

uint256

Amount of swap`s output token

path

address[]

Tokens` addresses to perform swap through.

portfolios

address[]

Addresses of portfolios that should perform chain swaps (swap path[i] token on path[i+1] token through portfolios[i] portfolio)

destinationChainId

uint256

Must be 0.

Return values

Name

Type

Description

amounts

uint256[]

Amounts out of all the tokens during swap. amounts[i] of path[i+1] token is the input amount for path[i+1] -> path[i+2] swap. amounts[0] is the input token amount in.

amounts.length == path.length - 1

fees

uint16[]

Amounts of fees withheld from all swaps.

fees.length == path.length - 1

addLiquidityToPortfolio

Performs deposit of tokens to specified portfolio.

Parameters

Name

Type

Description

tokens

address[]

Array of tokens` addresses to deposit

amountsIn

uint256[]

Amounts of tokens to deposit

minAmountOut

uint256

Minimal amount of LP tokens output. If less tokens are received during the deposit the transaction is reverted

to

address

Address of LP tokens receiver

deadline

uint256

Timestamp indicates when the deposit becomes irrelevant

portfolio

address

Address of the portfolio to deposit tokens to

destinationChainId

uint256

A destination chain identifier for cross-chain operations. Must be 0 for local operations.

Return values

Name

Type

Description

liquidity

uint256

Amount of LP tokens received after the deposit

removeLiquidityFromPortfolio (single token)

Performs single token`s withdrawal operation from specified portfolio.

Parameters

Name

Type

Description

token

address

Address of token to withdraw

liquidity

uint256

Amount of LP tokens to spend on withdrawal

minAmountOut

uint256

Minimal amount of token to receive during withdrawal. If less tokens are received the transaction is reverted

to

address

Address of token`s receiver

deadline

uint256

Timestamp indicates when the withdrawal becomes irrelevant

portfolio

address

Address of the portfolio to withdraw tokens from

destinationChainId

uint256

A destination chain identifier for cross-chain operations. Must be 0 for local operations.

Return values

Name

Type

Description

amountOut

uint256

Amount of token received after withdrawal

removeLiquidityFromPortfolio (multiple tokens)

Performs multiple tokens` withdrawal operation from specified portfolio.

Parameters

Name

Type

Description

tokens

address[]

Addresses of tokens to withdraw

LPTamounts

uint256[]

Amount of LP tokens to spend on withdrawal of each token

minAmountsOut

uint256[]

Minimal amount of tokens to receive during withdrawal. If less tokens are received the transaction is reverted

to

address

Address of tokens` receiver

deadline

uint256

Timestamp indicates when the withdrawal becomes irrelevant

portfolio

address

Address of the portfolio to withdraw tokens from

destinationChainId

uint256

A destination chain identifier for cross-chain operations. Must be 0 for local operations.

Return values

Name

Type

Description

amountsOut

uint256[]

Amount of tokens received after withdrawal

removeLiquidityFromPortfolio (last liquidity)

Withdraws last liquidity from portfolio in all the portfolio tokens left if liquidity is the all remaining supply of LP tokens.

Parameters

Name

Type

Description

liquidity

uint256

Amount of LP tokens to spend on withdrawal

to

address

Address of tokens` receiver

deadline

uint256

Timestamp indicates when the withdrawal becomes irrelevant

portfolio

address

Address of the portfolio to withdraw tokens from

Return values

Name

Type

Description

amountsOut

uint256[]

Amounts of tokens received after withdrawal

removeLiquidityWithPermitFromPortfolio (single token)

Performs single token`s withdrawal operation from specified portfolio, using permit instead of additional approval transaction.

Parameters

Name

Type

Description

token

address

Address of token to withdraw

minAmountOut

uint256

Minimal amount of token to receive during withdrawal. If less tokens are received the transaction is reverted

to

address

Address of token`s receiver

deadline

uint256

Timestamp indicates when the withdrawal becomes irrelevant

portfolio

address

Address of the portfolio to withdraw tokens from

permitStruct

struct

PS.PermitStruct

Permit struct with signature to be verified by LPT minter and transfer tokens without approval

Return values

Name

Type

Description

amountOut

uint256

Amount of token received after withdrawal

removeLiquidityWithPermitFromPortfolio (multiple tokens)

Performs multiple tokens` withdrawal operation from specified portfolio, using permit instead of additional approval transaction.

Parameters

Name

Type

Description

tokens

address[]

Addresses of tokens to withdraw

LPTamounts

uint256[]

Amount of LP tokens to spend on withdrawal of each token

minAmountsOut

uint256[]

Minimal amount of tokens to receive during withdrawal. If less tokens are received the transaction is reverted

to

address

Address of tokens` receiver

deadline

uint256

Timestamp indicates when the withdrawal becomes irrelevant

portfolio

address

Address of the portfolio to withdraw tokens from

permitStruct

struct

PS.PermitStruct

Permit struct with signature to be verified by LPT minter and transfer tokens without approval

Return values

Name

Type

Description

amountsOut

uint256[]

Amounts of tokens received after withdrawal

removeLiquidityWithPermitFromPortfolio (last liquidity)

Withdraws last liquidity from portfolio in all the portfolio tokens left if liquidity is the all remaining supply of LP tokens, using permit instead of additional approval transaction.

Parameters

Name

Type

Description

liquidity

uint256

Amount of LP tokens to spend on withdrawal

to

address

Address of tokens` receive

deadline

uint256

Timestamp indicates when the withdrawal becomes irrelevant

portfolio

address

Address of the portfolio to withdraw tokens from

permitStruct

struct

PS.PermitStruct

Permit struct with signature to be verified by LPT minter and transfer tokens without approval

Return values

Name

Type

Description

amountsOut

uint256[]

Amounts of tokens received after withdrawal

Last updated

Was this helpful?