E721 farms include all the farms built for pools in which the liquidity provider has an NFT (ERC721) position.
Inherits: Farm, IERC721Receiver
Author: Sperax Foundation.
This contract contains the core logic for E721 farms.
Function is called when user transfers the NFT to this farm.
Parameters
<none>
address
_from
address
The address of the owner.
_tokenId
uint256
NFT Id generated by other protocol (e.g. Camelot or Uniswap).
_data
bytes
The data should be the lockup flag (bool).
Returns
<none>
bytes4
bytes4 The onERC721Received selector.
Function to withdraw a deposit from the farm.
Parameters
_depositId
uint256
The id of the deposit to be withdrawn.
Function to get the liquidity. Must be defined by the farm.
This function should be overridden to add the respective logic.
Parameters
_tokenId
uint256
The nft tokenId.
Returns
<none>
uint256
The liquidity of the nft position.
Pools in camelot V3 are very similar to Uniswap V3. When a liquidity provider supplies assets to the pool, the LP receives an NFT position in return.
Next, you can see the specification for Camelot V3 farm and Camelot V3 farm deployer.
Inherits: FarmDeployer
Author: Sperax Foundation.
This contract allows anyone to calculate fees, pay fees and create farms.
Constructor of the contract.
Parameters
_farmRegistry
address
Address of the Demeter Farm Registry.
_farmId
string
Id of the farm.
_camelotV3Factory
address
Address of CamelotV3 factory.
_nfpm
address
Address of Camelot NonfungiblePositionManager contract.
_camelotUtils
address
Address of CamelotUtils (Camelot helper) contract.
_nfpmUtils
address
Address of Camelot INonfungiblePositionManagerUtils (NonfungiblePositionManager helper) contract.
Deploys a new CamelotV3 farm.
The caller of this function should approve feeAmount to this contract before calling this function.
Parameters
_data
FarmData
Data for deployment.
Returns
<none>
address
Address of the deployed farm.
Inherits: E721Farm, OperableDeposit, ClaimableFee
Author: Sperax Foundation.
This contract is the implementation of the Camelot V3 farm.
Initializer function of this farm.
Parameters
_input
InitializeInput
A struct having all the input params.
Allow user to increase liquidity for a deposit.
Parameters
_depositId
uint256
The id of the deposit to be increased.
_amounts
uint256[2]
Desired amount of tokens to be increased.
_minAmounts
uint256[2]
Minimum amount of tokens to be added as liquidity.
Withdraw liquidity partially from an existing deposit.
Parameters
_depositId
uint256
Deposit index for the user.
_liquidityToWithdraw
uint128
Amount to be withdrawn.
_minAmounts
uint256[2]
Minimum amount of tokens to be received.
Function to be called by Demeter Rewarder to get tokens and amounts associated with the farm's liquidity.
Returns
<none>
address[]
tokens An array of token addresses.
<none>
uint256[]
amounts An array of token amounts.
Claim pool fee implementation from ClaimableFee
feature.
Parameters
_depositId
uint256
Deposit ID of the deposit in the farm.
Validate the position for the pool and get Liquidity.
The position must adhere to the price ranges.
Only allow specific pool token to be staked.
Parameters
_tokenId
uint256
The tokenId of the position.
Returns
<none>
uint256
The liquidity of the position.
Validate the ticks (upper and lower).
Get the info of the required token.
Check if the token belongs to correct pool.
Check if the token adheres to the tick range.
The ticks must be within the max range and must be multiple of tickSpacing.
Parameters
_tickLower
int24
The lower tick of the range.
_tickUpper
int24
The upper tick of the range.