Type Alias moonriver_runtime::ConvictionVoting
source · pub type ConvictionVoting = Pallet<Runtime>;
Aliased Type§
struct ConvictionVoting(/* private fields */);
Implementations
§impl<T, I> Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> Pallet<T, I>where
T: Config<I>,
I: 'static,
pub fn vote(
origin: <T as Config>::RuntimeOrigin,
poll_index: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Index,
vote: AccountVote<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance>
) -> Result<(), DispatchError>
pub fn vote( origin: <T as Config>::RuntimeOrigin, poll_index: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Index, vote: AccountVote<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance> ) -> Result<(), DispatchError>
Vote in a poll. If vote.is_aye()
, the vote is to enact the proposal;
otherwise it is a vote to keep the status quo.
The dispatch origin of this call must be Signed.
poll_index
: The index of the poll to vote for.vote
: The vote configuration.
Weight: O(R)
where R is the number of polls the voter has voted on.
pub fn delegate(
origin: <T as Config>::RuntimeOrigin,
class: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class,
to: <<T as Config>::Lookup as StaticLookup>::Source,
conviction: Conviction,
balance: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn delegate( origin: <T as Config>::RuntimeOrigin, class: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class, to: <<T as Config>::Lookup as StaticLookup>::Source, conviction: Conviction, balance: <<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Delegate the voting power (with some given conviction) of the sending account for a particular class of polls.
The balance delegated is locked for as long as it’s delegated, and thereafter for the time appropriate for the conviction’s lock period.
The dispatch origin of this call must be Signed, and the signing account must either:
-
be delegating already; or
-
have no voting activity (if there is, then it will need to be removed through
remove_vote
). -
to
: The account whose voting thetarget
account’s voting power will follow. -
class
: The class of polls to delegate. To delegate multiple classes, multiple calls to this function are required. -
conviction
: The conviction that will be attached to the delegated votes. When the account is undelegated, the funds will be locked for the corresponding period. -
balance
: The amount of the account’s balance to be used in delegating. This must not be more than the account’s current balance.
Emits Delegated
.
Weight: O(R)
where R is the number of polls the voter delegating to has
voted on. Weight is initially charged as if maximum votes, but is refunded later.
pub fn undelegate(
origin: <T as Config>::RuntimeOrigin,
class: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class
) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
pub fn undelegate( origin: <T as Config>::RuntimeOrigin, class: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class ) -> Result<PostDispatchInfo, DispatchErrorWithPostInfo<PostDispatchInfo>>
Undelegate the voting power of the sending account for a particular class of polls.
Tokens may be unlocked following once an amount of time consistent with the lock period of the conviction with which the delegation was issued has passed.
The dispatch origin of this call must be Signed and the signing account must be currently delegating.
class
: The class of polls to remove the delegation from.
Emits Undelegated
.
Weight: O(R)
where R is the number of polls the voter delegating to has
voted on. Weight is initially charged as if maximum votes, but is refunded later.
pub fn unlock(
origin: <T as Config>::RuntimeOrigin,
class: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class,
target: <<T as Config>::Lookup as StaticLookup>::Source
) -> Result<(), DispatchError>
pub fn unlock( origin: <T as Config>::RuntimeOrigin, class: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class, target: <<T as Config>::Lookup as StaticLookup>::Source ) -> Result<(), DispatchError>
Remove the lock caused by prior voting/delegating which has expired within a particular class.
The dispatch origin of this call must be Signed.
class
: The class of polls to unlock.target
: The account to remove the lock on.
Weight: O(R)
with R number of vote of target.
pub fn remove_vote(
origin: <T as Config>::RuntimeOrigin,
class: Option<<<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class>,
index: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Index
) -> Result<(), DispatchError>
pub fn remove_vote( origin: <T as Config>::RuntimeOrigin, class: Option<<<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class>, index: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Index ) -> Result<(), DispatchError>
Remove a vote for a poll.
If:
- the poll was cancelled, or
- the poll is ongoing, or
- the poll has ended such that
- the vote of the account was in opposition to the result; or
- there was no conviction to the account’s vote; or
- the account made a split vote
…then the vote is removed cleanly and a following call to
unlock
may result in more funds being available.
If, however, the poll has ended and:
- it finished corresponding to the vote of the account, and
- the account made a standard vote with conviction, and
- the lock period of the conviction is not over …then the lock will be aggregated into the overall account’s lock, which may involve overlocking (where the two locks are combined into a single lock that is the maximum of both the amount locked and the time is it locked for).
The dispatch origin of this call must be Signed, and the signer must have a vote
registered for poll index
.
index
: The index of poll of the vote to be removed.class
: Optional parameter, if given it indicates the class of the poll. For polls which have finished or are cancelled, this must beSome
.
Weight: O(R + log R)
where R is the number of polls that target
has voted on.
Weight is calculated for the maximum number of vote.
pub fn remove_other_vote(
origin: <T as Config>::RuntimeOrigin,
target: <<T as Config>::Lookup as StaticLookup>::Source,
class: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class,
index: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Index
) -> Result<(), DispatchError>
pub fn remove_other_vote( origin: <T as Config>::RuntimeOrigin, target: <<T as Config>::Lookup as StaticLookup>::Source, class: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Class, index: <<T as Config<I>>::Polls as Polling<Tally<<<T as Config<I>>::Currency as Currency<<T as Config>::AccountId>>::Balance, <T as Config<I>>::MaxTurnout>>>::Index ) -> Result<(), DispatchError>
Remove a vote for a poll.
If the target
is equal to the signer, then this function is exactly equivalent to
remove_vote
. If not equal to the signer, then the vote must have expired,
either because the poll was cancelled, because the voter lost the poll or
because the conviction period is over.
The dispatch origin of this call must be Signed.
target
: The account of the vote to be removed; this account must have voted for pollindex
.index
: The index of poll of the vote to be removed.class
: The class of the poll.
Weight: O(R + log R)
where R is the number of polls that target
has voted on.
Weight is calculated for the maximum number of vote.
Trait Implementations
§impl<T, I> PalletInfoAccess for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> PalletInfoAccess for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn module_name() -> &'static str
fn module_name() -> &'static str
§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
§impl<T, I> WhitelistedStorageKeys for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> WhitelistedStorageKeys for Pallet<T, I>where
T: Config<I>,
I: 'static,
§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.§impl<T, I> GetStorageVersion for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> GetStorageVersion for Pallet<T, I>where
T: Config<I>,
I: 'static,
§type InCodeStorageVersion = NoStorageVersionSet
type InCodeStorageVersion = NoStorageVersionSet
§fn in_code_storage_version(
) -> <Pallet<T, I> as GetStorageVersion>::InCodeStorageVersion
fn in_code_storage_version( ) -> <Pallet<T, I> as GetStorageVersion>::InCodeStorageVersion
storage_version
attribute, or
[NoStorageVersionSet
] if the attribute is missing.§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 more§impl<T, I> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn offchain_worker(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
)
fn offchain_worker( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number )
§impl<T, I> OnRuntimeUpgrade for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnRuntimeUpgrade for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Hooks::on_runtime_upgrade
].§impl<T, I> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§impl<T, I> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§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 offchain_worker(_n: BlockNumber)
fn offchain_worker(_n: BlockNumber)
§fn integrity_test()
fn integrity_test()
§impl<T, I> PalletsInfoAccess for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> PalletsInfoAccess for Pallet<T, I>where
T: Config<I>,
I: 'static,
§impl<T, I> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_initialize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
) -> Weight
fn on_initialize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number ) -> Weight
Hooks::on_initialize
].§impl<T, I> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_finalize(
n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number
)
fn on_finalize( n: <<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number )
Hooks::on_finalize
].§impl<T, I> Callable<T> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> Callable<T> for Pallet<T, I>where
T: Config<I>,
I: 'static,
type RuntimeCall = Call<T, I>
§impl<T, I> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T, I>where
T: Config<I>,
I: 'static,
§impl<T, I> OnGenesis for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> OnGenesis for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn on_genesis()
fn on_genesis()
§impl<T, I> PartialEq for Pallet<T, I>
impl<T, I> PartialEq for Pallet<T, I>
impl<T, I> Eq for Pallet<T, I>
§impl<T, I> BeforeAllRuntimeMigrations for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> BeforeAllRuntimeMigrations for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
§impl<T, I> IntegrityTest for Pallet<T, I>where
T: Config<I>,
I: 'static,
impl<T, I> IntegrityTest for Pallet<T, I>where
T: Config<I>,
I: 'static,
§fn integrity_test()
fn integrity_test()
Hooks::integrity_test
].