Merge branch 'main' into router/tnl/ENG-4046-static-call-verifier
This commit is contained in:
13
CHANGELOG.md
13
CHANGELOG.md
@@ -1,3 +1,16 @@
|
|||||||
|
## [0.17.0](https://github.com/propeller-heads/tycho-execution/compare/0.16.0...0.17.0) (2025-01-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* add pause/unpause methods ([c982ed9](https://github.com/propeller-heads/tycho-execution/commit/c982ed99e8bd1a01ec637aa1b9cd2c5ae69ddac4))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* ci ([4ee337d](https://github.com/propeller-heads/tycho-execution/commit/4ee337d1ee3fa5cda7bbec64b760e39028165a60))
|
||||||
|
* test pauser ([5734b53](https://github.com/propeller-heads/tycho-execution/commit/5734b535548338adcd3a738feb559b5b16105766))
|
||||||
|
|
||||||
## [0.16.0](https://github.com/propeller-heads/tycho-execution/compare/0.15.0...0.16.0) (2025-01-27)
|
## [0.16.0](https://github.com/propeller-heads/tycho-execution/compare/0.15.0...0.16.0) (2025-01-27)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -4163,7 +4163,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tycho-execution"
|
name = "tycho-execution"
|
||||||
version = "0.16.0"
|
version = "0.17.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"alloy",
|
"alloy",
|
||||||
"alloy-primitives",
|
"alloy-primitives",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tycho-execution"
|
name = "tycho-execution"
|
||||||
version = "0.16.0"
|
version = "0.17.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
|
|||||||
import "@permit2/src/interfaces/IAllowanceTransfer.sol";
|
import "@permit2/src/interfaces/IAllowanceTransfer.sol";
|
||||||
import "./ExecutionDispatcher.sol";
|
import "./ExecutionDispatcher.sol";
|
||||||
import "./CallbackVerificationDispatcher.sol";
|
import "./CallbackVerificationDispatcher.sol";
|
||||||
|
import "@openzeppelin/contracts/utils/Pausable.sol";
|
||||||
|
|
||||||
error TychoRouter__WithdrawalFailed();
|
error TychoRouter__WithdrawalFailed();
|
||||||
error TychoRouter__AddressZero();
|
error TychoRouter__AddressZero();
|
||||||
@@ -14,7 +15,8 @@ error TychoRouter__AddressZero();
|
|||||||
contract TychoRouter is
|
contract TychoRouter is
|
||||||
AccessControl,
|
AccessControl,
|
||||||
ExecutionDispatcher,
|
ExecutionDispatcher,
|
||||||
CallbackVerificationDispatcher
|
CallbackVerificationDispatcher,
|
||||||
|
Pausable
|
||||||
{
|
{
|
||||||
IAllowanceTransfer public immutable permit2;
|
IAllowanceTransfer public immutable permit2;
|
||||||
|
|
||||||
@@ -27,6 +29,8 @@ contract TychoRouter is
|
|||||||
0xe6ad9a47fbda1dc18de1eb5eeb7d935e5e81b4748f3cfc61e233e64f88182060;
|
0xe6ad9a47fbda1dc18de1eb5eeb7d935e5e81b4748f3cfc61e233e64f88182060;
|
||||||
bytes32 public constant PAUSER_ROLE =
|
bytes32 public constant PAUSER_ROLE =
|
||||||
0x65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a;
|
0x65d7a28e3265b37a6474929f336521b332c1681b933f6cb9f3376673440d862a;
|
||||||
|
bytes32 public constant UNPAUSER_ROLE =
|
||||||
|
0x427da25fe773164f88948d3e215c94b6554e2ed5e5f203a821c9f2f6131cf75a;
|
||||||
bytes32 public constant FUND_RESCUER_ROLE =
|
bytes32 public constant FUND_RESCUER_ROLE =
|
||||||
0x912e45d663a6f4cc1d0491d8f046e06c616f40352565ea1cdb86a0e1aaefa41b;
|
0x912e45d663a6f4cc1d0491d8f046e06c616f40352565ea1cdb86a0e1aaefa41b;
|
||||||
|
|
||||||
@@ -58,6 +62,20 @@ contract TychoRouter is
|
|||||||
// TODO execute generic callback
|
// 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
|
* @dev Executes a swap graph supporting internal splits token amount
|
||||||
* splits, checking that the user gets more than minUserAmount of buyToken.
|
* splits, checking that the user gets more than minUserAmount of buyToken.
|
||||||
@@ -72,7 +90,7 @@ contract TychoRouter is
|
|||||||
bytes calldata swaps,
|
bytes calldata swaps,
|
||||||
IAllowanceTransfer.PermitSingle calldata permitSingle,
|
IAllowanceTransfer.PermitSingle calldata permitSingle,
|
||||||
bytes calldata signature
|
bytes calldata signature
|
||||||
) external returns (uint256 amountOut) {
|
) external whenNotPaused returns (uint256 amountOut) {
|
||||||
amountOut = 0;
|
amountOut = 0;
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,12 @@ contract Constants is Test {
|
|||||||
address FEE_SETTER = makeAddr("feeSetter");
|
address FEE_SETTER = makeAddr("feeSetter");
|
||||||
address FEE_RECEIVER = makeAddr("feeReceiver");
|
address FEE_RECEIVER = makeAddr("feeReceiver");
|
||||||
|
|
||||||
// dummy contracts
|
// Dummy contracts
|
||||||
address DUMMY = makeAddr("dummy");
|
address DUMMY = makeAddr("dummy");
|
||||||
|
address PAUSER = makeAddr("pauser");
|
||||||
|
address UNPAUSER = makeAddr("unpauser");
|
||||||
|
|
||||||
|
// Assets
|
||||||
address WETH_ADDR = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
|
address WETH_ADDR = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
|
||||||
address DAI_ADDR = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
|
address DAI_ADDR = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
|
||||||
|
|
||||||
|
|||||||
@@ -163,4 +163,30 @@ contract TychoRouterTest is TychoRouterTestSetup {
|
|||||||
tychoRouter.setFeeReceiver(FEE_RECEIVER);
|
tychoRouter.setFeeReceiver(FEE_RECEIVER);
|
||||||
vm.stopPrank();
|
vm.stopPrank();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testPause() public {
|
||||||
|
vm.startPrank(PAUSER);
|
||||||
|
assertEq(tychoRouter.paused(), false);
|
||||||
|
tychoRouter.pause();
|
||||||
|
assertEq(tychoRouter.paused(), true);
|
||||||
|
// TODO: test swap calls when implemeted
|
||||||
|
vm.stopPrank();
|
||||||
|
|
||||||
|
vm.startPrank(UNPAUSER);
|
||||||
|
tychoRouter.unpause();
|
||||||
|
assertEq(tychoRouter.paused(), false);
|
||||||
|
vm.stopPrank();
|
||||||
|
|
||||||
|
vm.startPrank(UNPAUSER);
|
||||||
|
vm.expectRevert();
|
||||||
|
tychoRouter.unpause();
|
||||||
|
vm.stopPrank();
|
||||||
|
}
|
||||||
|
|
||||||
|
function testPauseNonRole() public {
|
||||||
|
vm.startPrank(BOB);
|
||||||
|
vm.expectRevert();
|
||||||
|
tychoRouter.pause();
|
||||||
|
vm.stopPrank();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ contract TychoRouterTestSetup is Test, Constants {
|
|||||||
tychoRouter.grantRole(keccak256("EXECUTOR_SETTER_ROLE"), BOB);
|
tychoRouter.grantRole(keccak256("EXECUTOR_SETTER_ROLE"), BOB);
|
||||||
tychoRouter.grantRole(keccak256("FUND_RESCUER_ROLE"), FUND_RESCUER);
|
tychoRouter.grantRole(keccak256("FUND_RESCUER_ROLE"), FUND_RESCUER);
|
||||||
tychoRouter.grantRole(keccak256("FEE_SETTER_ROLE"), FEE_SETTER);
|
tychoRouter.grantRole(keccak256("FEE_SETTER_ROLE"), FEE_SETTER);
|
||||||
|
tychoRouter.grantRole(keccak256("PAUSER_ROLE"), PAUSER);
|
||||||
|
tychoRouter.grantRole(keccak256("UNPAUSER_ROLE"), UNPAUSER);
|
||||||
executorSetter = BOB;
|
executorSetter = BOB;
|
||||||
deployDummyContract();
|
deployDummyContract();
|
||||||
vm.stopPrank();
|
vm.stopPrank();
|
||||||
|
|||||||
1
test/TychoRouter.t.sol
Normal file
1
test/TychoRouter.t.sol
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
Reference in New Issue
Block a user