IAlgebraEternalFarming
Algebra Eternal Farming Interface
Allows farming nonfungible liquidity tokens in exchange for reward tokens without locking NFT for incentive time
Events
IncentiveDeactivated
event IncentiveDeactivated(bytes32 incentiveId)
Event emitted when a liquidity mining incentive has been stopped from the outside
FarmEntered
event FarmEntered(uint256 tokenId, bytes32 incentiveId, uint128 liquidity)
Event emitted when a Algebra LP token has been farmd
FarmEnded
event FarmEnded(uint256 tokenId, bytes32 incentiveId, address rewardAddress, address bonusRewardToken, address owner, uint256 reward, uint256 bonusReward)
Event emitted when a Algebra LP token has been exitFarmingd
IncentiveMaker
event IncentiveMaker(address incentiveMaker)
Emitted when the incentive maker is changed
FarmingCenter
event FarmingCenter(address farmingCenter)
Emitted when the farming center is changed
RewardsAdded
event RewardsAdded(uint256 rewardAmount, uint256 bonusRewardAmount, bytes32 incentiveId)
Event emitted when rewards were added
RewardAmountsDecreased
event RewardAmountsDecreased(uint256 reward, uint256 bonusReward, bytes32 incentiveId)
RewardClaimed
event RewardClaimed(address to, uint256 reward, address rewardAddress, address owner)
Event emitted when a reward token has been claimed
RewardsRatesChanged
event RewardsRatesChanged(uint128 rewardRate, uint128 bonusRewardRate, bytes32 incentiveId)
Event emitted when reward rates were changed
RewardsCollected
event RewardsCollected(uint256 tokenId, bytes32 incentiveId, uint256 rewardAmount, uint256 bonusRewardAmount)
Event emitted when rewards were collected
EternalFarmingCreated
event EternalFarmingCreated(contract IERC20Minimal rewardToken, contract IERC20Minimal bonusRewardToken, contract IAlgebraPool pool, address virtualPool, uint256 nonce, uint256 reward, uint256 bonusReward, uint24 minimalAllowedPositionWidth)
Event emitted when a liquidity mining incentive has been created
Functions
nonfungiblePositionManager
function nonfungiblePositionManager() external view returns (contract INonfungiblePositionManager)
view external
The nonfungible position manager with which this farming contract is compatible
Returns:
incentives
function incentives(bytes32 incentiveId) external view returns (uint128 totalReward, uint128 bonusReward, address virtualPoolAddress, uint24 minimalPositionWidth, bool deactivated)
view external
Represents a farming incentive
Returns:
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:
deactivateIncentive
function deactivateIncentive(struct IncentiveKey key) external
external
Detach incentive from the pool and deactivate it
addRewards
function addRewards(struct IncentiveKey key, uint128 rewardAmount, uint128 bonusRewardAmount) external
external
decreaseRewardsAmount
function decreaseRewardsAmount(struct IncentiveKey key, uint128 rewardAmount, uint128 bonusRewardAmount) external
external
rewards
function rewards(address owner, contract IERC20Minimal rewardToken) external view returns (uint256 rewardsOwed)
view external
Returns amounts of reward tokens owed to a given address according to the last time all farms were updated
Returns:
setFarmingCenterAddress
function setFarmingCenterAddress(address _farmingCenter) external
external
Updates farming center address
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 returns (uint256 reward, uint256 bonusReward)
external
Calculates the reward amount that will be received for the given farm
Returns:
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
Returns:
createEternalFarming
function createEternalFarming(struct IncentiveKey key, struct IAlgebraEternalFarming.IncentiveParams params) external returns (address virtualPool)
external
Creates a new liquidity mining incentive program
Returns:
setRates
function setRates(struct IncentiveKey key, uint128 rewardRate, uint128 bonusRewardRate) external
external
collectRewards
function collectRewards(struct IncentiveKey key, uint256 tokenId, address _owner) external returns (uint256 reward, uint256 bonusReward)
external
Returns:
Errors
farmingAlreadyExists
error farmingAlreadyExists()
farmDoesNotExist
error farmDoesNotExist()
tokenAlreadyFarmed
error tokenAlreadyFarmed()
incentiveNotExist
error incentiveNotExist()
incentiveStopped
error incentiveStopped()
anotherFarmingIsActive
error anotherFarmingIsActive()
minimalPositionWidthTooWide
error minimalPositionWidthTooWide()
zeroRewardAmount
error zeroRewardAmount()
positionIsTooNarrow
error positionIsTooNarrow()
zeroLiquidity
error zeroLiquidity()
invalidPool
error invalidPool()
claimToZeroAddress
error claimToZeroAddress()