> For the complete documentation index, see [llms.txt](https://pangeaswap.gitbook.io/pangeaswap/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://pangeaswap.gitbook.io/pangeaswap/developers/interacting-with-the-protocol/undefined-6.md).

# 판게아 풀에서 스왑하기

라우터를 통해 판게아의 풀에서 스왑하는 3가지 케이스는 다음과 같습니다.

### 1. ERC20 --> ERC20&#x20;

* 스왑 요청 전에 입력 토큰에 대해 라우터로 승인요청(approve)을 수행해야 합니다.

```typescript
poolRouter.exactInputSingle({
          tokenIn: tokenInAddress, // 스왑 시 입력 토큰의 주소
          amountIn: BigNumber.from(amountIn), // 스왑할 입력 토큰의 갯수
          amountOutMinimum: BigNumber.from(amountOutMinimum), // 슬리피지
          pool: PoolAddress, // 스왑할 풀의 주소
          to: recipient,     // 받을 계정
          unwrap: false      // erc20의 토큰을 받는 경우 항상 false로 고정
        });
```

### 2. ERC20 --> KLAY

* 스왑 요청 전에 입력 토큰에 대해 라우터로 승인요청(approve)을 수행해야 합니다.

```typescript
poolRouter.exactInputSingle({
          tokenIn: tokenInAddress, // 스왑 시 입력 토큰의 주소
          amountIn: BigNumber.from(amountIn), // 스왑할 입력 토큰의 갯수
          amountOutMinimum: BigNumber.from(amountOutMinimum), // 슬리피지
          pool: PoolAddress, // 스왑할 풀의 주소
          to: recipient,     // 받을 계정
          unwrap: true       
        });
```

### 3. KLAY --> ERC20

```typescript
poolRouter.exactInputSingle({
          // klay를 통해 스왑할 경우, 주소를 0 주소로 둡니다.
          tokenIn: "0x0000000000000000000000000000000000000000", 
          amountIn: BigNumber.from(amountIn),
          amountOutMinimum: BigNumber.from(amountOutMinimum),
          pool: PoolAddress,
          to: recipient,
          unwrap: false
        }, {
           // 보낼 클레이는 아래와 같이 담아서 보내야 합니다.
           value: BigNumber.from(amountIn)
        });
```


---

# 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://pangeaswap.gitbook.io/pangeaswap/developers/interacting-with-the-protocol/undefined-6.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.
