From d637380c55d79bcbbfa4cb287a3081432e0996a1 Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Tue, 9 Apr 2024 16:12:06 -0400 Subject: [PATCH 1/6] Add remappings and deploy script for MixedRouteQuoterV1 --- .gitignore | 4 +++- foundry.toml | 8 ++++++++ remappings.txt | 13 +++++++++++++ script/DeployMixedRouteQuoterV1.s.sol | 23 +++++++++++++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 foundry.toml create mode 100644 remappings.txt create mode 100644 script/DeployMixedRouteQuoterV1.s.sol diff --git a/.gitignore b/.gitignore index bde9d136..b693ba64 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ crytic-export/ node_modules/ typechain/ .env -.vscode \ No newline at end of file +.vscode + +out/ \ No newline at end of file diff --git a/foundry.toml b/foundry.toml new file mode 100644 index 00000000..95b0a640 --- /dev/null +++ b/foundry.toml @@ -0,0 +1,8 @@ +[profile.default] +src = 'contracts' +out = 'out' +bytecode_hash = "none" +libs = ["lib"] + +[etherscan] +etherscan_api_key = {key = "JF2T2N2MHGV7XUXPDDYEWEEMZEJGP7QWUF", chain = 8453, url = "https://api.basescan.org/api/" } diff --git a/remappings.txt b/remappings.txt new file mode 100644 index 00000000..99be05ad --- /dev/null +++ b/remappings.txt @@ -0,0 +1,13 @@ +@ensdomains/=node_modules/@ensdomains/ +@openzeppelin/=node_modules/@openzeppelin/ +@solidity-parser/=node_modules/solhint/node_modules/@solidity-parser/ +@uniswap/=node_modules/@uniswap/ +@uniswap/swap-router-contracts/=contracts/ +base64-sol/=node_modules/base64-sol/ +hardhat/=node_modules/hardhat/ +base/=contracts/base/ +interfaces/=contracts/interfaces/ +lens/=contracts/lens/ +libraries/=contracts/libraries/ +test/=contracts/test/ +forge-std/=lib/forge-std/src/ \ No newline at end of file diff --git a/script/DeployMixedRouteQuoterV1.s.sol b/script/DeployMixedRouteQuoterV1.s.sol new file mode 100644 index 00000000..b644c6e4 --- /dev/null +++ b/script/DeployMixedRouteQuoterV1.s.sol @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +pragma solidity =0.7.6; + +import "forge-std/console2.sol"; +import "forge-std/Script.sol"; +import {MixedRouteQuoterV1} from "contracts/lens/MixedRouteQuoterV1.sol"; + +contract DeployMixedRouteQuoterV1 is Script { + address constant V3_FACTORY = 0x33128a8fC17869897dcE68Ed026d694621f6FDfD; + address constant V2_FACTORY = 0x8909dc15e40173ff4699343b6eb8132c65e18ec6; + address constant WETH9 = 0x4200000000000000000000000000000000000006; + + function setUp() public {} + + function run() public returns (MixedRouteQuoterV1 mixedRouteQuoterV1) { + vm.startBroadcast(); + + mixedRouteQuoterV1 = new MixedRouteQuoterV1{salt: 0x00}(V3_FACTORY, V2_FACTORY, WETH9); + console2.log("MixedRouteQuoterV1 deployed at", address(mixedRouteQuoterV1)); + + vm.stopBroadcast(); + } +} \ No newline at end of file From 98ce51e515a99e9dd15be1a806cb2cd41eacfed5 Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Tue, 9 Apr 2024 16:12:55 -0400 Subject: [PATCH 2/6] forge install: forge-std v1.8.1 --- .gitmodules | 3 +++ lib/forge-std | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 lib/forge-std diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..888d42dc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "lib/forge-std"] + path = lib/forge-std + url = https://github.com/foundry-rs/forge-std diff --git a/lib/forge-std b/lib/forge-std new file mode 160000 index 00000000..bb4ceea9 --- /dev/null +++ b/lib/forge-std @@ -0,0 +1 @@ +Subproject commit bb4ceea94d6f10eeb5b41dc2391c6c8bf8e734ef From 0995193d1f517786497ab6a8ca4707e0091fc308 Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Tue, 9 Apr 2024 16:21:52 -0400 Subject: [PATCH 3/6] Add optimizer runs and fix script --- .gitignore | 1 + foundry.toml | 1 + script/DeployMixedRouteQuoterV1.s.sol | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b693ba64..01aedb22 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ typechain/ .env .vscode +broadcast/ out/ \ No newline at end of file diff --git a/foundry.toml b/foundry.toml index 95b0a640..39deaa13 100644 --- a/foundry.toml +++ b/foundry.toml @@ -3,6 +3,7 @@ src = 'contracts' out = 'out' bytecode_hash = "none" libs = ["lib"] +optimizer_runs = 1000000 [etherscan] etherscan_api_key = {key = "JF2T2N2MHGV7XUXPDDYEWEEMZEJGP7QWUF", chain = 8453, url = "https://api.basescan.org/api/" } diff --git a/script/DeployMixedRouteQuoterV1.s.sol b/script/DeployMixedRouteQuoterV1.s.sol index b644c6e4..f309855f 100644 --- a/script/DeployMixedRouteQuoterV1.s.sol +++ b/script/DeployMixedRouteQuoterV1.s.sol @@ -7,7 +7,7 @@ import {MixedRouteQuoterV1} from "contracts/lens/MixedRouteQuoterV1.sol"; contract DeployMixedRouteQuoterV1 is Script { address constant V3_FACTORY = 0x33128a8fC17869897dcE68Ed026d694621f6FDfD; - address constant V2_FACTORY = 0x8909dc15e40173ff4699343b6eb8132c65e18ec6; + address constant V2_FACTORY = 0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6; address constant WETH9 = 0x4200000000000000000000000000000000000006; function setUp() public {} From 2f03e92a4b128bade140114f729ee5b83bba5ff5 Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Tue, 9 Apr 2024 16:22:53 -0400 Subject: [PATCH 4/6] fix toml --- foundry.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/foundry.toml b/foundry.toml index 39deaa13..6b51da2d 100644 --- a/foundry.toml +++ b/foundry.toml @@ -4,6 +4,3 @@ out = 'out' bytecode_hash = "none" libs = ["lib"] optimizer_runs = 1000000 - -[etherscan] -etherscan_api_key = {key = "JF2T2N2MHGV7XUXPDDYEWEEMZEJGP7QWUF", chain = 8453, url = "https://api.basescan.org/api/" } From 59d605fb92350c1c3e0d6a29b499245f409ff255 Mon Sep 17 00:00:00 2001 From: Eric Zhong Date: Tue, 9 Apr 2024 16:26:33 -0400 Subject: [PATCH 5/6] move addresses into env vars instead of constants --- script/DeployMixedRouteQuoterV1.s.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/script/DeployMixedRouteQuoterV1.s.sol b/script/DeployMixedRouteQuoterV1.s.sol index f309855f..96479f5b 100644 --- a/script/DeployMixedRouteQuoterV1.s.sol +++ b/script/DeployMixedRouteQuoterV1.s.sol @@ -6,13 +6,13 @@ import "forge-std/Script.sol"; import {MixedRouteQuoterV1} from "contracts/lens/MixedRouteQuoterV1.sol"; contract DeployMixedRouteQuoterV1 is Script { - address constant V3_FACTORY = 0x33128a8fC17869897dcE68Ed026d694621f6FDfD; - address constant V2_FACTORY = 0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6; - address constant WETH9 = 0x4200000000000000000000000000000000000006; - function setUp() public {} function run() public returns (MixedRouteQuoterV1 mixedRouteQuoterV1) { + address V3_FACTORY = vm.envAddress("FOUNDRY_MIXEDROUTE_QUOTER_DEPLOY_V3_FACTORY"); + address V2_FACTORY = vm.envAddress("FOUNDRY_MIXEDROUTE_QUOTER_DEPLOY_V2_FACTORY"); + address WETH9 = vm.envAddress("FOUNDRY_MIXEDROUTE_QUOTER_DEPLOY_WETH9"); + vm.startBroadcast(); mixedRouteQuoterV1 = new MixedRouteQuoterV1{salt: 0x00}(V3_FACTORY, V2_FACTORY, WETH9); From 7ae8cfd7eeb6b106a91c24a35981b5e8ac52db81 Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 9 Apr 2024 20:27:38 +0000 Subject: [PATCH 6/6] Fix code style issues with Prettier --- script/DeployMixedRouteQuoterV1.s.sol | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/script/DeployMixedRouteQuoterV1.s.sol b/script/DeployMixedRouteQuoterV1.s.sol index 96479f5b..f5408c3f 100644 --- a/script/DeployMixedRouteQuoterV1.s.sol +++ b/script/DeployMixedRouteQuoterV1.s.sol @@ -1,23 +1,23 @@ // SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.7.6; -import "forge-std/console2.sol"; -import "forge-std/Script.sol"; -import {MixedRouteQuoterV1} from "contracts/lens/MixedRouteQuoterV1.sol"; +import 'forge-std/console2.sol'; +import 'forge-std/Script.sol'; +import {MixedRouteQuoterV1} from 'contracts/lens/MixedRouteQuoterV1.sol'; contract DeployMixedRouteQuoterV1 is Script { function setUp() public {} function run() public returns (MixedRouteQuoterV1 mixedRouteQuoterV1) { - address V3_FACTORY = vm.envAddress("FOUNDRY_MIXEDROUTE_QUOTER_DEPLOY_V3_FACTORY"); - address V2_FACTORY = vm.envAddress("FOUNDRY_MIXEDROUTE_QUOTER_DEPLOY_V2_FACTORY"); - address WETH9 = vm.envAddress("FOUNDRY_MIXEDROUTE_QUOTER_DEPLOY_WETH9"); + address V3_FACTORY = vm.envAddress('FOUNDRY_MIXEDROUTE_QUOTER_DEPLOY_V3_FACTORY'); + address V2_FACTORY = vm.envAddress('FOUNDRY_MIXEDROUTE_QUOTER_DEPLOY_V2_FACTORY'); + address WETH9 = vm.envAddress('FOUNDRY_MIXEDROUTE_QUOTER_DEPLOY_WETH9'); vm.startBroadcast(); mixedRouteQuoterV1 = new MixedRouteQuoterV1{salt: 0x00}(V3_FACTORY, V2_FACTORY, WETH9); - console2.log("MixedRouteQuoterV1 deployed at", address(mixedRouteQuoterV1)); + console2.log('MixedRouteQuoterV1 deployed at', address(mixedRouteQuoterV1)); vm.stopBroadcast(); } -} \ No newline at end of file +}