# Liquidity Mining

### How to calculate staking annual yield?

For example, in USX/DF staking pool,

1. Get the price in USD of all assets, in this case, that would be USX and DF, assumption that the price is `pUSX` and `pDF`;
2. Get total balance of USX and DF deposited in the LP contract, say `tbUSX` and `tbDF`;
3. Calculate 1 LP token value should be:

   `vLP = (pUSX * tbUSX + pDF * tbDF) / LP.totalSupply;`
4. Get total balance deposited in staking contract, say `tbLP`, then the total value of deposited LP tokens should be:

   `tvLP = vLP * tbLP;`
5. Get reward rate from staking contract, this variable represents the distributed amount of reward token per block, in Ethereum Mainnet, the block period is \~13 seconds (for BSC, it's about 3 seconds per block), so distribution value per year is:

   `tvR = pDF * RR(RewardRate) * blockPerYear;`

   `blockPerYear = 3600 * 24 * 365 / block_peroid;`
6. The annual yield should be:

   `annual_yield = tvR / tvLP * 100%;`

### Deployed Contracts

{% tabs %}
{% tab title="Mainnet" %}

| Name                 | Address                                                                                                               |
| -------------------- | --------------------------------------------------------------------------------------------------------------------- |
| **Reward Treasury**  | [0x1D22AFC7dc4Bf336532dd6248d453C647CecA1B3](https://etherscan.io/address/0x1D22AFC7dc4Bf336532dd6248d453C647CecA1B3) |
| **UNISWAP** - ETH/DF | [0xFe599129B3018eE3231334d02E0b869a19dB3F8b](https://etherscan.io/address/0xFe599129B3018eE3231334d02E0b869a19dB3F8b) |
| {% endtab %}         |                                                                                                                       |

{% tab title="BSC" %}

| Name                  | Address                                                                                                              |
| --------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Reward Treasury**   | [0x959715da68DC2D1329F4bb34e13Da03FE10c374b](https://bscscan.com/address/0x959715da68DC2D1329F4bb34e13Da03FE10c374b) |
| **DODOEX** - USX/BUSD | [0x8d61b71958dD9Df6eAA670c0476CcE7e25e98707](https://bscscan.com/address/0x8d61b71958dD9Df6eAA670c0476CcE7e25e98707) |
| {% endtab %}          |                                                                                                                      |

{% tab title="Arbitrum" %}

| Name                  | Address                                                                                                              |
| --------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **Reward Treasury**   | [0xc0Dc7C5057141C9065bd9bedf79fd4E9EA69a739](https://arbiscan.io/address/0xc0Dc7C5057141C9065bd9bedf79fd4E9EA69a739) |
| **DODOEX** - USX/USDC | [0xAa6E14e99E3b7B71ca163AA82384Ed68F9067Dd7](https://arbiscan.io/address/0xAa6E14e99E3b7B71ca163AA82384Ed68F9067Dd7) |
| **DODOEX** - USX/EUX  | [0xd0BaA984Cd2D25A555710B4f199e873Af668866a](https://arbiscan.io/address/0xd0BaA984Cd2D25A555710B4f199e873Af668866a) |
| Curve - USX/2CRV      | [0xcdc46a2393706b33ee22a1b8316b8348312212b2](https://arbiscan.io/address/0xcdc46a2393706b33ee22a1b8316b8348312212b2) |

{% endtab %}

{% tab title="Optimism" %}

<table><thead><tr><th>Name</th><th>Address</th><th data-hidden></th></tr></thead><tbody><tr><td><strong>Reward Treasury</strong></td><td><a href="https://optimistic.etherscan.io/address/0x7B598182875Df02236eEa8a3e264f9376511D5ad">0x7B598182875Df02236eEa8a3e264f9376511D5ad</a></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="Polygon" %}

<table><thead><tr><th>Name</th><th>Address</th><th data-hidden></th></tr></thead><tbody><tr><td><strong>Reward Treasury</strong></td><td><a href="https://polygonscan.com/address/0x958b0166B9De547a1998cc06A55c4fa5B4304d0d">0x958b0166B9De547a1998cc06A55c4fa5B4304d0d</a></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
{% endtab %}
{% endtabs %}

### Reward Distributor

#### Function getAllRecipients()

Returns all activated staking contracts.

```
  function getAllRecipients()
    public
    view
    returns (address[] memory _allRecipients)
```

### Staking Pool

Every staking pool shares the same interface for users depositing/withdraw LP tokens and claim their rewards.

#### Variables

| Name                | Descriptions                                                                                                     |
| ------------------- | ---------------------------------------------------------------------------------------------------------------- |
| address rewardToken | reward token address.                                                                                            |
| uint256 rewardRate  | amount of reward token will be distributed per block.                                                            |
| uint256 startTime   | <p>timestamp for starting to distribute reward,</p><p>who deposits before this time will not get any reward.</p> |

#### function rewardDistributed()

Returns the total distributed amount since start time.

```
function rewardDistributed() public view returns (uint256);
```

#### function earned()

Returns the up-to-date amount of reward to be claimed.

```
function earned(address _account) public view returns (uint256);
```

#### function stake()

Deposit LP token into staking pool.

```
function stake(uint256 _amount) public;
```

#### function withdraw()

Withdraw LP token from staking pool.

```
function withdraw(uint256 _amount) public;
```

#### function getReward()

Claim rewards.

```
function getReward() public;
```

#### function exit()

Withdraw all LP tokens and claim rewards.

```
function exit() external;
```


---

# 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://developers.dforce.network/liquidity-markets/liquidity-mining.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.
