Pre-auditThree days of senior audit time for $1,500, credited in full toward your Zealynx audit.3 audit days, credited toward your auditSee how →
L-31·

High gas use risk from `Uniswap V3` quoter

Not reportedoptionsleverageblack-scholes
TL;DR

The PositionInteractionFacet contract uses Uniswap V3's quoter contract for on-chain price calculations during position exercises and liquidations.

Severity
LOW
Method
MManual review
CAT.

The PositionInteractionFacet contract uses Uniswap V3's quoter contract for on-chain price calculations during position exercises and liquidations. As noted in Uniswap's documentation, these quoter functions are not designed for on-chain use due to their high gas consumption.

The issue is present in the _swapAssetToAsset function:

solidity
function _swapAssetToAsset(
address assetIn,
address assetOut,
uint256 amountOut
) internal returns (uint256 amountIn) {
PoolStorage.Layout storage strg = PoolStorage.layout();
PoolStorage.Dex memory dex = strg.setUp.base.dex;
// Gas-intensive quote operation
IQuoterV2.QuoteExactOutputSingleParams memory quoteParams = IQuoterV2.QuoteExactOutputSingleParams({
tokenIn: assetIn,
tokenOut: assetOut,
amount: amountOut,
fee: dex.dexFee,
sqrtPriceLimitX96: 0
});
(uint256 amountInMaximum,,,) = IQuoterV2(dex.dexQuoter).quoteExactOutputSingle(quoteParams);
// Swap execution
IV3SwapRouter.ExactOutputSingleParams memory params = IV3SwapRouter.ExactOutputSingleParams({
tokenIn: assetIn,
tokenOut: assetOut,
fee: dex.dexFee,
recipient: address(this),
deadline: block.timestamp + 30 minutes,
amountOut: amountOut,
amountInMaximum: amountInMaximum,
sqrtPriceLimitX96: 0
});
amountIn = IV3SwapRouter(dex.dexRouter).exactOutputSingle(params);
}

This implementation is problematic for several reasons:

  1. The quoter functions simulate the entire swap path to calculate prices, making them extremely gas-intensive.
  2. These functions are explicitly not designed for on-chain use according to Uniswap's documentation.
  3. The quotes are used in critical position management functions (exercise/liquidation).

The risk is particularly high because position exercises/liquidations are most likely to occur during volatile market conditions, which are exactly the conditions where gas costs are highest.

Recommendations:

  1. Use an oracle-based approach for price calculations.
  2. Alternatively, implement optimistic execution with reasonable bounds.
02Section · Report provenance

Report provenance

Published by Pashov Audit Group, with Carlos (Bloqarl) participating as a contractor. The source report states that its fixes review was not fully completed; no final remediation disposition is recorded for this finding. Read the full report.

L-31