Skip to content
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ changes.

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

### Fixed

Expand All @@ -25,6 +26,7 @@ changes.

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

### Removed

Expand Down
113 changes: 85 additions & 28 deletions docs/GOVERNANCE_ACTION_SUBMISSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ interface GovernanceAction {
references: [{ label: string; uri: string }];
}

interface InfoProps {
hash: string;
type VotingAnchor = {
url: string;
hash: string;
}

interface TreasuryProps {
amount: string;
hash: string;
type InfoProps = VotingAnchor;

type TreasuryProps {
withdrawals: { receivingAddress: string; amount: string }[];
}
} & VotingAnchor;

type ProtocolParamsUpdate = {
adaPerUtxo: string;
Expand Down Expand Up @@ -77,14 +77,44 @@ type ProtocolParamsUpdate = {
treasuryGrowthRate: UnitInterval;
};

interface ProtocolParameterChangeProps {
type ProtocolParameterChangeProps {
prevGovernanceActionHash: string;
prevGovernanceActionIndex: number;
url: string;
hash: string;

protocolParamsUpdate: Partial<ProtocolParamsUpdate>;
}
} & VotingAnchor;

type HardForkInitiationProps = {
prevGovernanceActionHash: string;
prevGovernanceActionIndex: number;
major: number;
minor: number;
} & VotingAnchor;

type NewConstitutionProps = {
prevGovernanceActionHash: string;
prevGovernanceActionIndex: number;
constitutionUrl: string;
constitutionHash: string;
scriptHash: string;
} & VotingAnchor;

type UpdateCommitteeProps = {
prevGovernanceActionHash?: string;
prevGovernanceActionIndex?: number;
quorumThreshold: QuorumThreshold;
newCommittee?: CommitteeToAdd[];
removeCommittee?: string[];
} & VotingAnchor;

type CommitteeToAdd = {
expiryEpoch: number;
committee: string;
};

type QuorumThreshold = {
numerator: number;
denominator: number;
};

const createGovernanceActionJsonLD: (
governanceAction: GovernanceAction
Expand All @@ -100,6 +130,22 @@ const buildTreasuryGovernanceAction: (
treasuryProps: TreasuryProps
) => Promise<VotingProposalBuilder | undefined>;

const buildProtocolParameterChangeGovernanceAction: (
protocolParameterChangeProps: ProtocolParameterChangeProps
) => Promise<VotingProposalBuilder | undefined>;

const buildHardForkInitiationGovernanceAction: (
hardForkInitiationProps: HardForkInitiationProps
) => Promise<VotingProposalBuilder | undefined>;

const buildNewConstitutionGovernanceAction: (
newConstitutionProps: NewConstitutionProps
) => Promise<VotingProposalBuilder | undefined>;

const buildUpdateCommitteeGovernanceAction: (
updateCommitteeProps: UpdateCommitteeProps
) => Promise<VotingProposalBuilder | undefined>;

const buildSignSubmitConwayCertTx: (params: {
govActionBuilder: VotingProposalBuilder;
type: "createGovAction";
Expand Down Expand Up @@ -165,44 +211,37 @@ const {
buildNewInfoGovernanceAction,
buildProtocolParameterChangeGovernanceAction,
buildHardForkInitiationGovernanceAction,
buildTreasuryGovernanceAction,
buildNewConstitutionGovernanceAction,
buildUpdateCommitteeGovernanceAction,
buildNoConfidenceGovernanceAction,
} = useCardano();

// Info Governance Action
const govActionBuilder = await buildNewInfoGovernanceAction({ hash, url });
let govActionBuilder = await buildNewInfoGovernanceAction({ hash, url });

// sign and submit the transaction
await buildSignSubmitConwayCertTx({
govActionBuilder,
type: "createGovAction",
});
// And for the other type of governance actions:

// Treasury Governance Action
const { buildTreasuryGovernanceAction } = useCardano();
govActionBuilder = await buildNoConfidenceGovernanceAction({ hash, url });

// hash of the generated Governance Action metadata, url of the metadata, amount of the transaction, receiving address is the stake key address
const govActionBuilder = await buildTreasuryGovernanceAction({
govActionBuilder = await buildTreasuryGovernanceAction({
hash,
url,
withdrawals: [{ amount, receivingAddress }],
});

// Protocol Parameter Change Governance Action
const { buildProtocolParameterChangeGovernanceAction } = useCardano();

// 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
const govActionBuilder = await buildProtocolParameterChangeGovernanceAction({
govActionBuilder = await buildProtocolParameterChangeGovernanceAction({
prevGovernanceActionHash,
prevGovernanceActionIndex,
url,
hash,
protocolParamsUpdate,
});

// Hard Fork Initiation Governance Action
const { buildHardForkInitiationGovernanceAction } = useCardano();

// 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
const govActionBuilder = await buildHardForkInitiationGovernanceAction({
govActionBuilder = await buildHardForkInitiationGovernanceAction({
prevGovernanceActionHash,
prevGovernanceActionIndex,
url,
Expand All @@ -211,6 +250,24 @@ const govActionBuilder = await buildHardForkInitiationGovernanceAction({
minor,
});

// 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
govActionBuilder = await buildNewConstitutionGovernanceAction({
prevGovernanceActionHash,
prevGovernanceActionIndex,
constitutionUrl,
constitutionHash,
scriptHash,
});

// 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
govActionBuilder = await buildUpdateCommitteeGovernanceAction({
prevGovernanceActionHash,
prevGovernanceActionIndex,
quorumThreshold,
newCommittee,
removeCommittee,
});

// sign and submit the transaction
await buildSignSubmitConwayCertTx({
govActionBuilder,
Expand Down
10 changes: 5 additions & 5 deletions govtool/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion govtool/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"@hookform/resolvers": "^3.3.1",
"@intersect.mbo/govtool-outcomes-pillar-ui": "1.0.0",
"@intersect.mbo/intersectmbo.org-icons-set": "^1.0.8",
"@intersect.mbo/pdf-ui": "^0.5.11",
"@intersect.mbo/pdf-ui": "^0.6.0",
"@mui/icons-material": "^5.14.3",
"@mui/material": "^5.14.4",
"@rollup/plugin-babel": "^6.0.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export const CreateGovernanceActionForm = ({
type! as
| GovernanceActionType.InfoAction
| GovernanceActionType.TreasuryWithdrawals
| GovernanceActionType.NewCommittee
| GovernanceActionType.NewConstitution
| GovernanceActionType.NoConfidence
],
).some(
(field) => !watch(field as unknown as Parameters<typeof watch>[0]),
Expand All @@ -67,6 +70,9 @@ export const CreateGovernanceActionForm = ({
type! as
| GovernanceActionType.InfoAction
| GovernanceActionType.TreasuryWithdrawals
| GovernanceActionType.NewCommittee
| GovernanceActionType.NewConstitution
| GovernanceActionType.NoConfidence
],
).map(([key, field]) => {
const fieldProps = {
Expand Down
Loading