API reference v1.0
Introduction
periphery
tokenomics
FarmingCenter

FarmingCenter

FarmingCenter

Algebra main farming contract

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

Variables

contract IAlgebraLimitFarming limitFarming immutable

contract IAlgebraEternalFarming eternalFarming immutable

contract INonfungiblePositionManager nonfungiblePositionManager immutable

contract IFarmingCenterVault farmingCenterVault immutable

mapping(uint256 => struct FarmingCenter.Deposit) deposits

Developer note: deposits[tokenId] => Deposit

mapping(uint256 => struct FarmingCenter.L2Nft) l2Nfts

Functions

constructor

ERC721Permit, PeripheryPayments

constructor(contract IAlgebraLimitFarming,contract IAlgebraEternalFarming,contract INonfungiblePositionManager,contract IFarmingCenterVault) public

NameTypeDescription
_limitFarmingcontract IAlgebraLimitFarming
_eternalFarmingcontract IAlgebraEternalFarming
_nonfungiblePositionManagercontract INonfungiblePositionManager
_farmingCenterVaultcontract IFarmingCenterVault

onERC721Received

onERC721Received(address,address,uint256,bytes) external

Upon receiving a Algebra ERC721, creates the token deposit setting owner to `from`.

NameTypeDescription
address
fromaddress
tokenIduint256
bytes

Returns:

NameTypeDescription
[0]bytes4

enterFarming

enterFarming(struct IIncentiveKey.IncentiveKey,uint256,uint256,bool) external

Enters in incentive (time-limited or eternal farming) with NFT-position token

NameTypeDescription
keystruct IIncentiveKey.IncentiveKeyThe incentive event key
tokenIduint256The id of position NFT
tokensLockeduint256Amount of tokens to lock for liquidity multiplier (if tiers are used)
isLimitboolIs incentive time-limited or eternal

exitFarming

exitFarming(struct IIncentiveKey.IncentiveKey,uint256,bool) external

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

NameTypeDescription
keystruct IIncentiveKey.IncentiveKeyThe incentive event key
tokenIduint256The id of position NFT
isLimitboolIs incentive time-limited or eternal

collect

collect(struct INonfungiblePositionManager.CollectParams) external

Collects up to a maximum amount of fees owed to a specific position to the recipient

NameTypeDescription
paramsstruct INonfungiblePositionManager.CollectParamstokenId The ID of the NFT for which tokens are being collected, recipient The account that should receive the tokens, amount0Max The maximum amount of token0 to collect, amount1Max The maximum amount of token1 to collect

Returns:

NameTypeDescription
amount0uint256
amount1uint256

collectRewards

collectRewards(struct IIncentiveKey.IncentiveKey,uint256) external

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

NameTypeDescription
keystruct IIncentiveKey.IncentiveKeyThe incentive event key
tokenIduint256The id of position NFT

Returns:

NameTypeDescription
rewarduint256
bonusRewarduint256

claimReward

claimReward(contract IERC20Minimal,address,uint256,uint256) external

Used to claim and send rewards from farming(s)

NameTypeDescription
rewardTokencontract IERC20MinimalThe token that is a reward
toaddressThe address to be rewarded
amountRequestedIncentiveuint256Amount to claim in incentive (limit) farming
amountRequestedEternaluint256Amount to claim in eternal farming

Returns:

NameTypeDescription
rewarduint256

connectVirtualPool

connectVirtualPool(contract IAlgebraPool,address) external

Updates activeIncentive in AlgebraPool

NameTypeDescription
poolcontract IAlgebraPoolThe AlgebraPool for which farming was created
newVirtualPooladdress

withdrawToken

withdrawToken(uint256,address,bytes) external

Withdraw Algebra NFT-position token

NameTypeDescription
tokenIduint256The id of position NFT
toaddressNew owner of position NFT
databytesThe additional data for NonfungiblePositionManager

cross

cross(int24,bool) external

NameTypeDescription
nextTickint24The crossed tick
zeroToOneboolThe direction

increaseCumulative

increaseCumulative(uint32) external

NameTypeDescription
blockTimestampuint32The current block timestamp, truncated

Returns:

NameTypeDescription
statusenum IAlgebraVirtualPool.Status

virtualPoolAddresses

virtualPoolAddresses(address) view external

NameTypeDescription
pooladdress

Returns:

NameTypeDescription
limitVPaddress
eternalVPaddress

getApproved

getApproved(uint256) view public

NameTypeDescription
tokenIduint256

Returns:

NameTypeDescription
[0]address