# NablaRouter

### oracleAdapter

```solidity
contract IPriceOracleGetter oracleAdapter
```

***

### poolByAsset

```solidity
mapping(address => contract ISwapPoolPermissioned) poolByAsset
```

***

### swapExactTokensForTokens

```solidity
function swapExactTokensForTokens(
    uint256 _amountIn, 
    uint256 _amountOutMin, 
    address[] _tokenInOut, 
    address _to, 
    uint256 _deadline, 
    bytes[] _priceUpdateData
) external payable returns (uint256[] amounts_)
```

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\[] | <p>Array of size two, containing </p><p>the input and output amount</p> |

***

### getAmountOut

```solidity
function getAmountOut(
    uint256 _amountIn, 
    address[] _tokenInOut, 
    uint256[] _tokenPrices
) external view returns (uint256 amountOut_, uint256 swapFee_)
```

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 `_toToken` tokens that such a swap would yield right now |
| swapFee\_   | uint256 | The fee that is charged for the swap (in `_toToken` tokens)        |
