-
Notifications
You must be signed in to change notification settings - Fork 548
/
Copy pathIV4Quoter.sol
71 lines (64 loc) · 3.29 KB
/
IV4Quoter.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import {PoolKey} from "@uniswap/v4-core/src/types/PoolKey.sol";
import {Currency} from "@uniswap/v4-core/src/types/Currency.sol";
import {PathKey} from "../libraries/PathKey.sol";
import {IImmutableState} from "./IImmutableState.sol";
import {IMsgSender} from "./IMsgSender.sol";
/// @title IV4Quoter
/// @notice Interface for the V4Quoter contract
interface IV4Quoter is IImmutableState, IMsgSender {
struct QuoteExactSingleParams {
PoolKey poolKey;
bool zeroForOne;
uint128 exactAmount;
bytes hookData;
}
struct QuoteExactParams {
Currency exactCurrency;
PathKey[] path;
uint128 exactAmount;
}
/// @notice Returns the delta amounts for a given exact input swap of a single pool
/// @param params The params for the quote, encoded as `QuoteExactSingleParams`
/// poolKey The key for identifying a V4 pool
/// zeroForOne If the swap is from currency0 to currency1
/// exactAmount The desired input amount
/// hookData arbitrary hookData to pass into the associated hooks
/// @return amountOut The output quote for the exactIn swap
/// @return gasEstimate Estimated gas units used for the swap
function quoteExactInputSingle(QuoteExactSingleParams memory params)
external
returns (uint256 amountOut, uint256 gasEstimate);
/// @notice Returns the delta amounts along the swap path for a given exact input swap
/// @param params the params for the quote, encoded as 'QuoteExactParams'
/// currencyIn The input currency of the swap
/// path The path of the swap encoded as PathKeys that contains currency, fee, tickSpacing, and hook info
/// exactAmount The desired input amount
/// @return amountOut The output quote for the exactIn swap
/// @return gasEstimate Estimated gas units used for the swap
function quoteExactInput(QuoteExactParams memory params)
external
returns (uint256 amountOut, uint256 gasEstimate);
/// @notice Returns the delta amounts for a given exact output swap of a single pool
/// @param params The params for the quote, encoded as `QuoteExactSingleParams`
/// poolKey The key for identifying a V4 pool
/// zeroForOne If the swap is from currency0 to currency1
/// exactAmount The desired output amount
/// hookData arbitrary hookData to pass into the associated hooks
/// @return amountIn The input quote for the exactOut swap
/// @return gasEstimate Estimated gas units used for the swap
function quoteExactOutputSingle(QuoteExactSingleParams memory params)
external
returns (uint256 amountIn, uint256 gasEstimate);
/// @notice Returns the delta amounts along the swap path for a given exact output swap
/// @param params the params for the quote, encoded as 'QuoteExactParams'
/// currencyOut The output currency of the swap
/// path The path of the swap encoded as PathKeys that contains currency, fee, tickSpacing, and hook info
/// exactAmount The desired output amount
/// @return amountIn The input quote for the exactOut swap
/// @return gasEstimate Estimated gas units used for the swap
function quoteExactOutput(QuoteExactParams memory params)
external
returns (uint256 amountIn, uint256 gasEstimate);
}