> For the complete documentation index, see [llms.txt](https://docs.liqd.ag/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.liqd.ag/liquidcore-integration/api-reference.md).

# Contract Reference

Solidity interfaces for the LiquidCore Router and pool contracts.

Use the **Router** for execution. Direct pool calls are optional when you already know the pool address.

## Router

**LiquidCore Router:** `0x625aC1D165c776121A52ff158e76e3544B4a0b8B`

### Discovery functions

```solidity
function getPools() external pure returns (address[] memory pools)
function getPoolForPair(address tokenA, address tokenB) public view returns (address)
```

### Execution functions

```solidity
function swap(
    address tokenIn,
    address tokenOut,
    uint256 amountIn,
    uint256 minAmountOut
) external returns (uint256 amountOut)
```

```solidity
function swap(
    address tokenIn,
    address tokenOut,
    uint256 amountIn,
    uint256 minAmountOut,
    bytes32 refCode
) external returns (uint256 amountOut)
```

`refCode` is checked against an on-chain allowlist (`RefCodeRegistry`). Invalid codes do not accrue referral allocation and do not block the swap.

### Quote functions

```solidity
function estimateSwap(
    address tokenIn,
    address tokenOut,
    uint256 amountIn
) external view returns (uint256 amountOut)

function estimateSwapBatch(
    address tokenIn,
    address tokenOut,
    uint256[] calldata amountsIn
) external view returns (uint256[] memory amountsOut)

function getReserves(address tokenA, address tokenB)
    external view returns (uint256 reserve0, uint256 reserve1)
```

`estimateSwapBatch` is used by the [REST API quote endpoint](/liquidcore-integration/api-endpoints.md#get-quote) for CSV `amountIn` inputs. `getReserves` reverts with `NoPoolForPair` if no pool exists.

### Referral functions

```solidity
function getRefClaimable(address tokenA, address tokenB, bytes32 refCode)
    external view returns (uint256 amount0, uint256 amount1)

function claimRefFees(address tokenA, address tokenB, bytes32 refCode)
    external returns (uint256 amount0, uint256 amount1)

function distributeRefFees() external
```

See [Referrals](/liquidcore-integration/referrals.md) for usage details.

### Router errors

```solidity
error NoPoolForPair();
error TransferFailed();
```

***

## Direct pool interface

Pool addresses:

* `0xA7478A5ff7cB27A8008D6D90785db10223bc6087` (USDT0/WHYPE)
* `0xD3994A6CF46cA91536376f89aCDadf92eD289a9F` (USDC/WHYPE)
* `0x305e5B1a81879Aa0538338306Cb9430A547E1eEa` (USDH/WHYPE)
* `0x56A0f8434dD68F07ACfED07D7d0bB3aD6FE8D677` (USDC/UBTC)
* `0x8d7928faFfC2DdDc2af41BD56236b32bB21BE3B5` (USDC/UETH)
* `0xe050C5033dCC344491128dF2609ECC43875DDd9d` (USDC/USOL)
* `0x5600345C1f6232a385d6e24272fd3099641Bace4` (WHYPE/UBTC)
* `0xf89CdC6C271CCdC10Add92C2D6EA26Cbc266fDd5` (WHYPE/kHYPE)
* `0x158F5919A3C65C201A02CB2fEE7421F7B78F3b1e` (USDC/kHYPE)
* `0x43Bad06C9ad4D0ABffdFf5aaCc534A7644F7872C` (WHYPE/UETH)

```solidity
function getTokens() external view returns (address token0, address token1)
function getReserves() external view returns (uint256 reserve0, uint256 reserve1)
function swap(address tokenIn, address tokenOut, uint256 amountIn, uint256 minAmountOut) external returns (uint256 amountOut)
function swap(address tokenIn, address tokenOut, uint256 amountIn, uint256 minAmountOut, bytes32 refCode) external returns (uint256 amountOut)
function estimateSwap(address tokenIn, address tokenOut, uint256 amountIn) external view returns (uint256 amountOut)
function estimateSwapBatch(address tokenIn, address tokenOut, uint256[] calldata amountsIn) external view returns (uint256[] memory amountsOut)
function getRefClaimable(bytes32 refCode) external view returns (uint256 amount0, uint256 amount1)
function claimRefFees(bytes32 refCode) external returns (uint256 amount0, uint256 amount1)
```

### Common direct-pool errors

```solidity
error InvalidToken();
error ZeroAmount();
error SlippageExceeded();
error InsufficientReserve();
error TransferFailed();
error InvalidRefCode();
error UnauthorizedRefCodeClaim();
error RefCodeClaimLocked();
```

Referral usage details are documented in [Referrals](/liquidcore-integration/referrals.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.liqd.ag/liquidcore-integration/api-reference.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
