pub struct Pallet<T>(/* private fields */);
Expand description
The Pallet
struct, the main type that implements traits and standalone
functions within the pallet.
Implementations§
Source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
Sourcepub fn add_allocator(
origin: OriginFor<T>,
key: <T as Config>::AccountId,
) -> DispatchResult
pub fn add_allocator( origin: OriginFor<T>, key: <T as Config>::AccountId, ) -> DispatchResult
Adds a new allocator to the list. Only available for the root key.
Sourcepub fn remove_allocator(
origin: OriginFor<T>,
key: <T as Config>::AccountId,
) -> DispatchResult
pub fn remove_allocator( origin: OriginFor<T>, key: <T as Config>::AccountId, ) -> DispatchResult
Removes an existing allocator from the list. Only available for the root key.
Sourcepub fn add_to_whitelist(
origin: OriginFor<T>,
key: <T as Config>::AccountId,
) -> DispatchResult
pub fn add_to_whitelist( origin: OriginFor<T>, key: <T as Config>::AccountId, ) -> DispatchResult
Forcefully adds a new agent to the whitelist. Only available for the root key or curators.
Sourcepub fn remove_from_whitelist(
origin: OriginFor<T>,
key: <T as Config>::AccountId,
) -> DispatchResult
pub fn remove_from_whitelist( origin: OriginFor<T>, key: <T as Config>::AccountId, ) -> DispatchResult
Forcefully removes an agent from the whitelist. Only available for the root key or curators.
Sourcepub fn accept_application(
origin: OriginFor<T>,
application_id: u32,
) -> DispatchResult
pub fn accept_application( origin: OriginFor<T>, application_id: u32, ) -> DispatchResult
Accepts an agent application. Only available for the root key or curators.
Sourcepub fn deny_application(
origin: OriginFor<T>,
application_id: u32,
) -> DispatchResult
pub fn deny_application( origin: OriginFor<T>, application_id: u32, ) -> DispatchResult
Denies an agent application. Only available for the root key or curators.
Sourcepub fn penalize_agent(
origin: OriginFor<T>,
agent_key: <T as Config>::AccountId,
percentage: u8,
) -> DispatchResult
pub fn penalize_agent( origin: OriginFor<T>, agent_key: <T as Config>::AccountId, percentage: u8, ) -> DispatchResult
Sets a penalty factor to the given agent emissions. Only available for the root key or curators.
Sourcepub fn submit_application(
origin: OriginFor<T>,
agent_key: <T as Config>::AccountId,
metadata: Vec<u8>,
removing: bool,
) -> DispatchResult
pub fn submit_application( origin: OriginFor<T>, agent_key: <T as Config>::AccountId, metadata: Vec<u8>, removing: bool, ) -> DispatchResult
Submits a new agent application on behalf of a given key.
Sourcepub fn add_global_params_proposal(
origin: OriginFor<T>,
data: GlobalParamsData<T>,
metadata: Vec<u8>,
) -> DispatchResult
pub fn add_global_params_proposal( origin: OriginFor<T>, data: GlobalParamsData<T>, metadata: Vec<u8>, ) -> DispatchResult
Creates a new global parameters proposal.
Sourcepub fn add_global_custom_proposal(
origin: OriginFor<T>,
metadata: Vec<u8>,
) -> DispatchResult
pub fn add_global_custom_proposal( origin: OriginFor<T>, metadata: Vec<u8>, ) -> DispatchResult
Creates a new custom global proposal.
Sourcepub fn add_dao_treasury_transfer_proposal(
origin: OriginFor<T>,
value: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance,
destination_key: <T as Config>::AccountId,
data: Vec<u8>,
) -> DispatchResult
pub fn add_dao_treasury_transfer_proposal( origin: OriginFor<T>, value: <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, destination_key: <T as Config>::AccountId, data: Vec<u8>, ) -> DispatchResult
Creates a proposal moving funds from the treasury account to the given key.
Sourcepub fn vote_proposal(
origin: OriginFor<T>,
proposal_id: u64,
agree: bool,
) -> DispatchResult
pub fn vote_proposal( origin: OriginFor<T>, proposal_id: u64, agree: bool, ) -> DispatchResult
Casts a vote for an open proposal.
Sourcepub fn remove_vote_proposal(
origin: OriginFor<T>,
proposal_id: u64,
) -> DispatchResult
pub fn remove_vote_proposal( origin: OriginFor<T>, proposal_id: u64, ) -> DispatchResult
Removes a casted vote for an open proposal.
Sourcepub fn enable_vote_delegation(origin: OriginFor<T>) -> DispatchResult
pub fn enable_vote_delegation(origin: OriginFor<T>) -> DispatchResult
Enables vote power delegation.
Sourcepub fn disable_vote_delegation(origin: OriginFor<T>) -> DispatchResult
pub fn disable_vote_delegation(origin: OriginFor<T>) -> DispatchResult
Disables vote power delegation.
Sourcepub fn add_emission_proposal(
origin: OriginFor<T>,
recycling_percentage: Percent,
treasury_percentage: Percent,
incentives_ratio: Percent,
data: Vec<u8>,
) -> DispatchResult
pub fn add_emission_proposal( origin: OriginFor<T>, recycling_percentage: Percent, treasury_percentage: Percent, incentives_ratio: Percent, data: Vec<u8>, ) -> DispatchResult
Creates a new emission percentage proposal.
Sourcepub fn set_emission_params(
origin: OriginFor<T>,
recycling_percentage: Percent,
treasury_percentage: Percent,
) -> DispatchResult
pub fn set_emission_params( origin: OriginFor<T>, recycling_percentage: Percent, treasury_percentage: Percent, ) -> DispatchResult
Forcefully sets emission percentages. Only available for the root key.
pub fn toggle_agent_freezing(origin: OriginFor<T>) -> DispatchResult
pub fn toggle_namespace_freezing(origin: OriginFor<T>) -> DispatchResult
Trait Implementations§
Source§impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>
impl<T: Config> BeforeAllRuntimeMigrations for Pallet<T>
Source§fn before_all_runtime_migrations() -> Weight
fn before_all_runtime_migrations() -> Weight
Source§impl<T: Config> GetStorageVersion for Pallet<T>
impl<T: Config> GetStorageVersion for Pallet<T>
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> GovernanceApi<<T as Config>::AccountId> for Pallet<T>
impl<T: Config> GovernanceApi<<T as Config>::AccountId> for Pallet<T>
fn dao_treasury_address() -> T::AccountId
fn treasury_emission_fee() -> Percent
fn is_whitelisted(key: &T::AccountId) -> bool
fn ensure_allocator(key: &T::AccountId) -> DispatchResult
fn get_allocators() -> impl Iterator<Item = T::AccountId>
fn set_allocator(key: &T::AccountId)
fn can_create_namespace(key: &T::AccountId) -> bool
fn can_register_agent(key: &T::AccountId) -> bool
Source§impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> Hooks<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
Source§fn on_initialize(block_number: BlockNumberFor<T>) -> Weight
fn on_initialize(block_number: BlockNumberFor<T>) -> 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()
Source§impl<T: Config> IntegrityTest for Pallet<T>
impl<T: Config> IntegrityTest for Pallet<T>
Source§fn integrity_test()
fn integrity_test()
Hooks::integrity_test
].Source§impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OffchainWorker<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
Source§fn offchain_worker(n: BlockNumberFor<T>)
fn offchain_worker(n: BlockNumberFor<T>)
Source§impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnFinalize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
Source§fn on_finalize(n: BlockNumberFor<T>)
fn on_finalize(n: BlockNumberFor<T>)
Hooks::on_finalize
].Source§impl<T: Config> OnGenesis for Pallet<T>
impl<T: Config> OnGenesis for Pallet<T>
Source§fn on_genesis()
fn on_genesis()
Source§impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnIdle<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
Source§impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnInitialize<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
Source§fn on_initialize(n: BlockNumberFor<T>) -> Weight
fn on_initialize(n: BlockNumberFor<T>) -> Weight
Hooks::on_initialize
].Source§impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
impl<T: Config> OnPoll<<<<T as Config>::Block as HeaderProvider>::HeaderT as Header>::Number> for Pallet<T>
Source§impl<T: Config> OnRuntimeUpgrade for Pallet<T>
impl<T: Config> OnRuntimeUpgrade for Pallet<T>
Source§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
Hooks::on_runtime_upgrade
].Source§impl<T: Config> PalletInfoAccess for Pallet<T>
impl<T: Config> PalletInfoAccess for Pallet<T>
Source§fn module_name() -> &'static str
fn module_name() -> &'static str
Source§fn crate_version() -> CrateVersion
fn crate_version() -> CrateVersion
Source§impl<T: Config> WhitelistedStorageKeys for Pallet<T>
impl<T: Config> WhitelistedStorageKeys for Pallet<T>
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.impl<T> Eq for Pallet<T>
Auto Trait Implementations§
impl<T> Freeze for Pallet<T>
impl<T> RefUnwindSafe for Pallet<T>where
T: RefUnwindSafe,
impl<T> Send for Pallet<T>where
T: Send,
impl<T> Sync for Pallet<T>where
T: Sync,
impl<T> Unpin for Pallet<T>where
T: Unpin,
impl<T> UnwindSafe for Pallet<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
§fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
fn checked_from<T>(t: T) -> Option<Self>where
Self: TryFrom<T>,
§fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
fn checked_into<T>(self) -> Option<T>where
Self: TryInto<T>,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T
. Read more§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.