Functions
getAddLiquidityParams
Converts add parameter slippage specification into add parameters. The return values are given in both raw format and as packed values that can be used in the LiquidityManager contract.
Copy function getAddLiquidityParams ( AddParamsViewInputs memory params)
external
view
returns (
bytes memory packedSqrtPriceBreaks ,
bytes [] memory packedArgs ,
uint88 [] memory sqrtPriceBreaks ,
IMaverickV2Pool . AddLiquidityParams [] memory addParams ,
IMaverickV2PoolLens . TickDeltas [] memory tickDeltas
);
getAddLiquidityParamsForBoostedPosition
Converts add parameter slippage specification for a boosted position into add parameters. The return values are given in both raw format and as packed values that can be used in the LiquidityManager contract.
Copy function getAddLiquidityParamsForBoostedPosition (
IMaverickV2BoostedPosition boostedPosition ,
AddParamsSpecification memory addSpec
)
external
view
returns (
bytes memory packedSqrtPriceBreaks ,
bytes [] memory packedArgs ,
uint88 [] memory sqrtPriceBreaks ,
IMaverickV2Pool . AddLiquidityParams [] memory addParams ,
IMaverickV2PoolLens . TickDeltas [] memory tickDeltas
);
getCreateBoostedPositionParams
Converts add parameter slippage specification and boosted position specification into add parameters. The return values are given in both raw format and as packed values that can be used in the LiquidityManager contract.
Copy function getCreateBoostedPositionParams (
BoostedPositionSpecification memory bpSpec ,
AddParamsSpecification memory addSpec
)
external
view
returns (
bytes memory packedSqrtPriceBreaks ,
bytes [] memory packedArgs ,
uint88 [] memory sqrtPriceBreaks ,
IMaverickV2Pool . AddLiquidityParams [] memory addParams ,
IMaverickV2PoolLens . TickDeltas [] memory tickDeltas
);
getCreatePoolAtPriceAndAddLiquidityParams
Converts add parameter slippage specification and new pool specification into CreateAndAddParamsInputs parameters that can be used in the LiquidityManager contract.
Copy function getCreatePoolAtPriceAndAddLiquidityParams (
CreateAndAddParamsViewInputs memory params ,
IMaverickV2Factory factory
) external view returns ( CreateAndAddParamsInputs memory output);
getTicksAroundActive
View function that provides information about pool ticks within a tick radius from the activeTick.
Copy function getTicksAroundActive ( IMaverickV2Pool pool , int32 tickRadius)
external
view
returns ( int32 [] memory ticks , IMaverickV2Pool . TickState [] memory tickStates);
getTicks
View function that provides information about pool ticks within a range.
Copy function getTicks ( IMaverickV2Pool pool , int32 tickStart , int32 tickEnd)
external
view
returns ( int32 [] memory ticks , IMaverickV2Pool . TickState [] memory tickStates);
getFullPoolState
View function that provides pool state information.
Copy function getFullPoolState ( IMaverickV2Pool pool , uint32 binStart , uint32 binEnd)
external
view
returns ( PoolState memory poolState);
getTickSqrtPriceAndL
View function that provides price and liquidity of a given tick.
Copy function getTickSqrtPriceAndL ( IMaverickV2Pool pool , int32 tick)
external
view
returns ( uint256 sqrtPrice , uint256 liquidity);
getPoolSqrtPrice
Pool sqrt price.
Copy function getPoolSqrtPrice ( IMaverickV2Pool pool) external view returns ( uint256 sqrtPrice);
getPoolPrice
Pool price.
Copy function getPoolPrice ( IMaverickV2Pool pool) external view returns ( uint256 price);
tokenScales
Token scale of two tokens in a pool.
Copy function tokenScales ( IMaverickV2Pool pool) external view returns ( uint256 tokenAScale , uint256 tokenBScale);
Errors
LensTargetPriceOutOfBounds
Copy error LensTargetPriceOutOfBounds ( uint256 targetSqrtPrice , uint256 sqrtLowerTickPrice , uint256 sqrtUpperTickPrice);
LensTooLittleLiquidity
Copy error LensTooLittleLiquidity ( uint256 relativeLiquidityAmount , uint256 deltaA , uint256 deltaB);
LensTargetingTokenWithNoDelta
Copy error LensTargetingTokenWithNoDelta ( bool targetIsA , uint256 deltaA , uint256 deltaB);
Structs
AddParamsViewInputs
Add liquidity slippage parameters for a distribution of liquidity.
Copy struct AddParamsViewInputs {
IMaverickV2Pool pool;
uint8 kind;
int32 [] ticks;
uint128 [] relativeLiquidityAmounts;
AddParamsSpecification addSpec;
}
Properties
AddParamsSpecification
Multi-price add param specification.
Copy struct AddParamsSpecification {
uint256 slippageFactorD18;
uint256 numberOfPriceBreaksPerSide;
uint256 targetAmount;
bool targetIsA;
}
Properties
CreateBoostedPositionInputs
Boosted position creation specification and add parameters.
Copy struct CreateBoostedPositionInputs {
BoostedPositionSpecification bpSpec;
bytes packedSqrtPriceBreaks;
bytes [] packedArgs;
}
Properties
CreateAndAddParamsViewInputs
Specification for deriving create pool parameters. Creating a pool in the liquidity manager has several steps:
Donate a small amount of initial liquidity in the activeTick
Execute a small swap to set the pool price to the desired value
Add liquidity In order to execute these steps, the caller must specify the parameters of each step. The PoolLens has helper function to derive the values used by the LiquidityManager, but this struct is the input to that helper function and represents the core intent of the pool creator.
Copy struct CreateAndAddParamsViewInputs {
uint64 feeAIn;
uint64 feeBIn;
uint16 tickSpacing;
uint32 lookback;
IERC20 tokenA;
IERC20 tokenB;
int32 activeTick;
uint8 kinds;
uint256 initialTargetB;
uint256 sqrtPrice;
uint8 kind;
int32 [] ticks;
uint128 [] relativeLiquidityAmounts;
uint256 targetAmount;
bool targetIsA;
}
Properties
Output
Copy struct Output {
uint256 deltaAOut;
uint256 deltaBOut;
uint256 [] deltaAs;
uint256 [] deltaBs;
uint128 [] deltaLpBalances;
}
Reserves
Copy struct Reserves {
uint256 amountA;
uint256 amountB;
}
BinPositionKinds
Copy struct BinPositionKinds {
uint128 [ 4 ] values;
}
PoolState
Copy struct PoolState {
IMaverickV2Pool.TickState[] tickStateMapping;
IMaverickV2Pool.BinState[] binStateMapping;
BinPositionKinds[] binIdByTickKindMapping;
IMaverickV2Pool.State state;
Reserves protocolFees;
}
BoostedPositionSpecification
Copy struct BoostedPositionSpecification {
IMaverickV2Pool pool;
uint32 [] binIds;
uint128 [] ratios;
uint8 kind;
}
CreateAndAddParamsInputs
Copy struct CreateAndAddParamsInputs {
uint64 feeAIn;
uint64 feeBIn;
uint16 tickSpacing;
uint32 lookback;
IERC20 tokenA;
IERC20 tokenB;
int32 activeTick;
uint8 kinds;
IMaverickV2Pool pool;
IMaverickV2Pool.AddLiquidityParams donateParams;
uint256 swapAmount;
IMaverickV2Pool.AddLiquidityParams addParams;
bytes [] packedAddParams;
uint256 deltaAOut;
uint256 deltaBOut;
}
TickDeltas
Copy struct TickDeltas {
uint256 deltaAOut;
uint256 deltaBOut;
uint256 [] deltaAs;
uint256 [] deltaBs;
}
Last updated 5 months ago