# AlgebraEternalFarming

Algebra eternal (v2-like) farming

## Variables

### mapping(uint256 => mapping(bytes32 => struct AlgebraEternalFarming.Farm)) farms

Returns information about a farmd liquidity NFT

*Developer note: farms\[tokenId]\[incentiveHash] => Farm*

## Functions

### constructor

`constructor(contract IAlgebraPoolDeployer _deployer, contract INonfungiblePositionManager _nonfungiblePositionManager) public` public

| Name                         | Type                                 | Description                               |
| ---------------------------- | ------------------------------------ | ----------------------------------------- |
| \_deployer                   | contract IAlgebraPoolDeployer        | pool deployer contract address            |
| \_nonfungiblePositionManager | contract INonfungiblePositionManager | the NFT position manager contract address |

### createEternalFarming

`function createEternalFarming(struct IIncentiveKey.IncentiveKey key, struct IAlgebraEternalFarming.IncentiveParams params, struct IAlgebraFarming.Tiers tiers) external returns (address virtualPool)` external

Creates a new liquidity mining incentive program

| Name   | Type                                          | Description                                           |
| ------ | --------------------------------------------- | ----------------------------------------------------- |
| key    | struct IIncentiveKey.IncentiveKey             | Details of the incentive to create                    |
| params | struct IAlgebraEternalFarming.IncentiveParams | Params of incentive                                   |
| tiers  | struct IAlgebraFarming.Tiers                  | The amounts of locked token for liquidity multipliers |

**Returns:**

| Name        | Type    | Description      |
| ----------- | ------- | ---------------- |
| virtualPool | address | The virtual pool |

### deactivateIncentive

`function deactivateIncentive(struct IIncentiveKey.IncentiveKey key) external` external

Detach incentive from the pool and deactivate it

| Name | Type                              | Description              |
| ---- | --------------------------------- | ------------------------ |
| key  | struct IIncentiveKey.IncentiveKey | The key of the incentive |

### decreaseRewardsAmount

`function decreaseRewardsAmount(struct IIncentiveKey.IncentiveKey key, uint256 rewardAmount, uint256 bonusRewardAmount) external` external

| Name              | Type                              | Description |
| ----------------- | --------------------------------- | ----------- |
| key               | struct IIncentiveKey.IncentiveKey |             |
| rewardAmount      | uint256                           |             |
| bonusRewardAmount | uint256                           |             |

### addRewards

`function addRewards(struct IIncentiveKey.IncentiveKey key, uint256 rewardAmount, uint256 bonusRewardAmount) external` external

| Name              | Type                              | Description |
| ----------------- | --------------------------------- | ----------- |
| key               | struct IIncentiveKey.IncentiveKey |             |
| rewardAmount      | uint256                           |             |
| bonusRewardAmount | uint256                           |             |

### setRates

`function setRates(struct IIncentiveKey.IncentiveKey key, uint128 rewardRate, uint128 bonusRewardRate) external` external

| Name            | Type                              | Description |
| --------------- | --------------------------------- | ----------- |
| key             | struct IIncentiveKey.IncentiveKey |             |
| rewardRate      | uint128                           |             |
| bonusRewardRate | uint128                           |             |

### enterFarming

`function enterFarming(struct IIncentiveKey.IncentiveKey key, uint256 tokenId, uint256 tokensLocked) external` external

enter farming for Algebra LP token

| Name         | Type                              | Description                                                |
| ------------ | --------------------------------- | ---------------------------------------------------------- |
| key          | struct IIncentiveKey.IncentiveKey | The key of the incentive for which to enterFarming the NFT |
| tokenId      | uint256                           | The ID of the token to exitFarming                         |
| tokensLocked | uint256                           | The amount of tokens locked for boost                      |

### exitFarming

`function exitFarming(struct IIncentiveKey.IncentiveKey key, uint256 tokenId, address _owner) external` external

exitFarmings for Algebra LP token

| Name    | Type                              | Description                                               |
| ------- | --------------------------------- | --------------------------------------------------------- |
| key     | struct IIncentiveKey.IncentiveKey | The key of the incentive for which to exitFarming the NFT |
| tokenId | uint256                           | The ID of the token to exitFarming                        |
| \_owner | address                           | Owner of the token                                        |

### getRewardInfo

`function getRewardInfo(struct IIncentiveKey.IncentiveKey key, uint256 tokenId) external view returns (uint256 reward, uint256 bonusReward)` view external

reward amounts can be outdated, actual amounts could be obtained via static call of \`collectRewards\` in FarmingCenter

| Name    | Type                              | Description              |
| ------- | --------------------------------- | ------------------------ |
| key     | struct IIncentiveKey.IncentiveKey | The key of the incentive |
| tokenId | uint256                           | The ID of the token      |

**Returns:**

| Name        | Type    | Description                                                          |
| ----------- | ------- | -------------------------------------------------------------------- |
| reward      | uint256 | The reward accrued to the NFT for the given incentive thus far       |
| bonusReward | uint256 | The bonus reward accrued to the NFT for the given incentive thus far |

### collectRewards

`function collectRewards(struct IIncentiveKey.IncentiveKey key, uint256 tokenId, address _owner) external returns (uint256 reward, uint256 bonusReward)` external

reward amounts should be updated before calling this method

| Name    | Type                              | Description |
| ------- | --------------------------------- | ----------- |
| key     | struct IIncentiveKey.IncentiveKey |             |
| tokenId | uint256                           |             |
| \_owner | address                           |             |

**Returns:**

| Name        | Type    | Description |
| ----------- | ------- | ----------- |
| reward      | uint256 |             |
| bonusReward | uint256 |             |


---

# 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.algebra.finance/algebra-integral-documentation/algebra-v1-technical-reference/contracts/api-reference-v1.9/v1.9-tokenomics/algebraeternalfarming.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.
