Skip to main content

BunniQuoter

BunniQuoter is a contract that provides quote functions for swaps, deposits, and withdrawals in the Bunni v2. It allows users to simulate these operations and get expected results without actually executing the transactions.

Functions

quoteSwap

function quoteSwap(
PoolKey memory key,
IPoolManager.SwapParams memory params
) external view returns (
bool success,
uint160 updatedSqrtPriceX96,
int24 updatedTick,
uint256 inputAmount,
uint256 outputAmount,
uint24 swapFee,
uint256 totalLiquidity
)

Simulates a swap operation and returns the expected results.

Parameters:

NameTypeDescription
keystruct PoolKeyThe pool key
paramsIPoolManager.SwapParamsThe swap parameters

Return Values:

NameTypeDescription
successboolWhether the swap simulation was successful
updatedSqrtPriceX96uint160The updated square root price after the simulated swap
updatedTickint24The updated tick after the simulated swap
inputAmountuint256The amount of input token for the swap
outputAmountuint256The amount of output token from the swap
swapFeeuint24The swap fee applied
totalLiquidityuint256The total liquidity in the pool after the simulated swap

quoteDeposit

function quoteDeposit(
IBunniHub.DepositParams calldata params
) external view returns (
uint256 shares,
uint256 amount0,
uint256 amount1
)

Simulates a deposit operation and returns the expected results.

Parameters:

NameTypeDescription
paramsIBunniHub.DepositParamsThe deposit parameters

Return Values:

NameTypeDescription
sharesuint256The expected number of shares to be minted
amount0uint256The expected amount of token0 to be deposited
amount1uint256The expected amount of token1 to be deposited

quoteWithdraw

function quoteWithdraw(
IBunniHub.WithdrawParams calldata params
) external view returns (
uint256 amount0,
uint256 amount1
)

Simulates a withdrawal operation and returns the expected results.

Parameters:

NameTypeDescription
paramsIBunniHub.WithdrawParamsThe withdraw parameters

Return Values:

NameTypeDescription
amount0uint256The expected amount of token0 to be withdrawn
amount1uint256The expected amount of token1 to be withdrawn