|
1 | | -import { HardhatRuntimeEnvironment } from "hardhat/types"; |
2 | | -import { DeployFunction } from "hardhat-deploy/types"; |
| 1 | +import { artifacts, deployScript } from "../rocketh/deploy.js"; |
3 | 2 |
|
4 | 3 | /** |
5 | | - * Deploys a contract named "YourContract" using the deployer account and |
6 | | - * constructor arguments set to the deployer address |
| 4 | + * Deploys a contract named "Voting" using the deployer account. |
7 | 5 | * |
8 | | - * @param hre HardhatRuntimeEnvironment object. |
| 6 | + * On localhost, the deployer account is the one that comes with Hardhat, which is already funded. |
| 7 | + * |
| 8 | + * When deploying to live networks (e.g `yarn deploy --network sepolia`), the deployer account |
| 9 | + * should have sufficient balance to pay for the gas fees for contract creation. |
| 10 | + * |
| 11 | + * You can generate a random account with `yarn generate` or `yarn account:import` to import your |
| 12 | + * existing PK which will fill DEPLOYER_PRIVATE_KEY_ENCRYPTED in the .env file (used in hardhat.config.ts). |
| 13 | + * Run `yarn account` to check the deployer balance on every network. |
9 | 14 | */ |
10 | | -const deployYourVotingContract: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { |
11 | | - /* |
12 | | - On localhost, the deployer account is the one that comes with Hardhat, which is already funded. |
13 | | -
|
14 | | - When deploying to live networks (e.g `yarn deploy --network sepolia`), the deployer account |
15 | | - should have sufficient balance to pay for the gas fees for contract creation. |
16 | | -
|
17 | | - You can generate a random account with `yarn generate` or `yarn account:import` to import your |
18 | | - existing PK which will fill DEPLOYER_PRIVATE_KEY_ENCRYPTED in the .env file (then used on hardhat.config.ts) |
19 | | - You can run the `yarn account` command to check your balance in every network. |
20 | | - */ |
21 | | - const { deployer } = await hre.getNamedAccounts(); |
22 | | - const { deploy } = hre.deployments; |
| 15 | +export default deployScript( |
| 16 | + async ({ deploy, namedAccounts }) => { |
| 17 | + const { deployer } = namedAccounts; |
23 | 18 |
|
24 | | - const ownerAddress = "0x0000000000000000000000000000000000000001"; |
| 19 | + const ownerAddress = "0x0000000000000000000000000000000000000001"; |
25 | 20 |
|
26 | | - /// checkpoint 6 ////// |
27 | | - const verifierAddress = "0x0000000000000000000000000000000000000002"; // placeholder |
28 | | - // const verifier = await deploy("HonkVerifier", { |
29 | | - // from: deployer, |
30 | | - // log: true, |
31 | | - // autoMine: true, |
32 | | - // }); |
33 | | - |
34 | | - /// checkpoint 2 ////// |
35 | | - const leanIMTAddress = "0x0000000000000000000000000000000000000003"; // placeholder |
36 | | - // const poseidon3 = await deploy("PoseidonT3", { |
37 | | - // from: deployer, |
38 | | - // log: true, |
39 | | - // autoMine: true, |
40 | | - // }); |
41 | | - |
42 | | - // const leanIMT = await deploy("LeanIMT", { |
43 | | - // from: deployer, |
44 | | - // log: true, |
45 | | - // autoMine: true, |
46 | | - // libraries: { |
47 | | - // PoseidonT3: poseidon3.address, |
48 | | - // }, |
49 | | - // }); |
50 | | - |
51 | | - await deploy("Voting", { |
52 | | - from: deployer, |
53 | | - // Contract constructor arguments |
54 | 21 | /// checkpoint 6 ////// |
55 | | - args: [ownerAddress, verifierAddress, "Should we build zk apps?"], |
56 | | - log: true, |
57 | | - // autoMine: can be passed to the deploy function to make the deployment process faster on local networks by |
58 | | - // automatically mining the contract deployment transaction. There is no effect on live networks. |
59 | | - autoMine: true, |
60 | | - libraries: { |
61 | | - /// checkpoint 2 ////// |
62 | | - LeanIMT: leanIMTAddress, |
63 | | - }, |
64 | | - }); |
65 | | -}; |
| 22 | + const verifierAddress = "0x0000000000000000000000000000000000000002"; // placeholder |
| 23 | + // const verifier = await deploy("HonkVerifier", { |
| 24 | + // account: deployer, |
| 25 | + // artifact: artifacts.HonkVerifier, |
| 26 | + // args: [], |
| 27 | + // }); |
| 28 | + |
| 29 | + /// checkpoint 2 ////// |
| 30 | + const leanIMTAddress = "0x0000000000000000000000000000000000000003"; // placeholder |
| 31 | + // const poseidon3 = await deploy("PoseidonT3", { |
| 32 | + // account: deployer, |
| 33 | + // artifact: artifacts.PoseidonT3, |
| 34 | + // args: [], |
| 35 | + // }); |
66 | 36 |
|
67 | | -export default deployYourVotingContract; |
| 37 | + // const leanIMT = await deploy( |
| 38 | + // "LeanIMT", |
| 39 | + // { |
| 40 | + // account: deployer, |
| 41 | + // artifact: artifacts.LeanIMT, |
| 42 | + // args: [], |
| 43 | + // }, |
| 44 | + // { |
| 45 | + // libraries: { |
| 46 | + // PoseidonT3: poseidon3.address, |
| 47 | + // }, |
| 48 | + // }, |
| 49 | + // ); |
68 | 50 |
|
69 | | -// Tags are useful if you have multiple deploy files and only want to run one of them. |
70 | | -// e.g. yarn deploy --tags YourContract |
71 | | -deployYourVotingContract.tags = ["YourVotingContract"]; |
| 51 | + await deploy( |
| 52 | + "Voting", |
| 53 | + { |
| 54 | + account: deployer, |
| 55 | + artifact: artifacts.Voting, |
| 56 | + args: [ownerAddress, verifierAddress, "Should we build zk apps?"], |
| 57 | + }, |
| 58 | + { |
| 59 | + libraries: { |
| 60 | + LeanIMT: leanIMTAddress, |
| 61 | + }, |
| 62 | + }, |
| 63 | + ); |
| 64 | + }, |
| 65 | + // Tags are useful if you have multiple deploy files and only want to run one of them. |
| 66 | + // e.g. yarn deploy --tags YourVotingContract |
| 67 | + { tags: ["YourVotingContract"] }, |
| 68 | +); |
0 commit comments