governance_proposal - [devnet]
此内容尚不支持你的语言。
Define the GovernanceProposal that will be used as part of on-chain governance by AptosGovernance.
This is separate from the AptosGovernance module to avoid circular dependency between AptosGovernance and Stake.
Structs
GovernanceProposal
struct GovernanceProposal has drop, storeFields
-
dummy_field: bool
Functions
create_proposal
Create and return a GovernanceProposal resource. Can only be called by AptosGovernance
public(friend) fun create_proposal(): governance_proposal::GovernanceProposalImplementation
public(friend) fun create_proposal(): GovernanceProposal { GovernanceProposal {}}create_empty_proposal
Useful for AptosGovernance to create an empty proposal as proof.
public(friend) fun create_empty_proposal(): governance_proposal::GovernanceProposalImplementation
public(friend) fun create_empty_proposal(): GovernanceProposal { create_proposal()}Specification
create_proposal
public(friend) fun create_proposal(): governance_proposal::GovernanceProposalHigh-level Requirements
| No. | Requirement | Criticality | Implementation | Enforcement |
|---|---|---|---|---|
| 1 | Creating a proposal should never abort but should always return a governance proposal resource. | Medium | Both create_proposal and create_empty_proposal functions return a GovernanceProposal resource. | Enforced via create_proposal and create_empty_proposal. |
| 2 | The governance proposal module should only be accessible to the aptos governance. | Medium | Both create_proposal and create_empty_proposal functions are only available to the friend module aptos_framework::aptos_governance. | Enforced via friend module relationship. |
Module-level Specification
aborts_if false;// This enforces high-level requirement 1:ensures result == GovernanceProposal {};create_empty_proposal
public(friend) fun create_empty_proposal(): governance_proposal::GovernanceProposalaborts_if false;// This enforces high-level requirement 1:ensures result == GovernanceProposal {};