|
| 1 | +import { buildModule } from "@nomicfoundation/hardhat-ignition/modules"; |
| 2 | +import ProposalTemplatesProxyModule from "./ProposalTemplatesProxy"; |
| 3 | +import VotesBookKeeperModule from "./VotesBookKeeper"; |
| 4 | + |
| 5 | +// npx hardhat ignition deploy ./ignition/modules/Governance.ts --network mainnet --deployment-id governance --parameters ignition/params.json |
| 6 | + |
| 7 | + |
| 8 | +export default buildModule("GovernanceModule", (m) => { |
| 9 | + const { proposalTemplatesProxy } = m.useModule(ProposalTemplatesProxyModule); |
| 10 | + const { votesBookKeeper } = m.useModule(VotesBookKeeperModule); |
| 11 | + const owner = m.getParameter('owner'); |
| 12 | + |
| 13 | + const governance = m.contract("Governance", [], { |
| 14 | + proxy: { |
| 15 | + methodName: "initialize", |
| 16 | + args: [owner], |
| 17 | + kind: "uups", // or "transparent" if using Transparent Proxy |
| 18 | + }, |
| 19 | + }); |
| 20 | + |
| 21 | + // initialize votesBookKeeper |
| 22 | + const maxProposalsPerVoter = m.getParameter('maxProposalsPerVoter'); |
| 23 | + m.call(votesBookKeeper, 'initialize', [owner, governance, maxProposalsPerVoter]) |
| 24 | + |
| 25 | + // initialize governance |
| 26 | + const governableContract = m.getParameter('sfcContract'); |
| 27 | + m.call(governance, 'initialize', [governableContract, proposalTemplatesProxy, votesBookKeeper]) |
| 28 | + |
| 29 | + // const networkProposalFactory = m.contract("NetworkParameterProposalFactory", |
| 30 | + // [governance],); |
| 31 | + |
| 32 | + const plainTextProposalFactory = m.contract("PlainTextProposalFactory", [governance]); |
| 33 | + const slashingRefundProposalFactory = m.contract("SlashingRefundProposalFactory", [governance, governableContract]); |
| 34 | + |
| 35 | + |
| 36 | + return { proposalTemplatesProxy, votesBookKeeper, governance, plainTextProposalFactory, slashingRefundProposalFactory }; |
| 37 | +}); |
| 38 | + |
0 commit comments