57 lines
2.3 KiB
JavaScript
57 lines
2.3 KiB
JavaScript
// 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() {
|
|
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],
|
|
});
|
|
|
|
const airdropFactory = await ethers.getContractFactory("SablierAirdrop");
|
|
const airdrop = await airdropFactory.deploy();
|
|
const airdropAddr = await airdrop.getAddress();
|
|
|
|
tx = airdrop.deploymentTransaction();
|
|
await tx.wait(16);
|
|
console.log("Aidrop deployment confirmed with 16 blocks, waiting for verification on Etherscan");
|
|
await hre.run("verify:verify", {
|
|
address: airdropAddr,
|
|
contract: "contracts/Airdrop.sol:SablierAirdrop",
|
|
});
|
|
|
|
const proposalFactory = await ethers.getContractFactory("Proposal");
|
|
const proposal = await proposalFactory.deploy(airdropAddr, recipientStorageAddr);
|
|
const deployedProposalAddr = await proposal.getAddress();
|
|
|
|
tx = proposal.deploymentTransaction();
|
|
await tx.wait(16);
|
|
console.log("Proposal deployment confirmed with 16 blocks, waiting for verification on Etherscan");
|
|
await hre.run("verify:verify", {
|
|
address: deployedProposalAddr,
|
|
contract: "contracts/Proposal.sol:Proposal",
|
|
constructorArguments: [airdropAddr, recipientStorageAddr],
|
|
});
|
|
}
|
|
|
|
// 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;
|
|
});
|