FarmingCenter

Algebra main farming contract

Developer note: Manages farmings and performs entry, exit and other actions.

Modifiers

isOwner

modifier isOwner(uint256 tokenId) internal

Variables

contract IAlgebraEternalFarming eternalFarming immutable

The eternal farming contract

contract INonfungiblePositionManager nonfungiblePositionManager immutable

The nonfungible position manager with which this farming contract is compatible

address algebraPoolDeployer immutable

The Algebra poolDeployer contract

mapping(address => address) virtualPoolAddresses

Developer note: saves addresses of virtual pools for pool

mapping(uint256 => bytes32) deposits

Developer note: deposits[tokenId] => incentiveId

mapping(bytes32 => struct IncentiveKey) incentiveKeys

Functions

constructor

constructor(contract IAlgebraEternalFarming _eternalFarming, contract INonfungiblePositionManager _nonfungiblePositionManager) public public

enterFarming

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

Enters in incentive (time-limited or eternal farming) with NFT-position token Developer note: token must be deposited in FarmingCenter

exitFarming

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

Exits from incentive (time-limited or eternal farming) with NFT-position token

applyLiquidityDelta

function applyLiquidityDelta(uint256 tokenId, int256 liquidityDelta) external external

Report a change of liquidity in position

increaseLiquidity

function increaseLiquidity(uint256 tokenId, uint256 liquidityDelta) external external

decreaseLiquidity

function decreaseLiquidity(uint256 tokenId, uint256 liquidityDelta) external returns (bool success) external

Returns:

burnPosition

function burnPosition(uint256 tokenId) external returns (bool success) external

Report a burn of position token

Returns:

collectRewards

function collectRewards(struct IncentiveKey key, uint256 tokenId) external returns (uint256 reward, uint256 bonusReward) external

Used to collect reward from eternal farming. Then reward can be claimed.

Returns:

claimReward

function claimReward(contract IERC20Minimal rewardToken, address to, uint256 amountRequested) external returns (uint256 reward) external

Used to claim and send rewards from farming(s) Developer note: can be used via static call to get current rewards for user

Returns:

connectVirtualPool

function connectVirtualPool(contract IAlgebraPool pool, address newVirtualPool) external external

Updates activeIncentive in AlgebraPool Developer note: only farming can do it