Algebra eternal (v2-like) farming
modifier onlyIncentiveMaker()
internal
modifier onlyAdministrator()
internal
modifier onlyFarmingCenter()
internal
The nonfungible position manager with which this farming contract is compatible
Represents a farming incentive
Developer note: bytes32 refers to the return value of IncentiveId.compute
Returns information about a farmd liquidity NFT
Developer note: farms[tokenId][incentiveHash] => Farm
Returns amounts of reward tokens owed to a given address according to the last time all farms were updated
Developer note: rewards[owner][rewardToken] => uint256
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 |
function isIncentiveActiveInPool(bytes32 incentiveId, contract IAlgebraPool pool) external view returns (bool res)
view external
Check if incentive is active in Algebra pool Developer note: Does not check that the pool is indeed an Algebra pool
Name | Type | Description |
---|---|---|
incentiveId | bytes32 | The ID of the incentive computed from its parameters |
pool | contract IAlgebraPool | Corresponding Algebra pool |
Returns:
Name | Type | Description |
---|---|---|
res | bool | True if incentive is active in Algebra pool |
function createEternalFarming(struct IncentiveKey key, struct IAlgebraEternalFarming.IncentiveParams params) external returns (address virtualPool)
external
Creates a new liquidity mining incentive program
Name | Type | Description |
---|---|---|
key | struct IncentiveKey | Details of the incentive to create |
params | struct IAlgebraEternalFarming.IncentiveParams | Params of incentive |
Returns:
Name | Type | Description |
---|---|---|
virtualPool | address | The virtual pool |
function deactivateIncentive(struct IncentiveKey key) external
external
Detach incentive from the pool and deactivate it
Name | Type | Description |
---|---|---|
key | struct IncentiveKey | The key of the incentive |
function decreaseRewardsAmount(struct IncentiveKey key, uint128 rewardAmount, uint128 bonusRewardAmount) external
external
Name | Type | Description |
---|---|---|
key | struct IncentiveKey | |
rewardAmount | uint128 | |
bonusRewardAmount | uint128 |
function setFarmingCenterAddress(address _farmingCenter) external
external
Updates farming center address
Name | Type | Description |
---|---|---|
_farmingCenter | address | The new farming center contract address |
function addRewards(struct IncentiveKey key, uint128 rewardAmount, uint128 bonusRewardAmount) external
external
Name | Type | Description |
---|---|---|
key | struct IncentiveKey | |
rewardAmount | uint128 | |
bonusRewardAmount | uint128 |
function setRates(struct IncentiveKey key, uint128 rewardRate, uint128 bonusRewardRate) external
external
Name | Type | Description |
---|---|---|
key | struct IncentiveKey | |
rewardRate | uint128 | |
bonusRewardRate | uint128 |
function enterFarming(struct IncentiveKey key, uint256 tokenId) external
external
enter farming for Algebra LP token
Name | Type | Description |
---|---|---|
key | struct IncentiveKey | The key of the incentive for which to enterFarming the NFT |
tokenId | uint256 | The ID of the token to exitFarming |
function exitFarming(struct IncentiveKey key, uint256 tokenId, address _owner) external
external
exitFarmings for Algebra LP token
Name | Type | Description |
---|---|---|
key | struct 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 |
function claimReward(contract IERC20Minimal rewardToken, address to, uint256 amountRequested) external returns (uint256 reward)
external
Transfers `amountRequested` of accrued `rewardToken` rewards from the contract to the recipient `to`
Name | Type | Description |
---|---|---|
rewardToken | contract IERC20Minimal | The token being distributed as a reward |
to | address | The address where claimed rewards will be sent to |
amountRequested | uint256 | The amount of reward tokens to claim. Claims entire reward amount if set to 0. |
Returns:
Name | Type | Description |
---|---|---|
reward | uint256 | The amount of reward tokens claimed |
function claimRewardFrom(contract IERC20Minimal rewardToken, address from, address to, uint256 amountRequested) external returns (uint256 reward)
external
Transfers `amountRequested` of accrued `rewardToken` rewards from the contract to the recipient `to` only for FarmingCenter
Name | Type | Description |
---|---|---|
rewardToken | contract IERC20Minimal | The token being distributed as a reward |
from | address | The address of position owner |
to | address | The address where claimed rewards will be sent to |
amountRequested | uint256 | The amount of reward tokens to claim. Claims entire reward amount if set to 0. |
Returns:
Name | Type | Description |
---|---|---|
reward | uint256 | The amount of reward tokens claimed |
function getRewardInfo(struct 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 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 |
function collectRewards(struct 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 IncentiveKey | |
tokenId | uint256 | |
_owner | address |
Returns:
Name | Type | Description |
---|---|---|
reward | uint256 | |
bonusReward | uint256 |