forked from matter-labs-archive/create2-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuidler.config.js
35 lines (31 loc) · 1.23 KB
/
buidler.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
const fs = require("fs");
usePlugin("@nomiclabs/buidler-waffle");
task("deploy-create2", "Deploys contract with the given salt")
.addParam("salt", "CREATE2 salt argument")
.setAction(async (args) => {
const factoryAddress = JSON.parse(fs.readFileSync("factoryAddress.json")).factoryAddress;
const deployerFactory = await ethers.getContractFactory("Deployer");
const deployer = await deployerFactory.attach(factoryAddress);
const tx = await deployer.deployCreate2(args.salt);
const receipt = await tx.wait();
console.log("deployed address:", receipt.events[0].args);
});
task("create-deploy-factory", "Deploys create2 deployer")
.setAction(async () => {
const deployerFactory = await ethers.getContractFactory("Deployer");
const deployer = await deployerFactory.deploy();
await deployer.deployed();
fs.writeFileSync("factoryAddress.json",JSON.stringify({ factoryAddress: deployer.address }));
});
module.exports = {
defaultNetwork: "ropsten",
networks: {
ropsten: {
url: "https://ropsten.infura.io/v3/84842078b09946638c03157f83405213",
accounts: [process.env.ETH_PRIVATE_KEY],
}
},
solc: {
version: "0.6.8",
},
};