AlgebraEternalFarming

Algebra eternal (v2-like) farming

Modifiers

onlyIncentiveMaker

modifier onlyIncentiveMaker() internal

onlyAdministrator

modifier onlyAdministrator() internal

onlyFarmingCenter

modifier onlyFarmingCenter() internal

Variables

contract INonfungiblePositionManager nonfungiblePositionManager immutable

The nonfungible position manager with which this farming contract is compatible

contract IFarmingCenter farmingCenter

mapping(bytes32 => struct AlgebraEternalFarming.Incentive) incentives

Represents a farming incentive

Developer note: bytes32 refers to the return value of IncentiveId.compute

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

Returns information about a farmd liquidity NFT

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

uint256 numOfIncentives

bytes32 INCENTIVE_MAKER_ROLE constant

bytes32 FARMINGS_ADMINISTRATOR_ROLE constant

mapping(address => mapping(contract IERC20Minimal => uint256)) rewards

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

Functions

constructor

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

isIncentiveActiveInPool

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

Returns:

createEternalFarming

function createEternalFarming(struct IncentiveKey key, struct IAlgebraEternalFarming.IncentiveParams params) external returns (address virtualPool) external

Creates a new liquidity mining incentive program

Returns:

deactivateIncentive

function deactivateIncentive(struct IncentiveKey key) external external

Detach incentive from the pool and deactivate it

decreaseRewardsAmount

function decreaseRewardsAmount(struct IncentiveKey key, uint128 rewardAmount, uint128 bonusRewardAmount) external external

setFarmingCenterAddress

function setFarmingCenterAddress(address _farmingCenter) external external

Updates farming center address

addRewards

function addRewards(struct IncentiveKey key, uint128 rewardAmount, uint128 bonusRewardAmount) external external

setRates

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

enterFarming

function enterFarming(struct IncentiveKey key, uint256 tokenId) external external

enter farming for Algebra LP token

exitFarming

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

exitFarmings for Algebra LP token

claimReward

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`

Returns:

claimRewardFrom

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

Returns:

getRewardInfo

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

Returns:

collectRewards

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

Returns: