NablaRouter
oracleAdapter
poolByAsset
swapExactTokensForTokens
Swap some _fromToken
tokens for _toToken
tokens, ensures _amountOutMin
and _deadline
, sends funds to _to
address msg.sender
needs to grant the router contract a sufficient allowance beforehand
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 |
_tokenInOut | address[] | Array of size two, indicating the in and out token |
_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 |
---|---|---|
amounts_ | uint256[] | Array of size two, containing the input and output amount |
getAmountOut
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 |
_tokenInOut | address[] | Array of size two, indicating the in and out token |
_tokenPrices | uint256[] | Array of size two, indicating the in and out token prices fetched off-chain |
Return Values
Name | Type | Description |
---|---|---|
amountOut_ | uint256 | Number of |
swapFee_ | uint256 | The fee that is charged for the swap (in |
Last updated