Skip to content

Commit

Permalink
deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
thrilok209 committed Jul 30, 2024
1 parent d1b83f1 commit a5531a5
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 4 deletions.
60 changes: 56 additions & 4 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function createConfig(network: string) {

function getNetworkUrl(networkType: string) {
if (networkType === "avalanche")
return "https://api.avax.network/ext/bc/C/rpc";
return "https://avalanche.drpc.org";
else if (networkType === "polygon")
return `https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_ID}`;
else if (networkType === "arbitrum")
Expand Down Expand Up @@ -85,9 +85,33 @@ const config = {
},
kovan: createConfig("kovan"),
mainnet: createConfig("mainnet"),
matic: createConfig("polygon"),
avax: createConfig("avalanche"),
polygon: createConfig("polygon"),
avalanche: {
url: "https://avalanche.drpc.org",
accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic },
timeout: 150000,
},
arbitrum: createConfig("arbitrum"),
optimism: {
url: "https://rpc.ankr.com/optimism",
accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic },
timeout: 150000,
},
base: {
url: "https://rpc.ankr.com/base",
accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic },
timeout: 150000,
},
scroll: {
url: "https://rpc.ankr.com/scroll",
accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic },
timeout: 150000,
},
gnosis: {
url: "https://rpc.ankr.com/gnosis",
accounts: !!PRIVATE_KEY ? [`0x${PRIVATE_KEY}`] : { mnemonic },
timeout: 150000,
}
},
solidity: {
compilers: [
Expand Down Expand Up @@ -118,7 +142,35 @@ const config = {
tests: "./test",
},
etherscan: {
apiKey: process.env.ETHERSCAN,
apiKey: {
mainnet: process.env.ETHERSCAN_API_KEY || "",
polygon: process.env.POLYGONSCAN_API_KEY || "",
arbitrumOne: process.env.ARBITRUM_API_KEY || "",
optimisticEthereum: process.env.OPTIMISIM_API_KEY || "",
base: process.env.BASE_API_KEY || "",
avalanche: process.env.SNOWTRACE_API_KEY || "",
scroll: process.env.SCROLL_API_KEY || "",
xdai: process.env.GNOSIS_API_KEY || "",
gnosis: process.env.GNOSIS_API_KEY || "",
},
customChains: [
{
network: "base",
chainId: 8453,
urls: {
apiURL: "https://api.basescan.org/api",
browserURL: "https://basescan.org/",
},
},
{
network: "scroll",
chainId: 534352,
urls: {
apiURL: "https://api.scrollscan.com/api",
browserURL: "https://scrollscan.com/",
},
},
],
},
typechain: {
outDir: "typechain",
Expand Down
2 changes: 2 additions & 0 deletions scripts/constant/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ export default {
polygon: "0xA9B99766E6C676Cf1975c0D3166F96C0848fF5ad",
arbitrum: "0x1eE00C305C51Ff3bE60162456A9B533C07cD9288",
avalanche: "0x6CE3e607C808b4f4C26B7F6aDAeB619e49CAbb25",
base: "0x6CE3e607C808b4f4C26B7F6aDAeB619e49CAbb25",
optimism: "0x6CE3e607C808b4f4C26B7F6aDAeB619e49CAbb25"
},
};
27 changes: 27 additions & 0 deletions scripts/deployDefaultImplmplementation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import hre from "hardhat";
import addresses from "./constant/addresses";
import instaDeployContract from "./deployContract";

async function main() {
const INSTA_INDEX = addresses.InstaIndex[hre.network.name];
const instaAccountV2DefaultImpl = await instaDeployContract(
"InstaDefaultImplementation",
[INSTA_INDEX]
);

if (hre.network.name !== "hardhat") {
await hre.run("verify:verify", {
address: instaAccountV2DefaultImpl.address,
constructorArguments: [INSTA_INDEX],
});
} else {
console.log(`Contracts deployed to ${hre.network.name}`);
}
}

main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});

0 comments on commit a5531a5

Please sign in to comment.