Merge branch 'main' into router/tnl/ENG-4046-static-call-verifier

This commit is contained in:
Tamara
2025-01-27 10:21:15 -05:00
committed by GitHub
8 changed files with 68 additions and 5 deletions

View File

@@ -7,6 +7,7 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@permit2/src/interfaces/IAllowanceTransfer.sol";
import "./ExecutionDispatcher.sol";
import "./CallbackVerificationDispatcher.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
error TychoRouter__WithdrawalFailed();
error TychoRouter__AddressZero();
@@ -14,7 +15,8 @@ error TychoRouter__AddressZero();
contract TychoRouter is
AccessControl,
ExecutionDispatcher,
CallbackVerificationDispatcher
CallbackVerificationDispatcher,
Pausable
{
IAllowanceTransfer public immutable permit2;
@@ -27,6 +29,8 @@ contract TychoRouter is
0xe6ad9a47fbda1dc18de1eb5eeb7d935e5e81b4748f3cfc61e233e64f88182060;
bytes32 public constant PAUSER_ROLE =
0x65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a;
bytes32 public constant UNPAUSER_ROLE =
0x427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a;
bytes32 public constant FUND_RESCUER_ROLE =
0x912e45d663a6f4cc1d0491d8f046e06c616f40352565ea1cdb86a0e1aaefa41b;
@@ -58,6 +62,20 @@ contract TychoRouter is
// TODO execute generic callback
}
/**
* @dev Pauses the contract
*/
function pause() external onlyRole(PAUSER_ROLE) {
_pause();
}
/**
* @dev Unpauses the contract
*/
function unpause() external onlyRole(UNPAUSER_ROLE) {
_unpause();
}
/**
* @dev Executes a swap graph supporting internal splits token amount
* splits, checking that the user gets more than minUserAmount of buyToken.
@@ -72,7 +90,7 @@ contract TychoRouter is
bytes calldata swaps,
IAllowanceTransfer.PermitSingle calldata permitSingle,
bytes calldata signature
) external returns (uint256 amountOut) {
) external whenNotPaused returns (uint256 amountOut) {
amountOut = 0;
// TODO
}