Skip to content

Commit a5bbc92

Browse files
committed
Add ignition scripts
1 parent 750cb3f commit a5bbc92

7 files changed

Lines changed: 89 additions & 43 deletions

File tree

contracts/ERC1967Proxy.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity ^0.8.27;
3+
4+
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";

contracts/governance/StatusConstants.sol

Lines changed: 0 additions & 43 deletions
This file was deleted.

ignition/modules/Governance.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
2+
3+
// npx hardhat ignition deploy ./ignition/modules/ProposalTemplates.ts --network testnet --deployment-id proposal-templates
4+
5+
export default buildModule("ProposalTemplatesModule", (m) => {
6+
const proposalTemplates = m.contract("ProposalTemplates");
7+
return { proposalTemplates };
8+
});
9+
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import {buildModule} from "@nomicfoundation/hardhat-ignition/modules";
2+
import proposalTemplatesModule from "./ProposalTemplates";
3+
4+
// npx hardhat ignition deploy ./ignition/modules/ProposalTemplatesProxy.ts --network testnet --deployment-id proposal-templates-proxy --parameters ignition/params.json
5+
6+
export default buildModule("ProposalTemplatesProxyModule", (m) => {
7+
const { proposalTemplates } = m.useModule(proposalTemplatesModule);
8+
9+
const owner = m.getParameter('owner');
10+
11+
const proposalTemplatesProxy = m.contract('ERC1967Proxy', [
12+
proposalTemplates,
13+
m.encodeFunctionCall(proposalTemplates, 'initialize', [owner]),
14+
]);
15+
16+
return { proposalTemplatesProxy };
17+
});
18+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
2+
3+
// npx hardhat ignition verify votesbook-keeper
4+
5+
6+
export default buildModule("VotesBookKeeperModule", (m) => {
7+
const votesBookKeeper = m.contract("VotesBookKeeper");
8+
return { votesBookKeeper };
9+
});
10+

ignition/params.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"GovernanceModule": {
3+
"owner": "0x",
4+
"maxProposalsPerVoter": 4,
5+
"sfcContract": "0xfc00face00000000000000000000000000000000"
6+
},
7+
"ProposalTemplatesProxyModule": {
8+
"owner": "0x"
9+
}
10+
}

0 commit comments

Comments
 (0)