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
_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
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
_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
amountOut_
uint256
Number of _toToken
tokens that such a swap would yield right now
swapFee_
uint256
The fee that is charged for the swap (in _toToken
tokens)
Last updated