CamelotV3Farm

Git Source

Inherits: E721Farm, OperableDeposit, ClaimableFee

Author: Sperax Foundation.

This contract is the implementation of the Camelot V3 farm.

State Variables

tickLowerAllowed

int24 public tickLowerAllowed;

tickUpperAllowed

int24 public tickUpperAllowed;

camelotPool

address public camelotPool;

camelotV3Factory

address public camelotV3Factory;

camelotUtils

address public camelotUtils;

nfpmUtils

address public nfpmUtils;

MIN_TICK

int256 internal constant MIN_TICK = -887272;

MAX_TICK

int256 internal constant MAX_TICK = 887272;

Functions

initialize

Initializer function of this farm.

function initialize(InitializeInput calldata _input) external;

Parameters

increaseDeposit

Allow user to increase liquidity for a deposit.

function increaseDeposit(uint256 _depositId, uint256[2] calldata _amounts, uint256[2] calldata _minAmounts)
    external
    nonReentrant;

Parameters

decreaseDeposit

Withdraw liquidity partially from an existing deposit.

function decreaseDeposit(uint256 _depositId, uint128 _liquidityToWithdraw, uint256[2] calldata _minAmounts)
    external
    nonReentrant;

Parameters

getTokenAmounts

Function to be called by Demeter Rewarder to get tokens and amounts associated with the farm's liquidity.

function getTokenAmounts() external view override returns (address[] memory, uint256[] memory);

Returns

_claimPoolFee

Claim pool fee implementation from ClaimableFee feature.

function _claimPoolFee(uint256 _depositId)
    internal
    override
    returns (uint256 tokenId, uint256 amt0Recv, uint256 amt1Recv);

Parameters

_getLiquidity

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.

function _getLiquidity(uint256 _tokenId) internal view override returns (uint256);

Parameters

Returns

_validateTickRange

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.

function _validateTickRange(int24 _tickLower, int24 _tickUpper) private view;

Parameters

Errors

InvalidCamelotPoolConfig

error InvalidCamelotPoolConfig();

IncorrectPoolToken

error IncorrectPoolToken();

IncorrectTickRange

error IncorrectTickRange();

InvalidTickRange

error InvalidTickRange();

InvalidAmount

error InvalidAmount();