/** * AptosGovernance represents the on-chain governance of the Aptos network. Voting power is calculated based on the * current epoch's voting power of the proposer or voter's backing stake pool. In addition, for it to count, * the stake pool's lockup needs to be at least as long as the proposal's duration. * * It provides the following flow: * 1. Proposers can create a proposal by calling AptosGovernance::create_proposal. The proposer's backing stake pool * needs to have the minimum proposer stake required. Off-chain components can subscribe to CreateProposalEvent to * track proposal creation and proposal ids. * 2. Voters can vote on a proposal. Their voting power is derived from the backing stake pool. Each stake pool can * only be used to vote on each proposal exactly once. * * **Module ID:** `0x1::aptos_governance` * * @module */ import type * as p from "@movingco/prelude"; /** * Event emitted when a proposal is created. * * Type name: `0x1::aptos_governance::CreateProposalEvent` */ export interface ICreateProposalEvent { proposer: p.RawAddress; stake_pool: p.RawAddress; proposal_id: p.U64; execution_hash: p.ByteString; proposal_metadata: { data: ReadonlyArray<{ key: string; value: p.ByteString; }>; }; } /** * Event emitted when there's a vote on a proposa; * * Type name: `0x1::aptos_governance::VoteEvent` */ export interface IVoteEvent { proposal_id: p.U64; voter: p.RawAddress; stake_pool: p.RawAddress; num_votes: p.U64; should_pass: boolean; } /** * Used to track which execution script hashes have been approved by governance. * This is required to bypass cases where the execution scripts exceed the size limit imposed by mempool. * * Type name: `0x1::aptos_governance::ApprovedExecutionHashes` */ export interface IApprovedExecutionHashes { hashes: { data: ReadonlyArray<{ key: p.U64; value: p.ByteString; }>; }; } /** * Configurations of the AptosGovernance, set during Genesis and can be updated by the same process offered * by this AptosGovernance module. * * Type name: `0x1::aptos_governance::GovernanceConfig` */ export interface IGovernanceConfig { min_voting_threshold: p.U128; required_proposer_stake: p.U64; voting_duration_secs: p.U64; } /** * Events generated by interactions with the AptosGovernance module. * * Type name: `0x1::aptos_governance::GovernanceEvents` */ export interface IGovernanceEvents { create_proposal_events: { /** Total number of events emitted to this event stream. */ counter: p.U64; /** A globally unique ID for this event stream. */ guid: { id: { /** If creation_num is `i`, this is the `i+1`th GUID created by `addr` */ creation_num: p.U64; /** Address that created the GUID */ addr: p.RawAddress; }; }; }; update_config_events: { /** Total number of events emitted to this event stream. */ counter: p.U64; /** A globally unique ID for this event stream. */ guid: { id: { /** If creation_num is `i`, this is the `i+1`th GUID created by `addr` */ creation_num: p.U64; /** Address that created the GUID */ addr: p.RawAddress; }; }; }; vote_events: { /** Total number of events emitted to this event stream. */ counter: p.U64; /** A globally unique ID for this event stream. */ guid: { id: { /** If creation_num is `i`, this is the `i+1`th GUID created by `addr` */ creation_num: p.U64; /** Address that created the GUID */ addr: p.RawAddress; }; }; }; } /** * Store the SignerCapabilities of accounts under the on-chain governance's control. * * Type name: `0x1::aptos_governance::GovernanceResponsbility` */ export interface IGovernanceResponsbility { signer_caps: { data: ReadonlyArray<{ key: p.RawAddress; value: { account: p.RawAddress; }; }>; }; } /** Type name: `0x1::aptos_governance::RecordKey` */ export interface IRecordKey { stake_pool: p.RawAddress; proposal_id: p.U64; } /** * Event emitted when the governance configs are updated. * * Type name: `0x1::aptos_governance::UpdateConfigEvent` */ export interface IUpdateConfigEvent { min_voting_threshold: p.U128; required_proposer_stake: p.U64; voting_duration_secs: p.U64; } /** * Records to track the proposals each stake pool has been used to vote on. * * Type name: `0x1::aptos_governance::VotingRecords` */ export interface IVotingRecords { votes: { handle: p.U128; }; } /** Payload arguments for {@link entry.create_proposal}. */ export declare type CreateProposalArgs = { args: { /** IDL type: `Address` */ stake_pool: p.RawAddress; /** IDL type: `Vector(U8)` */ execution_hash: p.ByteString; /** IDL type: `Vector(U8)` */ metadata_location: p.ByteString; /** IDL type: `Vector(U8)` */ metadata_hash: p.ByteString; }; }; /** Payload arguments for {@link entry.vote}. */ export declare type VoteArgs = { args: { /** IDL type: `Address` */ stake_pool: p.RawAddress; /** IDL type: `U64` */ proposal_id: p.U64; /** IDL type: `Bool` */ should_pass: boolean; }; }; export * as entry from "./entry.js"; export * as entryNames from "./entryNames.js"; export { idl } from "./idl.js"; export * as payloads from "./payloads.js"; /** The address of the module. */ export declare const ADDRESS: "0x1"; /** The full module name. */ export declare const FULL_NAME: "0x1::aptos_governance"; /** The name of the module. */ export declare const NAME: "aptos_governance"; /** Module ID information. */ export declare const id: { readonly ADDRESS: "0x1"; readonly FULL_NAME: "0x1::aptos_governance"; readonly NAME: "aptos_governance"; }; export * as errors from "./errors.js"; /** Module error codes. */ export declare const errorCodes: { readonly "1": { readonly name: "EINSUFFICIENT_PROPOSER_STAKE"; readonly doc: "The specified stake pool does not have sufficient stake to create a proposal"; }; readonly "2": { readonly name: "ENOT_DELEGATED_VOTER"; readonly doc: "This account is not the designated voter of the specified stake pool"; }; readonly "3": { readonly name: "EINSUFFICIENT_STAKE_LOCKUP"; readonly doc: "The specified stake pool does not have long enough remaining lockup to create a proposal or vote"; }; readonly "4": { readonly name: "EALREADY_VOTED"; readonly doc: "The specified stake pool has already been used to vote on the same proposal"; }; readonly "5": { readonly name: "ENO_VOTING_POWER"; readonly doc: "The specified stake pool must be part of the validator set"; }; readonly "6": { readonly name: "EPROPOSAL_NOT_RESOLVABLE_YET"; readonly doc: "Proposal is not ready to be resolved. Waiting on time or votes"; }; readonly "7": { readonly name: "ESCRIPT_HASH_ALREADY_ADDED"; readonly doc: "Proposal's script hash has already been added to the approved list"; }; readonly "8": { readonly name: "EPROPOSAL_NOT_RESOLVED_YET"; readonly doc: "The proposal has not been resolved yet"; }; readonly "9": { readonly name: "EMETADATA_LOCATION_TOO_LONG"; readonly doc: "Metadata location cannot be longer than 256 chars"; }; readonly "10": { readonly name: "EMETADATA_HASH_TOO_LONG"; readonly doc: "Metadata hash cannot be longer than 256 chars"; }; }; /** All module function IDLs. */ export declare const functions: { readonly create_proposal: { readonly name: "create_proposal"; readonly 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."; readonly ty_args: readonly []; readonly args: readonly [{ readonly name: "stake_pool"; readonly ty: "address"; }, { readonly name: "execution_hash"; readonly ty: { readonly vector: "u8"; }; }, { readonly name: "metadata_location"; readonly ty: { readonly vector: "u8"; }; }, { readonly name: "metadata_hash"; readonly ty: { readonly vector: "u8"; }; }]; }; readonly vote: { readonly name: "vote"; readonly doc: "Vote on proposal with `proposal_id` and voting power from `stake_pool`."; readonly ty_args: readonly []; readonly args: readonly [{ readonly name: "stake_pool"; readonly ty: "address"; }, { readonly name: "proposal_id"; readonly ty: "u64"; }, { readonly name: "should_pass"; readonly ty: "bool"; }]; }; }; /** All struct types with ability `key`. */ export declare const resources: { readonly ApprovedExecutionHashes: "0x1::aptos_governance::ApprovedExecutionHashes"; readonly GovernanceConfig: "0x1::aptos_governance::GovernanceConfig"; readonly GovernanceEvents: "0x1::aptos_governance::GovernanceEvents"; readonly GovernanceResponsbility: "0x1::aptos_governance::GovernanceResponsbility"; readonly VotingRecords: "0x1::aptos_governance::VotingRecords"; }; /** All struct types. */ export declare const structs: { readonly ApprovedExecutionHashes: "0x1::aptos_governance::ApprovedExecutionHashes"; readonly CreateProposalEvent: "0x1::aptos_governance::CreateProposalEvent"; readonly GovernanceConfig: "0x1::aptos_governance::GovernanceConfig"; readonly GovernanceEvents: "0x1::aptos_governance::GovernanceEvents"; readonly GovernanceResponsbility: "0x1::aptos_governance::GovernanceResponsbility"; readonly RecordKey: "0x1::aptos_governance::RecordKey"; readonly UpdateConfigEvent: "0x1::aptos_governance::UpdateConfigEvent"; readonly VoteEvent: "0x1::aptos_governance::VoteEvent"; readonly VotingRecords: "0x1::aptos_governance::VotingRecords"; }; /** * AptosGovernance represents the on-chain governance of the Aptos network. Voting power is calculated based on the * current epoch's voting power of the proposer or voter's backing stake pool. In addition, for it to count, * the stake pool's lockup needs to be at least as long as the proposal's duration. * * It provides the following flow: * 1. Proposers can create a proposal by calling AptosGovernance::create_proposal. The proposer's backing stake pool * needs to have the minimum proposer stake required. Off-chain components can subscribe to CreateProposalEvent to * track proposal creation and proposal ids. * 2. Voters can vote on a proposal. Their voting power is derived from the backing stake pool. Each stake pool can * only be used to vote on each proposal exactly once. */ export declare const moduleDefinition: { readonly errorCodes: { readonly "1": { readonly name: "EINSUFFICIENT_PROPOSER_STAKE"; readonly doc: "The specified stake pool does not have sufficient stake to create a proposal"; }; readonly "2": { readonly name: "ENOT_DELEGATED_VOTER"; readonly doc: "This account is not the designated voter of the specified stake pool"; }; readonly "3": { readonly name: "EINSUFFICIENT_STAKE_LOCKUP"; readonly doc: "The specified stake pool does not have long enough remaining lockup to create a proposal or vote"; }; readonly "4": { readonly name: "EALREADY_VOTED"; readonly doc: "The specified stake pool has already been used to vote on the same proposal"; }; readonly "5": { readonly name: "ENO_VOTING_POWER"; readonly doc: "The specified stake pool must be part of the validator set"; }; readonly "6": { readonly name: "EPROPOSAL_NOT_RESOLVABLE_YET"; readonly doc: "Proposal is not ready to be resolved. Waiting on time or votes"; }; readonly "7": { readonly name: "ESCRIPT_HASH_ALREADY_ADDED"; readonly doc: "Proposal's script hash has already been added to the approved list"; }; readonly "8": { readonly name: "EPROPOSAL_NOT_RESOLVED_YET"; readonly doc: "The proposal has not been resolved yet"; }; readonly "9": { readonly name: "EMETADATA_LOCATION_TOO_LONG"; readonly doc: "Metadata location cannot be longer than 256 chars"; }; readonly "10": { readonly name: "EMETADATA_HASH_TOO_LONG"; readonly doc: "Metadata hash cannot be longer than 256 chars"; }; }; readonly functions: { readonly create_proposal: { readonly name: "create_proposal"; readonly 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."; readonly ty_args: readonly []; readonly args: readonly [{ readonly name: "stake_pool"; readonly ty: "address"; }, { readonly name: "execution_hash"; readonly ty: { readonly vector: "u8"; }; }, { readonly name: "metadata_location"; readonly ty: { readonly vector: "u8"; }; }, { readonly name: "metadata_hash"; readonly ty: { readonly vector: "u8"; }; }]; }; readonly vote: { readonly name: "vote"; readonly doc: "Vote on proposal with `proposal_id` and voting power from `stake_pool`."; readonly ty_args: readonly []; readonly args: readonly [{ readonly name: "stake_pool"; readonly ty: "address"; }, { readonly name: "proposal_id"; readonly ty: "u64"; }, { readonly name: "should_pass"; readonly ty: "bool"; }]; }; }; readonly resources: { readonly ApprovedExecutionHashes: "0x1::aptos_governance::ApprovedExecutionHashes"; readonly GovernanceConfig: "0x1::aptos_governance::GovernanceConfig"; readonly GovernanceEvents: "0x1::aptos_governance::GovernanceEvents"; readonly GovernanceResponsbility: "0x1::aptos_governance::GovernanceResponsbility"; readonly VotingRecords: "0x1::aptos_governance::VotingRecords"; }; readonly structs: { readonly ApprovedExecutionHashes: "0x1::aptos_governance::ApprovedExecutionHashes"; readonly CreateProposalEvent: "0x1::aptos_governance::CreateProposalEvent"; readonly GovernanceConfig: "0x1::aptos_governance::GovernanceConfig"; readonly GovernanceEvents: "0x1::aptos_governance::GovernanceEvents"; readonly GovernanceResponsbility: "0x1::aptos_governance::GovernanceResponsbility"; readonly RecordKey: "0x1::aptos_governance::RecordKey"; readonly UpdateConfigEvent: "0x1::aptos_governance::UpdateConfigEvent"; readonly VoteEvent: "0x1::aptos_governance::VoteEvent"; readonly VotingRecords: "0x1::aptos_governance::VotingRecords"; }; readonly ADDRESS: "0x1"; readonly FULL_NAME: "0x1::aptos_governance"; readonly NAME: "aptos_governance"; }; //# sourceMappingURL=index.d.ts.map