IAlgebraEternalFarming

Algebra Eternal Farming Interface

Allows farming nonfungible liquidity tokens in exchange for reward tokens without locking NFT for incentive time

Events

RewardsRatesChanged

event RewardsRatesChanged(uint128 rewardRate, uint128 bonusRewardRate, bytes32 incentiveId)

Event emitted when reward rates were changed

NameTypeDescription
rewardRateuint128The new rate of main token distribution per sec
bonusRewardRateuint128The new rate of bonus token distribution per sec
incentiveIdbytes32The ID of the incentive for which rates were changed

RewardsCollected

event RewardsCollected(uint256 tokenId, bytes32 incentiveId, uint256 rewardAmount, uint256 bonusRewardAmount)

Event emitted when rewards were added

NameTypeDescription
tokenIduint256The ID of the token for which rewards were collected
incentiveIdbytes32The ID of the incentive for which rewards were collected
rewardAmountuint256Collected amount of reward
bonusRewardAmountuint256Collected amount of bonus reward

EternalFarmingCreated

event EternalFarmingCreated(contract IERC20Minimal rewardToken, contract IERC20Minimal bonusRewardToken, contract IAlgebraPool pool, address virtualPool, uint256 startTime, uint256 endTime, uint256 reward, uint256 bonusReward, struct IAlgebraFarming.Tiers tiers, address multiplierToken, uint24 minimalAllowedPositionWidth)

Event emitted when a liquidity mining incentive has been created

NameTypeDescription
rewardTokencontract IERC20MinimalThe token being distributed as a reward
bonusRewardTokencontract IERC20MinimalThe token being distributed as a bonus reward
poolcontract IAlgebraPoolThe Algebra pool
virtualPooladdressThe virtual pool address
startTimeuint256The time when the incentive program begins
endTimeuint256The time when rewards stop accruing
rewarduint256The amount of reward tokens to be distributed
bonusRewarduint256The amount of bonus reward tokens to be distributed
tiersstruct IAlgebraFarming.TiersThe amounts of locked token for liquidity multipliers
multiplierTokenaddressThe address of token which can be locked to get liquidity multiplier
minimalAllowedPositionWidthuint24The minimal allowed position width (tickUpper - tickLower)

Functions

farms

function farms(uint256 tokenId, bytes32 incentiveId) external view returns (uint128 liquidity, int24 tickLower, int24 tickUpper, uint256 innerRewardGrowth0, uint256 innerRewardGrowth1) view external

Returns information about a farmd liquidity NFT

NameTypeDescription
tokenIduint256The ID of the farmd token
incentiveIdbytes32The ID of the incentive for which the token is farmd

Returns:

NameTypeDescription
liquidityuint128The amount of liquidity in the NFT as of the last time the rewards were computed,

tickLower The lower tick of position, tickUpper The upper tick of position, innerRewardGrowth0 The last saved reward0 growth inside position, innerRewardGrowth1 The last saved reward1 growth inside position | | tickLower | int24 | | | tickUpper | int24 | | | innerRewardGrowth0 | uint256 | | | innerRewardGrowth1 | uint256 | |

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

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

collectRewards

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

NameTypeDescription
keystruct IIncentiveKey.IncentiveKey
tokenIduint256
_owneraddress

Returns:

NameTypeDescription
rewarduint256
bonusRewarduint256