Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions contracts/ERC1967Proxy.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.27;

import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";

Check warning on line 4 in contracts/ERC1967Proxy.sol

View workflow job for this annotation

GitHub Actions / build

imported name ERC1967Proxy is not used
43 changes: 0 additions & 43 deletions contracts/governance/StatusConstants.sol

This file was deleted.

38 changes: 38 additions & 0 deletions ignition/modules/Governance.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
import ProposalTemplatesProxyModule from "./ProposalTemplatesProxy";
import VotesBookKeeperModule from "./VotesBookKeeper";

// npx hardhat ignition deploy ./ignition/modules/Governance.ts --network mainnet --deployment-id governance --parameters ignition/params.json


export default buildModule("GovernanceModule", (m) => {
const { proposalTemplatesProxy } = m.useModule(ProposalTemplatesProxyModule);
const { votesBookKeeper } = m.useModule(VotesBookKeeperModule);
const owner = m.getParameter('owner');

const governance = m.contract("Governance", [], {
proxy: {
methodName: "initialize",
args: [owner],
kind: "uups", // or "transparent" if using Transparent Proxy
},
});

// initialize votesBookKeeper
const maxProposalsPerVoter = m.getParameter('maxProposalsPerVoter');
m.call(votesBookKeeper, 'initialize', [owner, governance, maxProposalsPerVoter])

// initialize governance
const governableContract = m.getParameter('sfcContract');
m.call(governance, 'initialize', [governableContract, proposalTemplatesProxy, votesBookKeeper])

// const networkProposalFactory = m.contract("NetworkParameterProposalFactory",
// [governance],);

const plainTextProposalFactory = m.contract("PlainTextProposalFactory", [governance]);
const slashingRefundProposalFactory = m.contract("SlashingRefundProposalFactory", [governance, governableContract]);


return { proposalTemplatesProxy, votesBookKeeper, governance, plainTextProposalFactory, slashingRefundProposalFactory };
});

9 changes: 9 additions & 0 deletions ignition/modules/ProposalTemplates.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";

// npx hardhat ignition deploy ./ignition/modules/ProposalTemplates.ts --network testnet --deployment-id proposal-templates

export default buildModule("ProposalTemplatesModule", (m) => {
const proposalTemplates = m.contract("ProposalTemplates");
return { proposalTemplates };
});

18 changes: 18 additions & 0 deletions ignition/modules/ProposalTemplatesProxy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import {buildModule} from "@nomicfoundation/hardhat-ignition/modules";
import proposalTemplatesModule from "./ProposalTemplates";

// npx hardhat ignition deploy ./ignition/modules/ProposalTemplatesProxy.ts --network testnet --deployment-id proposal-templates-proxy --parameters ignition/params.json

export default buildModule("ProposalTemplatesProxyModule", (m) => {
const { proposalTemplates } = m.useModule(proposalTemplatesModule);

const owner = m.getParameter('owner');

const proposalTemplatesProxy = m.contract('ERC1967Proxy', [
proposalTemplates,
m.encodeFunctionCall(proposalTemplates, 'initialize', [owner]),
]);

return { proposalTemplatesProxy };
});

10 changes: 10 additions & 0 deletions ignition/modules/VotesBookKeeper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";

// npx hardhat ignition verify votesbook-keeper


export default buildModule("VotesBookKeeperModule", (m) => {
const votesBookKeeper = m.contract("VotesBookKeeper");
return { votesBookKeeper };
});

10 changes: 10 additions & 0 deletions ignition/params.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"GovernanceModule": {
"owner": "0x",
"maxProposalsPerVoter": 4,
"sfcContract": "0xfc00face00000000000000000000000000000000"
},
"ProposalTemplatesProxyModule": {
"owner": "0x"
}
}
Loading