chore: rm safecallback from router

This commit is contained in:
royvardhan
2025-02-15 01:06:23 +05:30
parent 9b8175aff9
commit 14e5c127c6
3 changed files with 7 additions and 20 deletions

View File

@@ -14,7 +14,6 @@ import "@permit2/src/interfaces/IAllowanceTransfer.sol";
import "./Dispatcher.sol";
import {LibSwap} from "../lib/LibSwap.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__AddressZero();
@@ -23,13 +22,7 @@ error TychoRouter__NegativeSlippage(uint256 amount, uint256 minAmount);
error TychoRouter__AmountInNotFullySpent(uint256 leftoverAmount);
error TychoRouter__MessageValueMismatch(uint256 value, uint256 amount);
contract TychoRouter is
AccessControl,
Dispatcher,
Pausable,
ReentrancyGuard,
SafeCallback
{
contract TychoRouter is AccessControl, Dispatcher, Pausable, ReentrancyGuard {
IAllowanceTransfer public immutable permit2;
IWETH private immutable _weth;
@@ -63,9 +56,7 @@ contract TychoRouter is
);
event FeeSet(uint256 indexed oldFee, uint256 indexed newFee);
constructor(IPoolManager _poolManager, address _permit2, address weth)
SafeCallback(_poolManager)
{
constructor(address _permit2, address weth) {
if (_permit2 == address(0) || weth == address(0)) {
revert TychoRouter__AddressZero();
}
@@ -380,9 +371,8 @@ contract TychoRouter is
);
}
function _unlockCallback(bytes calldata data)
internal
override
function unlockCallback(bytes calldata data)
external
returns (bytes memory)
{
require(data.length >= 20, "Invalid data length");

View File

@@ -821,7 +821,7 @@ contract TychoRouterTest is TychoRouterTestSetup {
// add executor and selector for callback
bytes memory protocolDataWithCallBack = abi.encodePacked(
protocolData,
SafeCallback.unlockCallback.selector,
TychoRouter.unlockCallback.selector,
address(usv4Executor)
);

View File

@@ -12,9 +12,7 @@ import {WETH} from "../lib/permit2/lib/solmate/src/tokens/WETH.sol";
import {PoolManager} from "@uniswap/v4-core/src/PoolManager.sol";
contract TychoRouterExposed is TychoRouter {
constructor(IPoolManager _poolManager, address _permit2, address weth)
TychoRouter(_poolManager, _permit2, weth)
{}
constructor(address _permit2, address weth) TychoRouter(_permit2, weth) {}
function wrapETH(uint256 amount) external payable {
return _wrapETH(amount);
@@ -50,8 +48,7 @@ contract TychoRouterTestSetup is Test, Constants {
address factoryV3 = USV3_FACTORY;
address poolManagerAddress = 0x000000000004444c5dc75cB358380D2e3dE08A90;
IPoolManager poolManager = IPoolManager(poolManagerAddress);
tychoRouter =
new TychoRouterExposed(poolManager, permit2Address, WETH_ADDR);
tychoRouter = new TychoRouterExposed(permit2Address, WETH_ADDR);
tychoRouterAddr = address(tychoRouter);
tychoRouter.grantRole(keccak256("FUND_RESCUER_ROLE"), FUND_RESCUER);
tychoRouter.grantRole(keccak256("FEE_SETTER_ROLE"), FEE_SETTER);