Skip to content

Commit

Permalink
🚀 change script for deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
thurendous committed Oct 7, 2023
1 parent 8e7f304 commit 8e2c877
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
19 changes: 12 additions & 7 deletions script/DeployContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 8e2c877

Please sign in to comment.