generated from Kwenta/foundry-scaffold
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π·π» π β
Add univ3 router to paymaster
- Loading branch information
1 parent
d0c6b67
commit fe85584
Showing
4 changed files
with
95 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// SPDX-License-Identifier: GPL-2.0-or-later | ||
pragma solidity 0.8.20; | ||
|
||
|
||
/// @title Router token swapping functionality | ||
/// @notice Functions for swapping tokens via Uniswap V3 | ||
interface IV3SwapRouter { | ||
struct ExactInputSingleParams { | ||
address tokenIn; | ||
address tokenOut; | ||
uint24 fee; | ||
address recipient; | ||
uint256 amountIn; | ||
uint256 amountOutMinimum; | ||
uint160 sqrtPriceLimitX96; | ||
} | ||
|
||
/// @notice Swaps `amountIn` of one token for as much as possible of another token | ||
/// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance, | ||
/// and swap the entire amount, enabling contracts to send tokens before calling this function. | ||
/// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata | ||
/// @return amountOut The amount of the received token | ||
function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); | ||
|
||
struct ExactInputParams { | ||
bytes path; | ||
address recipient; | ||
uint256 amountIn; | ||
uint256 amountOutMinimum; | ||
} | ||
|
||
/// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path | ||
/// @dev Setting `amountIn` to 0 will cause the contract to look up its own balance, | ||
/// and swap the entire amount, enabling contracts to send tokens before calling this function. | ||
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata | ||
/// @return amountOut The amount of the received token | ||
function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); | ||
|
||
struct ExactOutputSingleParams { | ||
address tokenIn; | ||
address tokenOut; | ||
uint24 fee; | ||
address recipient; | ||
uint256 amountOut; | ||
uint256 amountInMaximum; | ||
uint160 sqrtPriceLimitX96; | ||
} | ||
|
||
/// @notice Swaps as little as possible of one token for `amountOut` of another token | ||
/// that may remain in the router after the swap. | ||
/// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata | ||
/// @return amountIn The amount of the input token | ||
function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); | ||
|
||
struct ExactOutputParams { | ||
bytes path; | ||
address recipient; | ||
uint256 amountOut; | ||
uint256 amountInMaximum; | ||
} | ||
|
||
/// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) | ||
/// that may remain in the router after the swap. | ||
/// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata | ||
/// @return amountIn The amount of the input token | ||
function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters