# Utils

This contract can check asset details and swap estimates of KLAYswap service

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

* Amount of TokenA held by LP
* Airdrop only between startBlock and endBlock of blocks in the network
* Parameters
  * `miningRate` : KSP distribution ratio numerator value
  * `rateDecimals` : KSP distribution ratio denominator
    * 예) Daily KSP distribution ratio
      * miningRate - 130323276365080043, rateDecimals - 10000000000000000
      * 130323276365080043 / 10000000000000000 = 13.03...%
  * `tokenA` : LP tokenA
  * `reserveA` : Amount of tokenA held by LP
  * `tokenB` : LP tokenB
  * `reserveB` : Amount of tokenB held by LP
  * `airdropCount` : Number of airdrop plans in progress at LP
  * `airdropTokens` : Airdrop token address array
  * `airdropSettings` : Airdrop info array
    * \[0]: blockAmount, \[1]: startBlock, \[2]: endBlock
* `airdropSettings` Data format
  * 예) TokenA, TokenB 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's claimable reward information
* Parameters
  * `kspReward` : Claimable KSP
  * `airdropCount` : Number of airdrop plans the LP has
  * `airdropTokens` : Airdrop token address array
  * `airdropRewards` : Arrangement of Airdrop token amount Information claimable
* `airdrop` data format
  * 예) TokenA, TokenB 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 swap estimate lookup function
* Input Parameters
  * `tokenIn` : Token address to be exchanged
  * `tokenOut` : Token address to receive
  * `amountIn` : Token amount to be exchanged
  * `path` : exchange route
* example
  * 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-new.klayswap.com/book-en/developers/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.
