/** * The IDL of the module. * * @module */ /** The IDL of the module. */ export const idl = { module_id: "0x1::aptos_governance", doc: "AptosGovernance represents the on-chain governance of the Aptos network. Voting power is calculated based on the\ncurrent epoch's voting power of the proposer or voter's backing stake pool. In addition, for it to count,\nthe stake pool's lockup needs to be at least as long as the proposal's duration.\n\nIt provides the following flow:\n1. Proposers can create a proposal by calling AptosGovernance::create_proposal. The proposer's backing stake pool\nneeds to have the minimum proposer stake required. Off-chain components can subscribe to CreateProposalEvent to\ntrack proposal creation and proposal ids.\n2. Voters can vote on a proposal. Their voting power is derived from the backing stake pool. Each stake pool can\nonly be used to vote on each proposal exactly once.", functions: [ { name: "create_proposal", doc: "Create a proposal with the backing `stake_pool`.\n@param execution_hash Required. This is the hash of the resolution script. When the proposal is resolved,\nonly the exact script with matching hash can be successfully executed.", ty_args: [], args: [ { name: "stake_pool", ty: "address" }, { name: "execution_hash", ty: { vector: "u8" } }, { name: "metadata_location", ty: { vector: "u8" } }, { name: "metadata_hash", ty: { vector: "u8" } }, ], }, { name: "vote", doc: "Vote on proposal with `proposal_id` and voting power from `stake_pool`.", ty_args: [], args: [ { name: "stake_pool", ty: "address" }, { name: "proposal_id", ty: "u64" }, { name: "should_pass", ty: "bool" }, ], }, ], structs: [ { name: "0x1::aptos_governance::CreateProposalEvent", doc: "Event emitted when a proposal is created.", fields: [ { name: "proposer", ty: "address" }, { name: "stake_pool", ty: "address" }, { name: "proposal_id", ty: "u64" }, { name: "execution_hash", ty: { vector: "u8" } }, { name: "proposal_metadata", ty: { struct: { name: "0x1::simple_map::SimpleMap", ty_args: [ { struct: { name: "0x1::string::String" } }, { vector: "u8" }, ], }, }, }, ], abilities: ["drop", "store"], }, { name: "0x1::aptos_governance::VoteEvent", doc: "Event emitted when there's a vote on a proposa;", fields: [ { name: "proposal_id", ty: "u64" }, { name: "voter", ty: "address" }, { name: "stake_pool", ty: "address" }, { name: "num_votes", ty: "u64" }, { name: "should_pass", ty: "bool" }, ], abilities: ["drop", "store"], }, { name: "0x1::aptos_governance::ApprovedExecutionHashes", doc: "Used to track which execution script hashes have been approved by governance.\nThis is required to bypass cases where the execution scripts exceed the size limit imposed by mempool.", fields: [ { name: "hashes", ty: { struct: { name: "0x1::simple_map::SimpleMap", ty_args: ["u64", { vector: "u8" }], }, }, }, ], abilities: ["key"], }, { name: "0x1::aptos_governance::GovernanceConfig", doc: "Configurations of the AptosGovernance, set during Genesis and can be updated by the same process offered\nby this AptosGovernance module.", fields: [ { name: "min_voting_threshold", ty: "u128" }, { name: "required_proposer_stake", ty: "u64" }, { name: "voting_duration_secs", ty: "u64" }, ], abilities: ["key"], }, { name: "0x1::aptos_governance::GovernanceEvents", doc: "Events generated by interactions with the AptosGovernance module.", fields: [ { name: "create_proposal_events", ty: { struct: { name: "0x1::event::EventHandle", ty_args: [ { struct: { name: "0x1::aptos_governance::CreateProposalEvent", }, }, ], }, }, }, { name: "update_config_events", ty: { struct: { name: "0x1::event::EventHandle", ty_args: [ { struct: { name: "0x1::aptos_governance::UpdateConfigEvent" }, }, ], }, }, }, { name: "vote_events", ty: { struct: { name: "0x1::event::EventHandle", ty_args: [ { struct: { name: "0x1::aptos_governance::VoteEvent" } }, ], }, }, }, ], abilities: ["key"], }, { name: "0x1::aptos_governance::GovernanceResponsbility", doc: "Store the SignerCapabilities of accounts under the on-chain governance's control.", fields: [ { name: "signer_caps", ty: { struct: { name: "0x1::simple_map::SimpleMap", ty_args: [ "address", { struct: { name: "0x1::account::SignerCapability" } }, ], }, }, }, ], abilities: ["key"], }, { name: "0x1::aptos_governance::RecordKey", fields: [ { name: "stake_pool", ty: "address" }, { name: "proposal_id", ty: "u64" }, ], abilities: ["copy", "drop", "store"], }, { name: "0x1::aptos_governance::UpdateConfigEvent", doc: "Event emitted when the governance configs are updated.", fields: [ { name: "min_voting_threshold", ty: "u128" }, { name: "required_proposer_stake", ty: "u64" }, { name: "voting_duration_secs", ty: "u64" }, ], abilities: ["drop", "store"], }, { name: "0x1::aptos_governance::VotingRecords", doc: "Records to track the proposals each stake pool has been used to vote on.", fields: [ { name: "votes", ty: { struct: { name: "0x1::table::Table", ty_args: [ { struct: { name: "0x1::aptos_governance::RecordKey" } }, "bool", ], }, }, }, ], abilities: ["key"], }, ], errors: { "1": { name: "EINSUFFICIENT_PROPOSER_STAKE", doc: "The specified stake pool does not have sufficient stake to create a proposal", }, "2": { name: "ENOT_DELEGATED_VOTER", doc: "This account is not the designated voter of the specified stake pool", }, "3": { name: "EINSUFFICIENT_STAKE_LOCKUP", doc: "The specified stake pool does not have long enough remaining lockup to create a proposal or vote", }, "4": { name: "EALREADY_VOTED", doc: "The specified stake pool has already been used to vote on the same proposal", }, "5": { name: "ENO_VOTING_POWER", doc: "The specified stake pool must be part of the validator set", }, "6": { name: "EPROPOSAL_NOT_RESOLVABLE_YET", doc: "Proposal is not ready to be resolved. Waiting on time or votes", }, "7": { name: "ESCRIPT_HASH_ALREADY_ADDED", doc: "Proposal's script hash has already been added to the approved list", }, "8": { name: "EPROPOSAL_NOT_RESOLVED_YET", doc: "The proposal has not been resolved yet", }, "9": { name: "EMETADATA_LOCATION_TOO_LONG", doc: "Metadata location cannot be longer than 256 chars", }, "10": { name: "EMETADATA_HASH_TOO_LONG", doc: "Metadata hash cannot be longer than 256 chars", }, }, } as const;