chore: rm safecallback from router
This commit is contained in:
@@ -14,7 +14,6 @@ import "@permit2/src/interfaces/IAllowanceTransfer.sol";
|
|||||||
import "./Dispatcher.sol";
|
import "./Dispatcher.sol";
|
||||||
import {LibSwap} from "../lib/LibSwap.sol";
|
import {LibSwap} from "../lib/LibSwap.sol";
|
||||||
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
|
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol";
|
||||||
import {SafeCallback} from "@uniswap/v4-periphery/src/base/SafeCallback.sol";
|
|
||||||
|
|
||||||
error TychoRouter__WithdrawalFailed();
|
error TychoRouter__WithdrawalFailed();
|
||||||
error TychoRouter__AddressZero();
|
error TychoRouter__AddressZero();
|
||||||
@@ -23,13 +22,7 @@ error TychoRouter__NegativeSlippage(uint256 amount, uint256 minAmount);
|
|||||||
error TychoRouter__AmountInNotFullySpent(uint256 leftoverAmount);
|
error TychoRouter__AmountInNotFullySpent(uint256 leftoverAmount);
|
||||||
error TychoRouter__MessageValueMismatch(uint256 value, uint256 amount);
|
error TychoRouter__MessageValueMismatch(uint256 value, uint256 amount);
|
||||||
|
|
||||||
contract TychoRouter is
|
contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
|
||||||
AccessControl,
|
|
||||||
Dispatcher,
|
|
||||||
Pausable,
|
|
||||||
ReentrancyGuard,
|
|
||||||
SafeCallback
|
|
||||||
{
|
|
||||||
IAllowanceTransfer public immutable permit2;
|
IAllowanceTransfer public immutable permit2;
|
||||||
IWETH private immutable _weth;
|
IWETH private immutable _weth;
|
||||||
|
|
||||||
@@ -63,9 +56,7 @@ contract TychoRouter is
|
|||||||
);
|
);
|
||||||
event FeeSet(uint256 indexed oldFee, uint256 indexed newFee);
|
event FeeSet(uint256 indexed oldFee, uint256 indexed newFee);
|
||||||
|
|
||||||
constructor(IPoolManager _poolManager, address _permit2, address weth)
|
constructor(address _permit2, address weth) {
|
||||||
SafeCallback(_poolManager)
|
|
||||||
{
|
|
||||||
if (_permit2 == address(0) || weth == address(0)) {
|
if (_permit2 == address(0) || weth == address(0)) {
|
||||||
revert TychoRouter__AddressZero();
|
revert TychoRouter__AddressZero();
|
||||||
}
|
}
|
||||||
@@ -380,9 +371,8 @@ contract TychoRouter is
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function _unlockCallback(bytes calldata data)
|
function unlockCallback(bytes calldata data)
|
||||||
internal
|
external
|
||||||
override
|
|
||||||
returns (bytes memory)
|
returns (bytes memory)
|
||||||
{
|
{
|
||||||
require(data.length >= 20, "Invalid data length");
|
require(data.length >= 20, "Invalid data length");
|
||||||
|
|||||||
@@ -821,7 +821,7 @@ contract TychoRouterTest is TychoRouterTestSetup {
|
|||||||
// add executor and selector for callback
|
// add executor and selector for callback
|
||||||
bytes memory protocolDataWithCallBack = abi.encodePacked(
|
bytes memory protocolDataWithCallBack = abi.encodePacked(
|
||||||
protocolData,
|
protocolData,
|
||||||
SafeCallback.unlockCallback.selector,
|
TychoRouter.unlockCallback.selector,
|
||||||
address(usv4Executor)
|
address(usv4Executor)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -12,9 +12,7 @@ import {WETH} from "../lib/permit2/lib/solmate/src/tokens/WETH.sol";
|
|||||||
import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol";
|
import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol";
|
||||||
|
|
||||||
contract TychoRouterExposed is TychoRouter {
|
contract TychoRouterExposed is TychoRouter {
|
||||||
constructor(IPoolManager _poolManager, address _permit2, address weth)
|
constructor(address _permit2, address weth) TychoRouter(_permit2, weth) {}
|
||||||
TychoRouter(_poolManager, _permit2, weth)
|
|
||||||
{}
|
|
||||||
|
|
||||||
function wrapETH(uint256 amount) external payable {
|
function wrapETH(uint256 amount) external payable {
|
||||||
return _wrapETH(amount);
|
return _wrapETH(amount);
|
||||||
@@ -50,8 +48,7 @@ contract TychoRouterTestSetup is Test, Constants {
|
|||||||
address factoryV3 = USV3_FACTORY;
|
address factoryV3 = USV3_FACTORY;
|
||||||
address poolManagerAddress = 0x000000000004444c5dc75cB358380D2e3dE08A90;
|
address poolManagerAddress = 0x000000000004444c5dc75cB358380D2e3dE08A90;
|
||||||
IPoolManager poolManager = IPoolManager(poolManagerAddress);
|
IPoolManager poolManager = IPoolManager(poolManagerAddress);
|
||||||
tychoRouter =
|
tychoRouter = new TychoRouterExposed(permit2Address, WETH_ADDR);
|
||||||
new TychoRouterExposed(poolManager, permit2Address, WETH_ADDR);
|
|
||||||
tychoRouterAddr = address(tychoRouter);
|
tychoRouterAddr = address(tychoRouter);
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user