-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2cb4ac9
commit f1284cc
Showing
9 changed files
with
499 additions
and
317 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.24; | ||
|
||
import { IRouterSwap } from "./IRouterSwap.sol"; | ||
import { IMevTaxCollector } from "./IMevTaxCollector.sol"; | ||
|
||
interface IMevRouter is IRouterSwap { | ||
struct MevRouterParams { | ||
IMevTaxCollector mevTaxCollector; | ||
uint256 mevTaxMultiplier; | ||
uint256 priorityGasThreshold; | ||
} | ||
|
||
event MevTaxCharged(address pool, uint256 mevTax); | ||
|
||
function isMevTaxEnabled() external view returns (bool isMevTaxEnabled); | ||
|
||
function enableMevTax() external; | ||
|
||
function disableMevTax() external; | ||
|
||
function getMevTaxCollector() external view returns (IMevTaxCollector mevTaxCollector); | ||
|
||
function setMevTaxCollector(IMevTaxCollector mevTaxCollector) external; | ||
|
||
function getMevTaxMultiplier() external view returns (uint256 mevTaxMultiplier); | ||
|
||
function setMevTaxMultiplier(uint256 mevTaxMultiplier) external; | ||
|
||
function getPriorityGasThreshold() external view returns (uint256 priorityGasThreshold); | ||
|
||
function setPriorityGasThreshold(uint256 priorityGasThreshold) external; | ||
} |
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,7 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.24; | ||
|
||
interface IMevTaxCollector { | ||
function chargeMevTax(address pool) external payable; | ||
} |
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,127 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.24; | ||
|
||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | ||
|
||
import { SwapKind } from "./VaultTypes.sol"; | ||
|
||
interface IRouterSwap { | ||
/*************************************************************************** | ||
Swaps | ||
***************************************************************************/ | ||
|
||
/** | ||
* @notice Data for the swap hook. | ||
* @param sender Account initiating the swap operation | ||
* @param kind Type of swap (exact in or exact out) | ||
* @param pool Address of the liquidity pool | ||
* @param tokenIn Token to be swapped from | ||
* @param tokenOut Token to be swapped to | ||
* @param amountGiven Amount given based on kind of the swap (e.g., tokenIn for exact in) | ||
* @param limit Maximum or minimum amount based on the kind of swap (e.g., maxAmountIn for exact out) | ||
* @param deadline Deadline for the swap, after which it will revert | ||
* @param wethIsEth If true, incoming ETH will be wrapped to WETH and outgoing WETH will be unwrapped to ETH | ||
* @param userData Additional (optional) data sent with the swap request | ||
*/ | ||
struct SwapSingleTokenHookParams { | ||
address sender; | ||
SwapKind kind; | ||
address pool; | ||
IERC20 tokenIn; | ||
IERC20 tokenOut; | ||
uint256 amountGiven; | ||
uint256 limit; | ||
uint256 deadline; | ||
bool wethIsEth; | ||
bytes userData; | ||
} | ||
|
||
/** | ||
* @notice Executes a swap operation specifying an exact input token amount. | ||
* @param pool Address of the liquidity pool | ||
* @param tokenIn Token to be swapped from | ||
* @param tokenOut Token to be swapped to | ||
* @param exactAmountIn Exact amounts of input tokens to send | ||
* @param minAmountOut Minimum amount of tokens to be received | ||
* @param deadline Deadline for the swap, after which it will revert | ||
* @param wethIsEth If true, incoming ETH will be wrapped to WETH and outgoing WETH will be unwrapped to ETH | ||
* @param userData Additional (optional) data sent with the swap request | ||
* @return amountOut Calculated amount of output tokens to be received in exchange for the given input tokens | ||
*/ | ||
function swapSingleTokenExactIn( | ||
address pool, | ||
IERC20 tokenIn, | ||
IERC20 tokenOut, | ||
uint256 exactAmountIn, | ||
uint256 minAmountOut, | ||
uint256 deadline, | ||
bool wethIsEth, | ||
bytes calldata userData | ||
) external payable returns (uint256 amountOut); | ||
|
||
/** | ||
* @notice Executes a swap operation specifying an exact output token amount. | ||
* @param pool Address of the liquidity pool | ||
* @param tokenIn Token to be swapped from | ||
* @param tokenOut Token to be swapped to | ||
* @param exactAmountOut Exact amounts of input tokens to receive | ||
* @param maxAmountIn Maximum amount of tokens to be sent | ||
* @param deadline Deadline for the swap, after which it will revert | ||
* @param userData Additional (optional) data sent with the swap request | ||
* @param wethIsEth If true, incoming ETH will be wrapped to WETH and outgoing WETH will be unwrapped to ETH | ||
* @return amountIn Calculated amount of input tokens to be sent in exchange for the requested output tokens | ||
*/ | ||
function swapSingleTokenExactOut( | ||
address pool, | ||
IERC20 tokenIn, | ||
IERC20 tokenOut, | ||
uint256 exactAmountOut, | ||
uint256 maxAmountIn, | ||
uint256 deadline, | ||
bool wethIsEth, | ||
bytes calldata userData | ||
) external payable returns (uint256 amountIn); | ||
|
||
/*************************************************************************** | ||
Queries | ||
***************************************************************************/ | ||
|
||
/** | ||
* @notice Queries a swap operation specifying an exact input token amount without actually executing it. | ||
* @param pool Address of the liquidity pool | ||
* @param tokenIn Token to be swapped from | ||
* @param tokenOut Token to be swapped to | ||
* @param exactAmountIn Exact amounts of input tokens to send | ||
* @param sender The sender passed to the operation. It can influence results (e.g., with user-dependent hooks) | ||
* @param userData Additional (optional) data sent with the query request | ||
* @return amountOut Calculated amount of output tokens to be received in exchange for the given input tokens | ||
*/ | ||
function querySwapSingleTokenExactIn( | ||
address pool, | ||
IERC20 tokenIn, | ||
IERC20 tokenOut, | ||
uint256 exactAmountIn, | ||
address sender, | ||
bytes calldata userData | ||
) external returns (uint256 amountOut); | ||
|
||
/** | ||
* @notice Queries a swap operation specifying an exact output token amount without actually executing it. | ||
* @param pool Address of the liquidity pool | ||
* @param tokenIn Token to be swapped from | ||
* @param tokenOut Token to be swapped to | ||
* @param exactAmountOut Exact amounts of input tokens to receive | ||
* @param sender The sender passed to the operation. It can influence results (e.g., with user-dependent hooks) | ||
* @param userData Additional (optional) data sent with the query request | ||
* @return amountIn Calculated amount of input tokens to be sent in exchange for the requested output tokens | ||
*/ | ||
function querySwapSingleTokenExactOut( | ||
address pool, | ||
IERC20 tokenIn, | ||
IERC20 tokenOut, | ||
uint256 exactAmountOut, | ||
address sender, | ||
bytes calldata userData | ||
) external returns (uint256 amountIn); | ||
} |
Oops, something went wrong.