# JoeLibrary

[Git Source](https://github.com/traderjoe-xyz/joe-v2/blob/16f011d25e6bf6d0a0c479974345b623d491104f/src/libraries/JoeLibrary.sol)

**Author:**\
Trader Joe

Helper contract used for Joe V1 related calculations

## Functions

### sortTokens

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

### 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);
```

## Errors

### JoeLibrary\_\_AddressZero

```solidity
error JoeLibrary__AddressZero();
```

### JoeLibrary\_\_IdenticalAddresses

```solidity
error JoeLibrary__IdenticalAddresses();
```

### JoeLibrary\_\_InsufficientAmount

```solidity
error JoeLibrary__InsufficientAmount();
```

### JoeLibrary\_\_InsufficientLiquidity

```solidity
error JoeLibrary__InsufficientLiquidity();
```


---

# 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://developers.lfj.gg/contracts/libraries/joelibrary.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.
