Algebra main farming contract
Developer note: Manages farmings and performs entry, exit and other actions.
modifier isOwner(uint256 tokenId) internal
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 |
The eternal farming contract
The nonfungible position manager with which this farming contract is compatible
The Algebra poolDeployer contract
Developer note: saves addresses of virtual pools for pool
Developer note: deposits[tokenId] => incentiveId
constructor(contract IAlgebraEternalFarming _eternalFarming, contract INonfungiblePositionManager _nonfungiblePositionManager) public public
| Name | Type | Description |
|---|---|---|
| _eternalFarming | contract IAlgebraEternalFarming | |
| _nonfungiblePositionManager | contract INonfungiblePositionManager |
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
| Name | Type | Description |
|---|---|---|
| key | struct IncentiveKey | The incentive event key |
| tokenId | uint256 | The id of position NFT |
function exitFarming(struct IncentiveKey key, uint256 tokenId) external external
Exits from incentive (time-limited or eternal farming) with NFT-position token
| Name | Type | Description |
|---|---|---|
| key | struct IncentiveKey | The incentive event key |
| tokenId | uint256 | The id of position NFT |
function applyLiquidityDelta(uint256 tokenId, int256 liquidityDelta) external external
Report a change of liquidity in position
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The ID of the token for which liquidity is being added |
| liquidityDelta | int256 | The amount of added liquidity |
function increaseLiquidity(uint256 tokenId, uint256 liquidityDelta) external external
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | |
| liquidityDelta | uint256 |
function decreaseLiquidity(uint256 tokenId, uint256 liquidityDelta) external returns (bool success) external
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | |
| liquidityDelta | uint256 |
Returns:
| Name | Type | Description |
|---|---|---|
| success | bool |
function burnPosition(uint256 tokenId) external returns (bool success) external
Report a burn of position token
| Name | Type | Description |
|---|---|---|
| tokenId | uint256 | The ID of the token which is being burned |
Returns:
| Name | Type | Description |
|---|---|---|
| success | bool |
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.
| Name | Type | Description |
|---|---|---|
| key | struct IncentiveKey | The incentive event key |
| tokenId | uint256 | The id of position NFT |
Returns:
| Name | Type | Description |
|---|---|---|
| reward | uint256 | The amount of collected reward |
| bonusReward | uint256 | The amount of collected bonus reward |
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
| Name | Type | Description |
|---|---|---|
| rewardToken | contract IERC20Minimal | The token that is a reward |
| to | address | The address to be rewarded |
| amountRequested | uint256 | Amount to claim in eternal farming |
Returns:
| Name | Type | Description |
|---|---|---|
| reward | uint256 | The summary amount of claimed rewards |
function connectVirtualPool(contract IAlgebraPool pool, address newVirtualPool) external external
Updates activeIncentive in AlgebraPool Developer note: only farming can do it
| Name | Type | Description |
|---|---|---|
| pool | contract IAlgebraPool | The AlgebraPool for which farming was created |
| newVirtualPool | address |