Skip to content

Commit a142afd

Browse files
authored
Merge pull request #2954 from IntersectMBO/develop
GovTool - v2.0.11-patch3
2 parents bd816f0 + aa7e279 commit a142afd

File tree

13 files changed

+733
-133
lines changed

13 files changed

+733
-133
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ changes.
1414

1515
- Add metadata url and hash to drep details [Issue 2911](https://github.com/IntersectMBO/govtool/issues/2911)
1616
- Add CC votes percentages, not voted and Ratification threshold
17+
- Add support for submitting all 7 governance action types [Issue 2258](https://github.com/IntersectMBO/govtool/issues/2258)
1718

1819
### Fixed
1920

@@ -25,6 +26,7 @@ changes.
2526

2627
- Change threshold visual representation in governance action votes
2728
- Resize governance action details columns
29+
- Update @intersect.mbo/pdf-ui to v0.6.0
2830

2931
### Removed
3032

docs/GOVERNANCE_ACTION_SUBMISSION.md

Lines changed: 85 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ interface GovernanceAction {
3333
references: [{ label: string; uri: string }];
3434
}
3535

36-
interface InfoProps {
37-
hash: string;
36+
type VotingAnchor = {
3837
url: string;
38+
hash: string;
3939
}
4040

41-
interface TreasuryProps {
42-
amount: string;
43-
hash: string;
41+
type InfoProps = VotingAnchor;
42+
43+
type TreasuryProps {
4444
withdrawals: { receivingAddress: string; amount: string }[];
45-
}
45+
} & VotingAnchor;
4646

4747
type ProtocolParamsUpdate = {
4848
adaPerUtxo: string;
@@ -77,14 +77,44 @@ type ProtocolParamsUpdate = {
7777
treasuryGrowthRate: UnitInterval;
7878
};
7979

80-
interface ProtocolParameterChangeProps {
80+
type ProtocolParameterChangeProps {
8181
prevGovernanceActionHash: string;
8282
prevGovernanceActionIndex: number;
83-
url: string;
84-
hash: string;
85-
8683
protocolParamsUpdate: Partial<ProtocolParamsUpdate>;
87-
}
84+
} & VotingAnchor;
85+
86+
type HardForkInitiationProps = {
87+
prevGovernanceActionHash: string;
88+
prevGovernanceActionIndex: number;
89+
major: number;
90+
minor: number;
91+
} & VotingAnchor;
92+
93+
type NewConstitutionProps = {
94+
prevGovernanceActionHash: string;
95+
prevGovernanceActionIndex: number;
96+
constitutionUrl: string;
97+
constitutionHash: string;
98+
scriptHash: string;
99+
} & VotingAnchor;
100+
101+
type UpdateCommitteeProps = {
102+
prevGovernanceActionHash?: string;
103+
prevGovernanceActionIndex?: number;
104+
quorumThreshold: QuorumThreshold;
105+
newCommittee?: CommitteeToAdd[];
106+
removeCommittee?: string[];
107+
} & VotingAnchor;
108+
109+
type CommitteeToAdd = {
110+
expiryEpoch: number;
111+
committee: string;
112+
};
113+
114+
type QuorumThreshold = {
115+
numerator: number;
116+
denominator: number;
117+
};
88118

89119
const createGovernanceActionJsonLD: (
90120
governanceAction: GovernanceAction
@@ -100,6 +130,22 @@ const buildTreasuryGovernanceAction: (
100130
treasuryProps: TreasuryProps
101131
) => Promise<VotingProposalBuilder | undefined>;
102132

133+
const buildProtocolParameterChangeGovernanceAction: (
134+
protocolParameterChangeProps: ProtocolParameterChangeProps
135+
) => Promise<VotingProposalBuilder | undefined>;
136+
137+
const buildHardForkInitiationGovernanceAction: (
138+
hardForkInitiationProps: HardForkInitiationProps
139+
) => Promise<VotingProposalBuilder | undefined>;
140+
141+
const buildNewConstitutionGovernanceAction: (
142+
newConstitutionProps: NewConstitutionProps
143+
) => Promise<VotingProposalBuilder | undefined>;
144+
145+
const buildUpdateCommitteeGovernanceAction: (
146+
updateCommitteeProps: UpdateCommitteeProps
147+
) => Promise<VotingProposalBuilder | undefined>;
148+
103149
const buildSignSubmitConwayCertTx: (params: {
104150
govActionBuilder: VotingProposalBuilder;
105151
type: "createGovAction";
@@ -165,44 +211,37 @@ const {
165211
buildNewInfoGovernanceAction,
166212
buildProtocolParameterChangeGovernanceAction,
167213
buildHardForkInitiationGovernanceAction,
214+
buildTreasuryGovernanceAction,
215+
buildNewConstitutionGovernanceAction,
216+
buildUpdateCommitteeGovernanceAction,
217+
buildNoConfidenceGovernanceAction,
168218
} = useCardano();
169219

170220
// Info Governance Action
171-
const govActionBuilder = await buildNewInfoGovernanceAction({ hash, url });
221+
let govActionBuilder = await buildNewInfoGovernanceAction({ hash, url });
172222

173-
// sign and submit the transaction
174-
await buildSignSubmitConwayCertTx({
175-
govActionBuilder,
176-
type: "createGovAction",
177-
});
223+
// And for the other type of governance actions:
178224

179-
// Treasury Governance Action
180-
const { buildTreasuryGovernanceAction } = useCardano();
225+
govActionBuilder = await buildNoConfidenceGovernanceAction({ hash, url });
181226

182227
// hash of the generated Governance Action metadata, url of the metadata, amount of the transaction, receiving address is the stake key address
183-
const govActionBuilder = await buildTreasuryGovernanceAction({
228+
govActionBuilder = await buildTreasuryGovernanceAction({
184229
hash,
185230
url,
186231
withdrawals: [{ amount, receivingAddress }],
187232
});
188233

189-
// Protocol Parameter Change Governance Action
190-
const { buildProtocolParameterChangeGovernanceAction } = useCardano();
191-
192234
// hash of the previous Governance Action, index of the previous Governance Action, url of the metadata, hash of the metadata, and the updated protocol parameters
193-
const govActionBuilder = await buildProtocolParameterChangeGovernanceAction({
235+
govActionBuilder = await buildProtocolParameterChangeGovernanceAction({
194236
prevGovernanceActionHash,
195237
prevGovernanceActionIndex,
196238
url,
197239
hash,
198240
protocolParamsUpdate,
199241
});
200242

201-
// Hard Fork Initiation Governance Action
202-
const { buildHardForkInitiationGovernanceAction } = useCardano();
203-
204243
// hash of the previous Governance Action, index of the previous Governance Action, url of the metadata, hash of the metadata, and the major and minor numbers of the hard fork initiation
205-
const govActionBuilder = await buildHardForkInitiationGovernanceAction({
244+
govActionBuilder = await buildHardForkInitiationGovernanceAction({
206245
prevGovernanceActionHash,
207246
prevGovernanceActionIndex,
208247
url,
@@ -211,6 +250,24 @@ const govActionBuilder = await buildHardForkInitiationGovernanceAction({
211250
minor,
212251
});
213252

253+
// hash of the previous Governance Action, index of the previous Governance Action, url of the metadata, hash of the metadata, and the constitution script hash
254+
govActionBuilder = await buildNewConstitutionGovernanceAction({
255+
prevGovernanceActionHash,
256+
prevGovernanceActionIndex,
257+
constitutionUrl,
258+
constitutionHash,
259+
scriptHash,
260+
});
261+
262+
// hash of the previous Governance Action, index of the previous Governance Action, url of the metadata, hash of the metadata, and the quorum threshold and the new committee members
263+
govActionBuilder = await buildUpdateCommitteeGovernanceAction({
264+
prevGovernanceActionHash,
265+
prevGovernanceActionIndex,
266+
quorumThreshold,
267+
newCommittee,
268+
removeCommittee,
269+
});
270+
214271
// sign and submit the transaction
215272
await buildSignSubmitConwayCertTx({
216273
govActionBuilder,

govtool/frontend/package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

govtool/frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@hookform/resolvers": "^3.3.1",
3030
"@intersect.mbo/govtool-outcomes-pillar-ui": "1.0.0",
3131
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
32-
"@intersect.mbo/pdf-ui": "^0.5.11",
32+
"@intersect.mbo/pdf-ui": "^0.6.0",
3333
"@mui/icons-material": "^5.14.3",
3434
"@mui/material": "^5.14.4",
3535
"@rollup/plugin-babel": "^6.0.4",

govtool/frontend/src/components/organisms/CreateGovernanceActionSteps/CreateGovernanceActionForm.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ export const CreateGovernanceActionForm = ({
4747
type! as
4848
| GovernanceActionType.InfoAction
4949
| GovernanceActionType.TreasuryWithdrawals
50+
| GovernanceActionType.NewCommittee
51+
| GovernanceActionType.NewConstitution
52+
| GovernanceActionType.NoConfidence
5053
],
5154
).some(
5255
(field) => !watch(field as unknown as Parameters<typeof watch>[0]),
@@ -67,6 +70,9 @@ export const CreateGovernanceActionForm = ({
6770
type! as
6871
| GovernanceActionType.InfoAction
6972
| GovernanceActionType.TreasuryWithdrawals
73+
| GovernanceActionType.NewCommittee
74+
| GovernanceActionType.NewConstitution
75+
| GovernanceActionType.NoConfidence
7076
],
7177
).map(([key, field]) => {
7278
const fieldProps = {

0 commit comments

Comments
 (0)