# StableSwapRouter

## Solidity API

### StableSwapRouter

#### stableSwapFactory

```solidity
address stableSwapFactory
```

#### stableSwapInfo

```solidity
address stableSwapInfo
```

#### SetStableSwap

```solidity
event SetStableSwap(address factory, address info)
```

#### constructor

```solidity
constructor(address _stableSwapFactory, address _stableSwapInfo) internal
```

#### setStableSwap

```solidity
function setStableSwap(address _factory, address _info) external
```

Set Pancake Stable Swap Factory and Info

*Only callable by contract owner*

#### exactInputStableSwap

```solidity
function exactInputStableSwap(address[] path, uint256[] flag, uint256 amountIn, uint256 amountOutMin, address to) external payable returns (uint256 amountOut)
```

**Parameters**

| Name         | Type       | Description                                                  |
| ------------ | ---------- | ------------------------------------------------------------ |
| path         | address\[] |                                                              |
| flag         | uint256\[] | token amount in a stable swap pool. 2 for 2pool, 3 for 3pool |
| amountIn     | uint256    |                                                              |
| amountOutMin | uint256    |                                                              |
| to           | address    |                                                              |

#### exactOutputStableSwap

```solidity
function exactOutputStableSwap(address[] path, uint256[] flag, uint256 amountOut, uint256 amountInMax, address to) external payable returns (uint256 amountIn)
```

**Parameters**

| Name        | Type       | Description                                                  |
| ----------- | ---------- | ------------------------------------------------------------ |
| path        | address\[] |                                                              |
| flag        | uint256\[] | token amount in a stable swap pool. 2 for 2pool, 3 for 3pool |
| amountOut   | uint256    |                                                              |
| amountInMax | uint256    |                                                              |
| to          | address    |                                                              |


---

# 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.payswap.org/zhong-guo-ren/developers/smart-contracts/payswap-exchange/v3-contracts/smartrouterv3/stableswaprouter.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.
