-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.js
38 lines (31 loc) · 1.47 KB
/
deploy.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
36
37
38
const {ethers, upgrades} = require('hardhat');
async function main() {
const [deployer] = await ethers.getSigners();
console.log('Deploying with a an upgradeable proxy pattern.');
console.log('============================================================');
console.log('DEPLOYER:');
console.log('Deploying contracts with the account: ', deployer.address);
console.log('Account balance: ', (await deployer.getBalance()).toString());
console.log('============================================================');
// deploy the token
const MyToken = await ethers.getContractFactory("MyToken");
const instanceToken = await upgrades.deployProxy(MyToken); // use the upgradeable patterns
await instanceToken.deployed();
console.log("MyToken Contract address:", instanceToken.address);
// then the NFT
const MyNFTContract = await ethers.getContractFactory("MyNFT");
const instanceNFT = await upgrades.deployProxy(MyNFTContract);
await instanceNFT.deployed();
console.log("MyNFT Contract address:", instanceNFT.address);
// now deploy the controller
const Controller = await ethers.getContractFactory("Controller");
const instanceController = await upgrades.deployProxy(Controller, [instanceNFT.address, instanceToken.address]);
await instanceController.deployed();
console.log("Controller Contract address:", instanceController.address);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});