Skip to content

Commit

Permalink
natspec for IQuoter
Browse files Browse the repository at this point in the history
  • Loading branch information
ConjunctiveNormalForm committed Nov 16, 2023
1 parent 1e0277b commit ca62ec2
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .solhint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "solhint:recommended",
"rules": {
"no-inline-assembly": "off",
"no-global-import": "off",
"no-empty-blocks": "off",
"func-visibility": ["warn", { "ignoreConstructors": true }]
}
}
25 changes: 25 additions & 0 deletions contracts/interfaces/IQuoter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ pragma solidity ^0.8.20;
import "../libraries/SwapIntention.sol";
import {Currency} from "@uniswap/v4-core/contracts/types/Currency.sol";

/// @title Quoter Interface
/// @notice Supports quoting the delta amounts from exact input or exact output swaps.
/// @notice For each pool also tells you the number of initialized ticks loaded and the sqrt price of the pool after the swap.
/// @dev These functions are not marked view because they rely on calling non-view functions and reverting
/// to compute the result. They are also not gas efficient and should not be called on-chain.
interface IQuoter {
error InvalidQuoteType();
error InvalidQuoteTypeInRevert();
Expand All @@ -14,11 +19,31 @@ interface IQuoter {
Currency currency;
int128 deltaAmount;
}
/// @notice Returns the delta amounts for a given exact input but for a swap of a single pool
/// @param params The params for the quote, encoded as `ExactInputSingleParams`
/// poolKey The key for identifying a V4 pool
/// zeroForOne If the swap is from currency0 to currency1
/// recipient The indented recipient of the output tokens
/// amountIn The desired input amount
/// sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap
/// hookData arbitrary hookData to pass into the associated hooks
/// @return deltaAmounts Delta amounts resulted from the swap
/// @return sqrtPriceX96After The sqrt price of the pool after the swap
/// @return initializedTicksLoaded The number of initialized ticks that the swap loaded

function quoteExactInputSingle(ExactInputSingleParams calldata params)
external
returns (int128[] memory deltaAmounts, uint160 sqrtPriceX96After, uint32 initializedTicksLoaded);

/// @notice Returns the delta amounts along the swap path for a given exact input swap
/// @param params the params for the quote, encoded as 'ExactInputParams'
/// currencyIn The input currency of the swap
/// path The path of the swap encoded as PathKeys that contains currency, fee, tickSpacing, and hook info
/// recipient The indented recipient of the output tokens
/// amountIn The desired input amount
/// @return deltaAmounts Delta amounts along the path resulted from the swap
/// @return sqrtPriceX96AfterList List of the sqrt price after the swap for each pool in the path
/// @return initializedTicksLoadedList List of the initialized ticks that the swap loaded for each pool in the path
function quoteExactInput(ExactInputParams memory params)
external
returns (
Expand Down

0 comments on commit ca62ec2

Please sign in to comment.