# UniswapV2Library

## Overview

#### License: MIT

```solidity
library UniswapV2Library
```

## Functions info

### sortTokens

```solidity
function sortTokens(
    address tokenA,
    address tokenB
) internal pure returns (address token0, address token1)
```

### pairFor

```solidity
function pairFor(
    address factory,
    address tokenA,
    address tokenB
) internal pure returns (address pair)
```

### getReserves

```solidity
function getReserves(
    address factory,
    address tokenA,
    address tokenB
) internal view returns (uint256 reserveA, uint256 reserveB)
```

### quote

```solidity
function quote(
    uint256 amountA,
    uint256 reserveA,
    uint256 reserveB
) internal pure returns (uint256 amountB)
```

### getAmountOut

```solidity
function getAmountOut(
    uint256 amountIn,
    uint256 reserveIn,
    uint256 reserveOut
) internal pure returns (uint256 amountOut)
```

### getAmountIn

```solidity
function getAmountIn(
    uint256 amountOut,
    uint256 reserveIn,
    uint256 reserveOut
) internal pure returns (uint256 amountIn)
```

### getAmountsOut

```solidity
function getAmountsOut(
    address factory,
    uint256 amountIn,
    address[] memory path
) internal view returns (uint256[] memory amounts)
```

### getAmountsIn

```solidity
function getAmountsIn(
    address factory,
    uint256 amountOut,
    address[] memory path
) internal view returns (uint256[] memory amounts)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fringe.fi/v2-smart-contract-documentation/priceoracle/priceproviders/uniswapv2/uniswapv2library.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
