NablaPortal

oracleAdapter

address oracleAdapter

assetsByRouter

mapping(address => mapping(address => bool)) assetsByRouter

routers

address[] routers

routerAssets

mapping(address => address[]) routerAssets

Events

EthForExactTokensSwapped

event EthForExactTokensSwapped(address sender, address to, address[] routerPath, address[] tokenPath, uint256[] swapAmounts)

ExactTokensForEthSwapped

event ExactTokensForEthSwapped(address sender, address to, address[] routerPath, address[] tokenPath, uint256[] swapAmounts)

ExactTokensForTokensSwapped

event ExactTokensForTokensSwapped(address sender, address to, address[] routerPath, address[] tokenPath, uint256[] swapAmounts)

Functions

swapEthForExactTokens

function swapEthForExactTokens(uint256 _amountIn, uint256 _amountOutMin, address[] _tokenPath, address[] _routerPath, address _to, uint256 _deadline, bytes[] _priceUpdateData) external payable returns (uint256 amountOut_)

Swap ETH for tokens using the NablaRouter

By calling this function the price feed gets be updated (IPriceOracleAdapter.updatePriceFeeds)

Parameters

Name
Type
Description

_amountIn

uint256

The amount of input ETH to swap

_amountOutMin

uint256

The minimum amount of output token that the user will accept

_tokenPath

address[]

Array of tokens to swap along the route (first token must be WETH)

_routerPath

address[]

Array of routers to use

_to

address

The recipient of the output tokens

_deadline

uint256

Unix timestamp after which the transaction will revert

_priceUpdateData

bytes[]

Array of price update data

Return Values

Name
Type
Description

amountOut_

uint256

Output amount of tokens

swapExactTokensForEth

function swapExactTokensForEth(uint256 _amountIn, uint256 _amountOutMin, address[] _tokenPath, address[] _routerPath, address _to, uint256 _deadline, bytes[] _priceUpdateData) external payable returns (uint256 amountOut_)

Swap tokens using the NablaRouter and receive ETH

By calling this function the price feed gets be updated (IPriceOracleAdapter.updatePriceFeeds)

Parameters

Name
Type
Description

_amountIn

uint256

The amount of input tokens to swap

_amountOutMin

uint256

The minimum amount of ETH that the user will accept

_tokenPath

address[]

Array of tokens to swap along the route (last token must be WETH)

_routerPath

address[]

Array of routers to use

_to

address

The recipient of ETH

_deadline

uint256

Unix timestamp after which the transaction will revert

_priceUpdateData

bytes[]

Array of price update data

Return Values

Name
Type
Description

amountOut_

uint256

Output amount of ETH

swapExactTokensForTokens

function swapExactTokensForTokens(uint256 _amountIn, uint256 _amountOutMin, address[] _tokenPath, address[] _routerPath, address _to, uint256 _deadline, bytes[] _priceUpdateData) external payable returns (uint256 amountOut_)

Swap tokens using the NablaRouter

By calling this function the price feed gets be updated (IPriceOracleAdapter.updatePriceFeeds)

Parameters

Name
Type
Description

_amountIn

uint256

The amount of input tokens to swap

_amountOutMin

uint256

The minimum amount of output token that the user will accept

_tokenPath

address[]

Array of tokens to swap along the route

_routerPath

address[]

Array of routers to use

_to

address

The recipient of the output tokens

_deadline

uint256

Unix timestamp after which the transaction will revert

_priceUpdateData

bytes[]

Array of price update data

Return Values

Name
Type
Description

amountOut_

uint256

Output amount of tokens

quoteSwapExactTokensForTokens

function quoteSwapExactTokensForTokens(uint256 _amountIn, address[] _tokenPath, address[] _routerPath, uint256[] _tokenPrices) external view returns (uint256 amountOut_)

Get a quote for how many _toToken tokens _amountIn many tokenIn tokens can currently be swapped for.

Parameters

Name
Type
Description

_amountIn

uint256

The amount of input tokens to swap

_tokenPath

address[]

Array of tokens to swap along the route

_routerPath

address[]

Array of routers to use

_tokenPrices

uint256[]

Array of token prices fetched off-chain

Return Values

Name
Type
Description

amountOut_

uint256

Number of _toToken tokens that such a swap would yield right now

getRouters

function getRouters() external view returns (address[] routers_)

Retrieves the list of routers.

Return Values

Name
Type
Description

routers_

address[]

An array of addresses representing the routers.

getRouterAssets

function getRouterAssets(address _router) external view returns (address[] routerAssets_)

Retrieves the list of assets associated with a specific router.

Parameters

Name
Type
Description

_router

address

The address of the router for which to retrieve the assets.

Return Values

Name
Type
Description

routerAssets_

address[]

An array of addresses representing the assets associated with the specified router.

Last updated