proposal-47/scripts/deploy.js

57 lines
2.3 KiB
JavaScript
Raw Normal View History

2024-01-31 15:04:44 +03:00
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// You can also run a script with `npx hardhat run <script>`. If you do that, Hardhat
// will compile your contracts, add the Hardhat Runtime Environment's members to the
// global scope, and execute the script.
const hre = require("hardhat");
const { ethers } = require("hardhat");
async function main() {
2024-02-10 21:43:54 +03:00
const airdropRecipients = [...require("../data/airdropRecipients.json")];
const recipientsFactory = await ethers.getContractFactory("AirdropRecipients");
const airdropRecipientsContract = await recipientsFactory.deploy(airdropRecipients);
const recipientStorageAddr = await airdropRecipientsContract.getAddress();
let tx = airdropRecipientsContract.deploymentTransaction();
await tx.wait(16);
console.log("Aidrop recipients contract confirmed with 16 blocks, waiting for verification on Etherscan");
await hre.run("verify:verify", {
address: recipientStorageAddr,
contract: "contracts/AirdropRecipients.sol:AirdropRecipients",
constructorArguments: [airdropRecipients],
});
2024-01-31 15:04:44 +03:00
const airdropFactory = await ethers.getContractFactory("SablierAirdrop");
const airdrop = await airdropFactory.deploy();
const airdropAddr = await airdrop.getAddress();
2024-02-10 21:43:54 +03:00
tx = airdrop.deploymentTransaction();
2024-01-31 15:04:44 +03:00
await tx.wait(16);
console.log("Aidrop deployment confirmed with 16 blocks, waiting for verification on Etherscan");
await hre.run("verify:verify", {
2024-02-10 21:43:54 +03:00
address: airdropAddr,
2024-01-31 15:04:44 +03:00
contract: "contracts/Airdrop.sol:SablierAirdrop",
});
const proposalFactory = await ethers.getContractFactory("Proposal");
2024-02-10 21:43:54 +03:00
const proposal = await proposalFactory.deploy(airdropAddr, recipientStorageAddr);
2024-01-31 15:04:44 +03:00
const deployedProposalAddr = await proposal.getAddress();
2024-02-10 21:43:54 +03:00
tx = proposal.deploymentTransaction();
await tx.wait(16);
console.log("Proposal deployment confirmed with 16 blocks, waiting for verification on Etherscan");
2024-01-31 15:04:44 +03:00
await hre.run("verify:verify", {
2024-02-10 21:43:54 +03:00
address: deployedProposalAddr,
2024-01-31 15:04:44 +03:00
contract: "contracts/Proposal.sol:Proposal",
2024-02-10 21:43:54 +03:00
constructorArguments: [airdropAddr, recipientStorageAddr],
2024-01-31 15:04:44 +03:00
});
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
2024-02-10 21:43:54 +03:00
});