# AlgebraIncentiveFarming

Algebra incentive (time-limited) farming

## Variables

### uint256 maxIncentiveStartLeadTime immutable

The max amount of seconds into the future the incentive startTime can be set

### uint256 maxIncentiveDuration immutable

The max duration of an incentive in seconds

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

Returns information about a farmd liquidity NFT

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

## Functions

### constructor

AlgebraFarming

`constructor(contract IAlgebraPoolDeployer,contract INonfungiblePositionManager,uint256,uint256)` public

| Name                         | Type                                 | Description                                                                  |
| ---------------------------- | ------------------------------------ | ---------------------------------------------------------------------------- |
| \_deployer                   | contract IAlgebraPoolDeployer        | pool deployer contract address                                               |
| \_nonfungiblePositionManager | contract INonfungiblePositionManager | the NFT position manager contract address                                    |
| \_maxIncentiveStartLeadTime  | uint256                              | the max duration of an incentive in seconds                                  |
| \_maxIncentiveDuration       | uint256                              | the max amount of seconds into the future the incentive startTime can be set |

### createIncentive

onlyIncentiveMaker

`createIncentive(struct IIncentiveKey.IncentiveKey,struct IAlgebraFarming.Tiers,struct IAlgebraIncentiveFarming.IncentiveParams)` external

| Name   | Type                                            | Description |
| ------ | ----------------------------------------------- | ----------- |
| key    | struct IIncentiveKey.IncentiveKey               |             |
| tiers  | struct IAlgebraFarming.Tiers                    |             |
| params | struct IAlgebraIncentiveFarming.IncentiveParams |             |

**Returns:**

| Name        | Type    | Description |
| ----------- | ------- | ----------- |
| virtualPool | address |             |

### addRewards

onlyIncentiveMaker

`addRewards(struct IIncentiveKey.IncentiveKey,uint256,uint256)` external

| Name        | Type                              | Description |
| ----------- | --------------------------------- | ----------- |
| key         | struct IIncentiveKey.IncentiveKey |             |
| reward      | uint256                           |             |
| bonusReward | uint256                           |             |

### decreaseRewardsAmount

onlyIncentiveMaker

`decreaseRewardsAmount(struct IIncentiveKey.IncentiveKey,uint256,uint256)` external

| Name        | Type                              | Description |
| ----------- | --------------------------------- | ----------- |
| key         | struct IIncentiveKey.IncentiveKey |             |
| reward      | uint256                           |             |
| bonusReward | uint256                           |             |

### detachIncentive

onlyIncentiveMaker

`detachIncentive(struct IIncentiveKey.IncentiveKey)` external

Detach incentive from the pool

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

### attachIncentive

onlyIncentiveMaker

`attachIncentive(struct IIncentiveKey.IncentiveKey)` external

Attach incentive to the pool

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

### enterFarming

onlyFarmingCenter

`enterFarming(struct IIncentiveKey.IncentiveKey,uint256,uint256)` 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

onlyFarmingCenter

`exitFarming(struct IIncentiveKey.IncentiveKey,uint256,address)` 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

`getRewardInfo(struct IIncentiveKey.IncentiveKey,uint256)` view external

Calculates the reward amount that will be received for the given farm

| 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 |             |
| 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.0/v1.0-tokenomics/algebraincentivefarming.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.
