> For the complete documentation index, see [llms.txt](https://chainge-finance.gitbook.io/chainge-finance/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://chainge-finance.gitbook.io/chainge-finance/get-started/chainge-2.0-api-documentation/earn-feature-api.md).

# Earn feature API

Chainge Finance Earn is a feature rewarding users who deposit certain assets as liquidity.

Base url : <https://api2.chainge.finance>

## GET /v1/getRewardConfig

This API retrieves some basic configuration information for the EARN module, primarily including the APY (Annual Percentage Yield) for EARN on FSN, KOINOS and ROLLUX, as well as the reward distribution account addresses.

**Header**

| Fields | Description |
| ------ | ----------- |

**Query Params**

| Fields | Description |
| ------ | ----------- |

**Response**

| Fields                | Description                                                |
| --------------------- | ---------------------------------------------------------- |
| apys                  | List of APYs that support tokens                           |
| koin\_reward\_valut   | KOIN reward pool address                                   |
| rollux\_reward\_vault | ROLLUX reward pool address                                 |
| apys:                 |                                                            |
| token                 | Token Symbol                                               |
| apy                   | Annual Percentage Yield                                    |
| blocknumber           | Block Height                                               |
| startbn               | Starting Block Height                                      |
| chain                 | Target Chain Name                                          |
| extra                 | Reserved field on FSN. rate;rewardAmount on Koinos, Rollux |
| total\_income         | Total Injection Amount of the Reward Pool                  |
| total\_reward         | Total Rewards Claimed                                      |

## GET /v1/queryFSNReward

This API returns reward information for the current user's current token on fusion chain

\*The returned result needs to be processed using the appropriate token decimals

**Header**

| Fields | Description |
| ------ | ----------- |

**Query Params**

| Fields  | Description                      |
| ------- | -------------------------------- |
| token   | Required. Token contract address |
| address | Required. User address           |

**Response**

| Fields            | Description                                                                                            |
| ----------------- | ------------------------------------------------------------------------------------------------------ |
| balance           | Token balance, which is inaccurate because of the cache, is not recommended to use this field directly |
| claimable         | Number of rewards available to claim                                                                   |
| extraAmount       | Reserved field                                                                                         |
| totalCliamed      | Total amount of rewards claimed                                                                        |
| totalCliamedExtra | Reserved field                                                                                         |

## GET /v1/queryKoinReward

This API returns reward information for the current user's current token on koinos chain

\*The returned result needs to be processed using the appropriate token decimals

**Header**

| Fields | Description |
| ------ | ----------- |

**Query Params**

| Fields  | Description                      |
| ------- | -------------------------------- |
| token   | Required. Token contract address |
| address | Required. User address           |

**Response**

| Fields            | Description                                                                                            |
| ----------------- | ------------------------------------------------------------------------------------------------------ |
| balance           | Token balance, which is inaccurate because of the cache, is not recommended to use this field directly |
| claimable         | Number of rewards available to claim                                                                   |
| extraAmount       | Number of KOIN rewards available to claim                                                              |
| totalCliamed      | Total amount of rewards claimed                                                                        |
| totalCliamedExtra | Total amount of rewards claimed for koin                                                               |

<br>

## GET /v1/queryFSNRewardAll

This API returns reward information for the current user on fusion chain

\*The returned result needs to be processed using the appropriate token decimals

**Header**

| Fields | Description |
| ------ | ----------- |

**Query Params**

| Fields  | Description            |
| ------- | ---------------------- |
| address | Required. User address |

**Response**

| Fields            | Description                                                                                                                                                                                                                                                                                             |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \[symbol]         | <p>Supported token symbols. Example: </p><p>{</p><p>…</p><p>"BTC": {</p><p>            "balance": "0",</p><p>            "totalCliamed": "0",</p><p>            "totalCliamedExtra": "0",</p><p>            "claimable": "0",</p><p>            "extraAmount": "0"</p><p>        },</p><p>…</p><p>}</p> |
| \[symbol]         |                                                                                                                                                                                                                                                                                                         |
| balance           | Token balance, which is inaccurate because of the cache, is not recommended to use this field directly                                                                                                                                                                                                  |
| claimable         | Number of rewards available to claim                                                                                                                                                                                                                                                                    |
| extraAmount       | Number of KOIN rewards available to claim                                                                                                                                                                                                                                                               |
| totalCliamed      | Total amount of rewards claimed                                                                                                                                                                                                                                                                         |
| totalCliamedExtra | Reserved field                                                                                                                                                                                                                                                                                          |

<br>

## GET /v1/queryKoinRewardAll

This API returns reward information for the current user on koinos chain

\*The returned result needs to be processed using the appropriate token decimals

**Header**

| Fields | Description |
| ------ | ----------- |

**Query Params**

| Fields  | Description            |
| ------- | ---------------------- |
| address | Required. User address |

**Response**

| Fields            | Description                                                                                                                                                                                                                                                                                             |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \[symbol]         | <p>Supported token symbols. Example: </p><p>{</p><p>…</p><p>"BTC": {</p><p>            "balance": "0",</p><p>            "totalCliamed": "0",</p><p>            "totalCliamedExtra": "0",</p><p>            "claimable": "0",</p><p>            "extraAmount": "0"</p><p>        },</p><p>…</p><p>}</p> |
| \[symbol]         |                                                                                                                                                                                                                                                                                                         |
| balance           | Token balance, which is inaccurate because of the cache, is not recommended to use this field directly                                                                                                                                                                                                  |
| claimable         | Number of rewards available to claim                                                                                                                                                                                                                                                                    |
| extraAmount       | Number of KOIN rewards available to claim                                                                                                                                                                                                                                                               |
| totalCliamed      | Total amount of rewards claimed                                                                                                                                                                                                                                                                         |
| totalCliamedExtra | Total amount of rewards claimed for koin                                                                                                                                                                                                                                                                |

## GET /v1/queryRolluxRewardAll

This API returns reward information for the current user on Syscoin Rollux chain

\*The returned result needs to be processed using the appropriate token decimals

**Header**

| Fields | Description |
| ------ | ----------- |

**Query Params**

| Fields  | Description            |
| ------- | ---------------------- |
| address | Required. User address |

**Response**

| Fields            | Description                                                                                                                                                                                                                                                                                                 |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| \[symbol]         | <p>Supported token symbols. Example: </p><p>{</p><p>…</p><p>"BTC": {</p><p>            "balance": "0",</p><p>            "totalCliamed": "0",</p><p>            "totalCliamedExtra": "0,0",</p><p>            "claimable": "0",</p><p>            "extraAmount": "0,0"</p><p>        },</p><p>…</p><p>}</p> |
| \[symbol]         |                                                                                                                                                                                                                                                                                                             |
| balance           | Token balance, which is inaccurate because of the cache, is not recommended to use this field directly                                                                                                                                                                                                      |
| claimable         | Number of rewards available to claim                                                                                                                                                                                                                                                                        |
| extraAmount       | Number SYS,SUPR of rewards available to claim. This field describes the number of token types you can choose from, formatted as SYS,SUPR, separated by a comma (’,’). You can only select one to claim.                                                                                                     |
| totalCliamed      | Total amount of rewards claimed                                                                                                                                                                                                                                                                             |
| totalCliamedExtra | Total amount of rewards claimed. The format is SYS,SUPR, separated by a comma (’,’), and please ensure that the token type is the same as the one selected for extraAmount.                                                                                                                                 |

\*Note that when you call queryFSNReward or queryFSNRewardAll in FSN, queryRolluxRewardAll in Rollux, or queryKoinReward or queryKoinRewardAll in Koinos, rewards can only be claimed when the claimable amount in the results is greater than 0."

<br>

## Claim Reward

#### On Fusion：

On the Fusion chain, claiming rewards is done by invoking a contract. The contract address is: 0x0985d161a36730ef0315ead01ad3ad644c56d035, and the claim method is: claimRewards. The parameter for the claimRewards method is the contract address of the token to be claimed.

<br>

example: <https://github.com/codedfi/dappApiDemo/blob/main/src/earn/claimFsn.js>

<br>

On Koinos:

On the Koinos chain, claiming rewards is done by sending a transaction to the official address. The official address is: 19fmPgUGbTwXVUfP24wnYNsra7JDDNSHMC.

<br>

You need to send a transaction of 0 VHP to the official address and include a memo. The memo contains details about the claimable tokens. An example of the memo is: USDT\_10000:KOIN\_200000. The format is \[claimable symbol]\_\[claimable amount (BigInt)].

<br>

vhp address: 18tWNU7E4yuQzz7hMVpceb9ixmaWLVyQsr

<br>

When performing a claim on the KOIN chain, you need to pay attention to the following information:

1. When the main token(BTC, ETH, DAI on koinos) in the vault is NOT enough to claim, claiming is prohibited.
2. &#x20;When the partner token(KOIN) in the vault is NOT enough to claim, claiming is possible, but KOIN will be lost.<br>

example: <https://github.com/codedfi/dappApiDemo/blob/main/src/earn/claimKoin.js>

On Syscoin Rollux:

On the Syscoin Rollux chain, claiming rewards is done by sending a transaction to the official address. The official address is: 0x127e7766F65C7A35E73177AA104999A189048E9D.

You need to send a transaction of 0 SYS to the official address and include a memo. The memo contains details about the claimable tokens. An example of the memo is: USDT\_10000:SYS\_200000 or USDT\_10000:SUPR\_200000. The format is \[claimable symbol]\_\[claimable amount (BigInt)].<br>

When performing a claim on the Rollux chain, you need to pay attention to the following information:

1. When the main token(BTC, ETH, USDT, USDC on Rollux) in the vault is NOT enough to claim, claiming is prohibited.
2. &#x20;When the partner token(SYS or SUPR) in the vault is NOT enough to claim, claiming is possible, but SYS or SUPR will be lost.

example: <https://github.com/codedfi/dappApiDemo/blob/main/src/earn/claimRollux.js>\ <br>
