# Utils

이 컨트랙트는 KLAYswap 서비스의 자산 상세 정보와 교환추정치를 확인해 볼 수 있습니다       &#x20;

## Address

* Cypress : [0x7A74B3be679E194E1D6A0C29A343ef8D2a5AC876](https://scope.klaytn.com/account/0x7A74B3be679E194E1D6A0C29A343ef8D2a5AC876?tabId=contractCode)

{% tabs %}
{% tab title="Read-Only Functions" %}

## Read-Only Functions

**getPoolData**

```solidity
function getPoolData(address lp) public view returns (
        uint miningRate,
        uint rateDecimals,
        address tokenA,
        uint reserveA,
        address tokenB,
        uint reserveB,
        uint airdropCount,
        address[] memory airdropTokens,
        uint[] memory airdropSettings 
)
```

* LP가 보유한 TokenA의 수량
* 네트워크의 블럭이 startBlock 과 endBlock 사이에만 Airdrop 진행     &#x20;
* Parameters
  * `miningRate` : KSP 분배비율 분자값
  * `rateDecimals` : KSP 분배비율 분모값
    * 예) 하루 KSP 분배비율
      * miningRate - 130323276365080043, rateDecimals - 10000000000000000
      * 130323276365080043 / 10000000000000000 = 13.0323276365080043
  * `tokenA` : LP의 tokenA
  * `reserveA` : LP가 보유한 tokenA 수량
  * `tokenB` : LP의 tokenB
  * `reserveB` : LP가 보유한 tokenB 수량
  * `airdropCount` : LP에서 진행중인 airdrop 계획의 개수
  * `airdropTokens` : Airdrop 토큰 주소 배열
  * `airdropSettings` : Airdrop 정보 배열
    * \[0]: blockAmount, \[1]: startBlock, \[2]: endBlock
* `airdropSettings` 데이터 형식
  * 예) TokenA, TokenB 2개 Airdrop 진행 &#x20;
    * airdropTokens = \[ TokenA address, TokenB address]
    * airdropSettings = \[ TokenA blockAmount, TokenA startBlock, TokenA endBlock, TokenB blockAmount, TokenB startBlock, TokenB endBlock ]

**getPendingReward**

```solidity
function getPendingReward(address lp, address user) public view returns ( 
    uint kspReward, 
    uint airdropCount, 
    address[] memory airdropTokens, 
    uint[] memory airdropRewards 
)
```

* User의 수령 가능한 보상 정보
* Parameters
  * `kspReward` : 수령가능한 KSP 수량
  * `airdropCount` : LP에서 진행중인 airdrop 계획의 개수
  * `airdropTokens` : Airdrop 토큰 주소 배열
  * `airdropRewards` : 수령가능한 Airdrop 수량 정보 배열
* `airdrop` 데이터 형식
  * 예) TokenA, TokenB 2개 Airdrop 진행 &#x20;
    * airdropTokens = \[ TokenA address, TokenB address]
    * airdropSettings = \[ TokenA reward, TokenB reward ]

**estimateSwap**

```solidity
function estimateSwap(
    address tokenIn, 
    address tokenOut, 
    uint amountIn, 
    address[] memory path
) public view returns (uint amountOut)
```

* KLAYswap 교환추정치 조회 함수
* Input Parameters
  * `tokenIn` : 교환할 Token 주소
  * `tokenOut` : 수령할 Token 주소
  * `amountIn` : 교환할 Token 수량
  * `path` : 교환 경로
* 교환 조회&#x20;
  * KLAY -> KSP 예)
    * tokenIn = KLAY token address
    * tokenOut = KSP token address
    * amountIn = 1e18 ( = 1 KLAY )
    * path = \[]
  * KLAY -> ORC -> KSP 예)
    * tokenIn = KLAY token address
    * tokenOut = KSP token address
    * amountIn = 1e18 ( = 1 KLAY )
    * path = \["{ORC token Address}"]
      {% endtab %}
      {% endtabs %}


---

# 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.klayswap.com/kr/developer/contract/utils.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.
