38 lines
1.5 KiB
Solidity
38 lines
1.5 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {Script, console} from "forge-std/Script.sol";
|
|
import {UniswapV3ExternalUnwinder} from "../../contracts/flash/UniswapV3ExternalUnwinder.sol";
|
|
|
|
/**
|
|
* @title DeployUniswapV3ExternalUnwinder
|
|
* @notice Deploy UniswapV3ExternalUnwinder for quote-push unwind legs (cW* -> USDC on V3).
|
|
*
|
|
* Env:
|
|
* PRIVATE_KEY required
|
|
* UNISWAP_V3_SWAP_ROUTER_MAINNET optional; defaults to legacy SwapRouter `0xE592...` on Ethereum mainnet
|
|
*
|
|
* Usage:
|
|
* forge script script/deploy/DeployUniswapV3ExternalUnwinder.s.sol:DeployUniswapV3ExternalUnwinder \
|
|
* --rpc-url $ETHEREUM_MAINNET_RPC --broadcast -vvvv
|
|
*/
|
|
contract DeployUniswapV3ExternalUnwinder is Script {
|
|
/// @dev SwapRouter02 (`0x68b3…`) is multicall-based and does not expose the legacy `exactInputSingle` ABI used by `UniswapV3ExternalUnwinder`.
|
|
address internal constant DEFAULT_UNISWAP_V3_ROUTER_MAINNET = 0xE592427A0AEce92De3Edee1F18E0157C05861564;
|
|
|
|
function run() external {
|
|
uint256 pk = vm.envUint("PRIVATE_KEY");
|
|
address router = vm.envOr("UNISWAP_V3_SWAP_ROUTER_MAINNET", DEFAULT_UNISWAP_V3_ROUTER_MAINNET);
|
|
address deployer = vm.addr(pk);
|
|
|
|
console.log("Deployer:", deployer);
|
|
console.log("Uniswap V3 router:", router);
|
|
|
|
vm.startBroadcast(pk);
|
|
UniswapV3ExternalUnwinder unwinder = new UniswapV3ExternalUnwinder(router);
|
|
vm.stopBroadcast();
|
|
|
|
console.log("UniswapV3ExternalUnwinder:", address(unwinder));
|
|
}
|
|
}
|