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

NameTypeDescription
_deployercontract IAlgebraPoolDeployerpool deployer contract address
_nonfungiblePositionManagercontract INonfungiblePositionManagerthe 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

NameTypeDescription
keystruct IIncentiveKey.IncentiveKeyDetails of the incentive to create
paramsstruct IAlgebraEternalFarming.IncentiveParamsParams of incentive
tiersstruct IAlgebraFarming.TiersThe amounts of locked token for liquidity multipliers

Returns:

NameTypeDescription
virtualPooladdressThe virtual pool

detachIncentive

function detachIncentive(struct IIncentiveKey.IncentiveKey key) external external

Detach incentive from the pool

NameTypeDescription
keystruct IIncentiveKey.IncentiveKeyThe key of the incentive

attachIncentive

function attachIncentive(struct IIncentiveKey.IncentiveKey key) external external

Attach incentive to the pool

NameTypeDescription
keystruct IIncentiveKey.IncentiveKeyThe key of the incentive

addRewards

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

NameTypeDescription
keystruct IIncentiveKey.IncentiveKey
rewardAmountuint256
bonusRewardAmountuint256

setRates

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

NameTypeDescription
keystruct IIncentiveKey.IncentiveKey
rewardRateuint128
bonusRewardRateuint128

enterFarming

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

enter farming for Algebra LP token

NameTypeDescription
keystruct IIncentiveKey.IncentiveKeyThe key of the incentive for which to enterFarming the NFT
tokenIduint256The ID of the token to exitFarming
tokensLockeduint256The amount of tokens locked for boost

exitFarming

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

exitFarmings for Algebra LP token

NameTypeDescription
keystruct IIncentiveKey.IncentiveKeyThe key of the incentive for which to exitFarming the NFT
tokenIduint256The ID of the token to exitFarming
_owneraddressOwner 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

NameTypeDescription
keystruct IIncentiveKey.IncentiveKeyThe key of the incentive
tokenIduint256The ID of the token

Returns:

NameTypeDescription
rewarduint256The reward accrued to the NFT for the given incentive thus far
bonusRewarduint256The 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

NameTypeDescription
keystruct IIncentiveKey.IncentiveKey
tokenIduint256
_owneraddress

Returns:

NameTypeDescription
rewarduint256
bonusRewarduint256