# Mining

#### Supply Mining APY

\[AM(utilization\_rate) \* mining\_speed \* larix\_price] / total\_supply\_value

```rust
let lend_side_mine_ratio = Mining::get_lend_side_ratio(util_rate, bonus.kink_util_rate)?;   
let lend_side_mine_coeff_diff = mine_speed
.try_mul(lend_side_mine_ratio)?
.try_mul(slots_elapsed)?
.try_div(total_l_token_amount)?;
```

#### Borrow Mining APY

\[(1 - AM(utilization\_rate)) \* mining\_speed \* larix\_price] / total\_borrow\_value

```rust
let borrow_side_mine_amount = bonus.borrow_mining_index
.try_sub(mining.borrow_mining_indices[pos])?
.try_mul(user_borrow_amount)?
.try_div(global_borrow_interest_index)?;
```

**AM**

```rust
if self.collateral.mint_total_supply == 0 as u64 {
            return Ok((Rate::zero(),Rate::zero()));
        }
        if self.liquidity.borrowed_amount_wads.lt(&Decimal::one()){
            return Ok((Rate::one(),Rate::zero()));
        }
        
        let utilization_rate = self.liquidity.utilization_rate()?;
        let kink_rate =  Rate::try_from(
                            Decimal::from(self.bonus.kink_util_rate).try_div(Decimal::from(10000 as u64))?
                                )?;
        if  utilization_rate < kink_rate {
            let normalized_rate = utilization_rate.try_div(kink_rate)?;
            let min_rate = Rate::from_percent(0);
            let rate_range = Rate::from_percent(50);
            let mining_rate = normalized_rate.try_mul(rate_range)?.try_add(min_rate)?;
        
            Ok((mining_rate,Rate::one().try_sub(mining_rate)?))
        } else {
            let normalized_rate = utilization_rate
                .try_sub(kink_rate)?
                .try_div(Rate::from_percent(100u8).try_sub(kink_rate)?)?;
            let min_rate = Rate::from_percent(50);
            let rate_range = Rate::from_percent(100u8).try_sub(min_rate)?;
            let mining_rate = normalized_rate.try_mul(rate_range)?.try_add(min_rate)?;
            Ok((mining_rate,Rate::one().try_sub(mining_rate)?))
        }
```


---

# 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.projectlarix.com/strategies/mining-reward-model.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.
