LiquidityVault

Functions

initialize(contract IOptionToken optionToken_, contract IUniswapV3Factory uniV3Factory, uint256 initialPrice, uint256 priceA, uint256 priceB)

Initializes the contract

Parameters

optionToken_ - Address of the option token
uniV3Factory - Address of Uniswap v3 factor
initialPrice - Initial price (optionPrice / collateralPrice)
priceA - Price matching the lower tick
priceB - Price matching the upper tick

deposit(uint256 mintAmt)

Deposit token0 & token1 and mint vault tokens

Parameters

mintAmt Amount of vaults tokens to mint. Can be calculated using getMintAmount()

withdraw(uint256 burnAmt)

Withdraw token0 & token1 and burn vault tokens

Parameters

burnAmt - Amt of vault tokens to burn

rebalance(int24 newLowerTick, int24 newUpperTick, uint160 swapThresholdPrice, uint256 swapAmountBPS, bool zeroForOne)

Rebalance to a new concetrated liquidity range

Parameters

newLowerTick - New lower tick
newUpperTick - New upper tick
swapThresholdPrice - Slippage param for Uniswap v3 swap (in sqrtX96)
swapAmountBPS - Maximum amount to swap (in 4 decimals. 1e4 = 100%, 1e2 = 1%)
zeroForOne - True for swapping from token0 to token1

getMintAmounts(uint256 amount0Max, uint256 amount1Max) → uint256, uint256, uint256

Get amount given max amount of token0 and token1

Parameters

amount0Max - Maximum amount of token0
amount1Max - Maximum amount of token1

getMintAmountForAmount0(uint256 amount0) → uint256, uint256, uint256

Get mint amounts given max token0

Parameters

amount0 - Maximum amount of token0

getMintAmountForAmount1(uint256 amount1) → uint256, uint256, uint256

Get mint amounts given max token

Parameters

amount1 - Maximum amount of token1

getBalances() → uint256 amount0, uint256 amount1

Get current holdings of the contract considering fees, liquidity and idle tokens

Returns Values

amount0 - Amount of token0
amount1 - Amount of token1

getUnderlyingUserBalance(address user) → uint256 amount0, uint256 amount1

Get balances of token0 and token1 that the user can claim

Parameters

user - Address of the user

Return Values

amount0 - Amount of token0 belonging to the user
amount1 - Amount of token1 belonging to the user

getPositionId() → bytes32 id

Get the Uniswap v3 position id of current range

Return Values

id - Uniswap v3 position id