pub type Module<T, I = ()> = Pallet<T, I>;
Pallet
insteadExpand description
Type alias to Pallet
, to be used by construct_runtime
.
Generated by pallet
attribute macro.
Aliased Type§
struct Module<T, I = ()>(/* private fields */);
Implementations
Source§impl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
Sourcepub fn submit(
origin: OriginFor<T>,
proposal_origin: Box<PalletsOriginOf<T>>,
proposal: BoundedCallOf<T, I>,
enactment_moment: DispatchTime<BlockNumberFor<T, I>>,
) -> DispatchResult
pub fn submit( origin: OriginFor<T>, proposal_origin: Box<PalletsOriginOf<T>>, proposal: BoundedCallOf<T, I>, enactment_moment: DispatchTime<BlockNumberFor<T, I>>, ) -> DispatchResult
Propose a referendum on a privileged action.
origin
: must beSubmitOrigin
and the account must haveSubmissionDeposit
funds available.proposal_origin
: The origin from which the proposal should be executed.proposal
: The proposal.enactment_moment
: The moment that the proposal should be enacted.
Emits Submitted
.
Sourcepub fn place_decision_deposit(
origin: OriginFor<T>,
index: ReferendumIndex,
) -> DispatchResultWithPostInfo
pub fn place_decision_deposit( origin: OriginFor<T>, index: ReferendumIndex, ) -> DispatchResultWithPostInfo
Post the Decision Deposit for a referendum.
origin
: must beSigned
and the account must have funds available for the referendum’s track’s Decision Deposit.index
: The index of the submitted referendum whose Decision Deposit is yet to be posted.
Emits DecisionDepositPlaced
.
Sourcepub fn refund_decision_deposit(
origin: OriginFor<T>,
index: ReferendumIndex,
) -> DispatchResult
pub fn refund_decision_deposit( origin: OriginFor<T>, index: ReferendumIndex, ) -> DispatchResult
Refund the Decision Deposit for a closed referendum back to the depositor.
origin
: must beSigned
orRoot
.index
: The index of a closed referendum whose Decision Deposit has not yet been refunded.
Emits DecisionDepositRefunded
.
Sourcepub fn cancel(origin: OriginFor<T>, index: ReferendumIndex) -> DispatchResult
pub fn cancel(origin: OriginFor<T>, index: ReferendumIndex) -> DispatchResult
Cancel an ongoing referendum.
origin
: must be theCancelOrigin
.index
: The index of the referendum to be cancelled.
Emits Cancelled
.
Sourcepub fn kill(origin: OriginFor<T>, index: ReferendumIndex) -> DispatchResult
pub fn kill(origin: OriginFor<T>, index: ReferendumIndex) -> DispatchResult
Cancel an ongoing referendum and slash the deposits.
origin
: must be theKillOrigin
.index
: The index of the referendum to be cancelled.
Emits Killed
and DepositSlashed
.
Sourcepub fn nudge_referendum(
origin: OriginFor<T>,
index: ReferendumIndex,
) -> DispatchResultWithPostInfo
pub fn nudge_referendum( origin: OriginFor<T>, index: ReferendumIndex, ) -> DispatchResultWithPostInfo
Advance a referendum onto its next logical state. Only used internally.
origin
: must beRoot
.index
: the referendum to be advanced.
Sourcepub fn one_fewer_deciding(
origin: OriginFor<T>,
track: TrackIdOf<T, I>,
) -> DispatchResultWithPostInfo
pub fn one_fewer_deciding( origin: OriginFor<T>, track: TrackIdOf<T, I>, ) -> DispatchResultWithPostInfo
Advance a track onto its next logical state. Only used internally.
origin
: must beRoot
.track
: the track to be advanced.
Action item for when there is now one fewer referendum in the deciding phase and the
DecidingCount
is not yet updated. This means that we should either:
- begin deciding another referendum (and leave
DecidingCount
alone); or - decrement
DecidingCount
.
Sourcepub fn refund_submission_deposit(
origin: OriginFor<T>,
index: ReferendumIndex,
) -> DispatchResult
pub fn refund_submission_deposit( origin: OriginFor<T>, index: ReferendumIndex, ) -> DispatchResult
Refund the Submission Deposit for a closed referendum back to the depositor.
origin
: must beSigned
orRoot
.index
: The index of a closed referendum whose Submission Deposit has not yet been refunded.
Emits SubmissionDepositRefunded
.
Sourcepub fn set_metadata(
origin: OriginFor<T>,
index: ReferendumIndex,
maybe_hash: Option<T::Hash>,
) -> DispatchResult
pub fn set_metadata( origin: OriginFor<T>, index: ReferendumIndex, maybe_hash: Option<T::Hash>, ) -> DispatchResult
Set or clear metadata of a referendum.
Parameters:
origin
: Must beSigned
by a creator of a referendum or by anyone to clear a metadata of a finished referendum.index
: The index of a referendum to set or clear metadata for.maybe_hash
: The hash of an on-chain stored preimage.None
to clear a metadata.
Source§impl<T: Config<I>, I: 'static> Pallet<T, I>
impl<T: Config<I>, I: 'static> Pallet<T, I>
Sourcepub fn ensure_ongoing(
index: ReferendumIndex,
) -> Result<ReferendumStatusOf<T, I>, DispatchError>
pub fn ensure_ongoing( index: ReferendumIndex, ) -> Result<ReferendumStatusOf<T, I>, DispatchError>
Check that referendum index
is in the Ongoing
state and return the ReferendumStatus
value, or Err
otherwise.
Sourcepub fn is_referendum_passing(
ref_index: ReferendumIndex,
) -> Result<bool, DispatchError>
pub fn is_referendum_passing( ref_index: ReferendumIndex, ) -> Result<bool, DispatchError>
Returns whether the referendum is passing. Referendum must be ongoing and its track must exist.
Trait Implementations
Source§impl<T: Config<I>, I: 'static> BeforeAllRuntimeMigrations for Pallet<T, I>
impl<T: Config<I>, I: 'static> BeforeAllRuntimeMigrations for Pallet<T, I>
Source§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
Source§impl<T, I: 'static> Benchmarking for Pallet<T, I>where
T: Config + Config<I>,
impl<T, I: 'static> Benchmarking for Pallet<T, I>where
T: Config + Config<I>,
Source§impl<T: Config<I>, I: 'static> Callable<T> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Callable<T> for Pallet<T, I>
type RuntimeCall = Call<T, I>
Source§impl<T: Config<I>, I: 'static> GetStorageVersion for Pallet<T, I>
impl<T: Config<I>, I: 'static> GetStorageVersion for Pallet<T, I>
Source§type InCodeStorageVersion = StorageVersion
type InCodeStorageVersion = StorageVersion
Source§fn in_code_storage_version() -> Self::InCodeStorageVersion
fn in_code_storage_version() -> Self::InCodeStorageVersion
storage_version
attribute, or
[NoStorageVersionSet
] if the attribute is missing.Source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
§fn current_storage_version() -> Self::InCodeStorageVersion
fn current_storage_version() -> Self::InCodeStorageVersion
in_code_storage_version
and will be removed after March 2024.Self::current_storage_version
] instead. Read moreSource§impl<T: Config<I>, I: 'static> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn try_state(_n: SystemBlockNumberFor<T>) -> Result<(), TryRuntimeError>
fn try_state(_n: SystemBlockNumberFor<T>) -> Result<(), TryRuntimeError>
Source§fn integrity_test()
fn integrity_test()
§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
§fn on_finalize(_n: BlockNumber)
fn on_finalize(_n: BlockNumber)
§fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
fn on_idle(_n: BlockNumber, _remaining_weight: Weight) -> Weight
Hooks::on_finalize
]). Read more§fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
fn on_poll(_n: BlockNumber, _weight: &mut WeightMeter)
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Executive
pallet. Read more§fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
fn pre_upgrade() -> Result<Vec<u8>, DispatchError>
§fn post_upgrade(_state: Vec<u8>) -> Result<(), DispatchError>
fn post_upgrade(_state: Vec<u8>) -> Result<(), DispatchError>
§fn offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
Source§impl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>
impl<T: Config<I>, I: 'static> IntegrityTest for Pallet<T, I>
Source§fn integrity_test()
fn integrity_test()
Hooks::integrity_test
].Source§impl<T: Config<I>, I: 'static> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn offchain_worker(n: BlockNumberFor<T>)
fn offchain_worker(n: BlockNumberFor<T>)
Source§impl<T: Config<I>, I: 'static> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn on_finalize(n: BlockNumberFor<T>)
fn on_finalize(n: BlockNumberFor<T>)
Hooks::on_finalize
].Source§impl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnGenesis for Pallet<T, I>
Source§fn on_genesis()
fn on_genesis()
Source§impl<T: Config<I>, I: 'static> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§impl<T: Config<I>, I: 'static> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§fn on_initialize(n: BlockNumberFor<T>) -> Weight
fn on_initialize(n: BlockNumberFor<T>) -> Weight
Hooks::on_initialize
].Source§impl<T: Config<I>, I: 'static> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>
impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for Pallet<T, I>
Source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Hooks::on_runtime_upgrade
].§fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
fn try_on_runtime_upgrade(checks: bool) -> Result<Weight, DispatchError>
pre_upgrade
->
on_runtime_upgrade
-> post_upgrade
hooks for a migration. Read moreSource§impl<T: Config<I>, I: 'static> PalletInfoAccess for Pallet<T, I>
impl<T: Config<I>, I: 'static> PalletInfoAccess for Pallet<T, I>
Source§fn module_name() -> &'static str
fn module_name() -> &'static str
Source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
Source§impl<T: Config<I>, I: 'static> Polling<<T as Config<I>>::Tally> for Pallet<T, I>
impl<T: Config<I>, I: 'static> Polling<<T as Config<I>>::Tally> for Pallet<T, I>
type Index = u32
type Votes = <T as Config<I>>::Votes
type Moment = <<T as Config<I>>::BlockNumberProvider as BlockNumberProvider>::BlockNumber
type Class = <<T as Config<I>>::Tracks as TracksInfo<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <<T as Config<I>>::BlockNumberProvider as BlockNumberProvider>::BlockNumber>>::Id
fn access_poll<R>( index: Self::Index, f: impl FnOnce(PollStatus<&mut T::Tally, BlockNumberFor<T, I>, TrackIdOf<T, I>>) -> R, ) -> R
fn try_access_poll<R>( index: Self::Index, f: impl FnOnce(PollStatus<&mut T::Tally, BlockNumberFor<T, I>, TrackIdOf<T, I>>) -> Result<R, DispatchError>, ) -> Result<R, DispatchError>
Source§fn as_ongoing(index: Self::Index) -> Option<(T::Tally, TrackIdOf<T, I>)>
fn as_ongoing(index: Self::Index) -> Option<(T::Tally, TrackIdOf<T, I>)>
Some
if the referendum index
can be voted on, along with the tally and class of
referendum. Read moreSource§fn create_ongoing(class: Self::Class) -> Result<Self::Index, ()>
fn create_ongoing(class: Self::Class) -> Result<Self::Index, ()>
Source§fn end_ongoing(index: Self::Index, approved: bool) -> Result<(), ()>
fn end_ongoing(index: Self::Index, approved: bool) -> Result<(), ()>
Source§fn max_ongoing() -> (Self::Class, u32)
fn max_ongoing() -> (Self::Class, u32)
u32::max_value()
).Source§impl<T: Config<I>, I: 'static> StorageInfoTrait for Pallet<T, I>
impl<T: Config<I>, I: 'static> StorageInfoTrait for Pallet<T, I>
fn storage_info() -> Vec<StorageInfo>
Source§impl<T: Config<I>, I: 'static> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
impl<T: Config<I>, I: 'static> TryState<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>
Source§impl<T: Config<I>, I: 'static> WhitelistedStorageKeys for Pallet<T, I>
impl<T: Config<I>, I: 'static> WhitelistedStorageKeys for Pallet<T, I>
Source§fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
fn whitelisted_storage_keys() -> Vec<TrackedStorageKey>
Vec<TrackedStorageKey>
indicating the storage keys that
should be whitelisted during benchmarking. This means that those keys
will be excluded from the benchmarking performance calculation.