From 8e2c8770aec3da294791c2b01ebe5a0afdf07587 Mon Sep 17 00:00:00 2001 From: thurendous <thurendous2@gmail.com> Date: Sat, 7 Oct 2023 16:02:36 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=80=20change=20script=20for=20deployme?= =?UTF-8?q?nt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 2 +- Makefile | 4 ++++ script/DeployContracts.s.sol | 19 ++++++++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index 71d9b67..2d7fea9 100644 --- a/.env.example +++ b/.env.example @@ -1,7 +1,7 @@ PRIVATE_KEY= POLYSCAN_API_KEY= SEPOLIA_RPC_URL= -AVALANCHE_RPC_URL= +AVALANCHEFUJI_RPC_URL= # used in deployContracts.s.sol STADIUM_ADDRESS=0x1FBcd7D20155274DFD796343149D0FCA41338F14 diff --git a/Makefile b/Makefile index ade3121..7c8358e 100644 --- a/Makefile +++ b/Makefile @@ -42,6 +42,10 @@ ifeq ($(findstring --network sepolia,$(ARGS)),--network sepolia) endif ifeq ($(findstring --network avalanchefuji,$(ARGS)),--network avalanchefuji) + NETWORK_ARGS := --rpc-url $(AVALANCHEFUJI_RPC_URL) --private-key $(PRIVATE_KEY) --broadcast --verify --etherscan-api-key $(SNOWTRACE_API_KEY) -vvvv +endif + +ifeq ($(findstring --network avalanchemainnnet,$(ARGS)),--network avalanchemainnnet) NETWORK_ARGS := --rpc-url $(AVALANCHE_RPC_URL) --private-key $(PRIVATE_KEY) --broadcast --verify --etherscan-api-key $(SNOWTRACE_API_KEY) -vvvv endif diff --git a/script/DeployContracts.s.sol b/script/DeployContracts.s.sol index f52edc6..1f18f77 100644 --- a/script/DeployContracts.s.sol +++ b/script/DeployContracts.s.sol @@ -10,15 +10,19 @@ import {ProxyFactory} from "../src/ProxyFactory.sol"; import {HelperConfig} from "./HelperConfig.s.sol"; contract DeployContracts is Script { + // contract instance + ProxyFactory public proxyFactory; + // tokens' array to whitelist // satadium_address = 0x5aB0ffF1a51ee78F67247ac0B90C8c1f1f54c37F address[] public finalTokensToWhitelist; + address public avalancheStadiumAddress = vm.envAddress("MAINNET_STADIUM_ADDRESS"); // SPARKN STADDIUM address public stadiumAddress = vm.envAddress("STADIUM_ADDRESS"); // SPARKN STADDIUM address public factoryAdmin = vm.envAddress("SPARKN_DEV"); // SPARKN DEV address public jpycv1Address; address public jpycv2Address; address public usdcAddress; - address public usdtAddress; + // address public usdtAddress; uint256 public deployerKey; function run() external returns (ProxyFactory, Distributor, HelperConfig) { @@ -61,7 +65,11 @@ contract DeployContracts is Script { vm.startBroadcast(deployerKey); // prank // console.log("Deploying contracts...sender: ", msg.sender); - ProxyFactory proxyFactory = new ProxyFactory(finalTokensToWhitelist, stadiumAddress); + if (block.chainid == 43114 ) { + proxyFactory = new ProxyFactory(finalTokensToWhitelist, avalancheStadiumAddress); + } else { + proxyFactory = new ProxyFactory(finalTokensToWhitelist, stadiumAddress); + } // console.log("proxyFactory Owner: %s", proxyFactory.owner()); // console.log("address this: %s", address(this)); // console.log("address deployerKey: %s", deployerKey); @@ -76,12 +84,9 @@ contract DeployContracts is Script { // console.log("After transferring, proxyFactory Owner: %s", proxyFactory.owner()); // deploy distributor - implementation contract - // 5% as starting fee + // 5% as starting fee as constant value Distributor distributor = new Distributor(address(proxyFactory)); - // no need to deploy proxies in the beginning - // Proxy proxyA = proxyFactory.deployProxy(address(distributor)); - // Proxy proxyB = proxyFactory.deployProxy(address(distributor)); - // Proxy proxyC= proxyFactory.deployProxy(address(distributor)); + vm.stopBroadcast(); return (proxyFactory, distributor, config);