Skip to content

Instantly share code, notes, and snippets.

@mejango
mejango / gist:d53a411fa8ef46c02db09f056aa4f61d
Last active September 5, 2025 18:14
Uniswap V3: Get Quote, with calculated slippage tolerance.
/// @notice Get a quote based on the TWAP, using the TWAP window and slippage tolerance for the specified project.
/// @param projectId The ID of the project which the swap is associated with.
/// @param projectToken The project token being swapped for.
/// @param amountIn The number of terminal tokens being used to swap.
/// @param terminalToken The terminal token being paid in and used to swap.
/// @return amountOut The minimum number of tokens to receive based on the TWAP and its params.
function _getQuote(
uint256 projectId,
address projectToken,
uint256 amountIn,