Skip to content

Commit

Permalink
pretty migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Arvolear committed Mar 24, 2024
1 parent a5c984e commit d017353
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions deploy/1_setup.migration.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
import { ethers } from "hardhat";
import { Deployer } from "@solarity/hardhat-migrate";
import { Registration__factory, VotingFactory__factory, Voting__factory } from "@ethers-v6";
import { Deployer, Reporter } from "@solarity/hardhat-migrate";
import { Registration__factory, VotingFactory__factory, Voting__factory, VerifierMock__factory } from "@ethers-v6";

export = async (deployer: Deployer) => {
export = async (deployer: Deployer, reporter: Reporter) => {
const registration = await deployer.deploy(Registration__factory);
const votingFactory = await deployer.deploy(VotingFactory__factory);
const votingImpl = await deployer.deploy(Voting__factory);

const registationVerifier = ethers.hexlify(ethers.randomBytes(20));
const votingVerifier = ethers.hexlify(ethers.randomBytes(20));
const verifierMock = await deployer.deploy(VerifierMock__factory);

const icaoMasterTreeMerkleRoot = ethers.hexlify(ethers.randomBytes(32));

await registration.__Registration_init(80, registationVerifier, icaoMasterTreeMerkleRoot);
await registration.__Registration_init(80, await verifierMock.getAddress(), icaoMasterTreeMerkleRoot);
await votingFactory.__VotingFactory_init(
await registration.getAddress(),
await votingImpl.getAddress(),
votingVerifier,
await verifierMock.getAddress(),
);

Reporter.reportContracts(
["VotingFactory", `${await votingFactory.getAddress()}`],
["Registration", `${await registration.getAddress()}`],
);
};

0 comments on commit d017353

Please sign in to comment.