Struct dock_token_migration::pallet::Pallet
source · pub struct Pallet<T>(_);
Expand description
The pallet implementing the on-chain logic.
Implementations§
source§impl<T: Config> Pallet<T>
impl<T: Config> Pallet<T>
The module declaration.
sourcepub fn migrate(
origin: OriginFor<T>,
recipients: BTreeMap<T::AccountId, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance>
) -> DispatchResult
pub fn migrate( origin: OriginFor<T>, recipients: BTreeMap<T::AccountId, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance> ) -> DispatchResult
Does a token migration. The migrator should have sufficient balance to give tokens to recipients The check whether it is a valid migrator is made inside the SignedExtension. Migrators are assumed to not be adversarial and not do DoS attacks on the chain. They might act in their benefit and try to send more fee txns then allowed which is guarded against. A bad migrator can flood the network with properly signed but invalid txns like trying to pay more than he has, make the network reject his txn but still spend network resources for free.
sourcepub fn expand_migrator(
origin: OriginFor<T>,
migrator: T::AccountId,
increase_migrations_by: u16
) -> DispatchResultWithPostInfo
pub fn expand_migrator( origin: OriginFor<T>, migrator: T::AccountId, increase_migrations_by: u16 ) -> DispatchResultWithPostInfo
Increase the migrators allowed migrations by the given number
sourcepub fn contract_migrator(
origin: OriginFor<T>,
migrator: T::AccountId,
decrease_migrations_by: u16
) -> DispatchResultWithPostInfo
pub fn contract_migrator( origin: OriginFor<T>, migrator: T::AccountId, decrease_migrations_by: u16 ) -> DispatchResultWithPostInfo
Decrease the migrators allowed migrations by the given number
sourcepub fn add_migrator(
origin: OriginFor<T>,
migrator: T::AccountId,
allowed_migrations: u16
) -> DispatchResultWithPostInfo
pub fn add_migrator( origin: OriginFor<T>, migrator: T::AccountId, allowed_migrations: u16 ) -> DispatchResultWithPostInfo
Add a new migrator
sourcepub fn remove_migrator(
origin: OriginFor<T>,
migrator: T::AccountId
) -> DispatchResultWithPostInfo
pub fn remove_migrator( origin: OriginFor<T>, migrator: T::AccountId ) -> DispatchResultWithPostInfo
Remove an existing migrator
sourcepub fn give_bonuses(
origin: OriginFor<T>,
swap_bonus_recips: Vec<(T::AccountId, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, u32)>,
vesting_bonus_recips: Vec<(T::AccountId, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, u32)>
) -> DispatchResult
pub fn give_bonuses( origin: OriginFor<T>, swap_bonus_recips: Vec<(T::AccountId, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, u32)>, vesting_bonus_recips: Vec<(T::AccountId, <<T as Config>::Currency as Currency<<T as Config>::AccountId>>::Balance, u32)> ) -> DispatchResult
Give bonuses to recipients. Only callable by migrator. An alternate data structure of both bonus args could be a map from AccountId -> Set<(amount, offset)>
2 storage entries are touched (read and write) per recipient, its account and bonus. Repeated recipients are not counted. Locks don’t contribute to DB weight as once an account data is read from disk, locks are loaded as well Ignoring weight of in-memory operations
sourcepub fn claim_bonus(origin: OriginFor<T>) -> DispatchResult
pub fn claim_bonus(origin: OriginFor<T>) -> DispatchResult
sourcepub fn claim_bonus_for_other(
origin: OriginFor<T>,
target: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn claim_bonus_for_other( origin: OriginFor<T>, target: <T::Lookup as StaticLookup>::Source ) -> DispatchResult
sourcepub fn claim_swap_bonus(origin: OriginFor<T>) -> DispatchResult
pub fn claim_swap_bonus(origin: OriginFor<T>) -> DispatchResult
sourcepub fn claim_swap_bonus_for_other(
origin: OriginFor<T>,
target: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn claim_swap_bonus_for_other( origin: OriginFor<T>, target: <T::Lookup as StaticLookup>::Source ) -> DispatchResult
sourcepub fn claim_vesting_bonus(origin: OriginFor<T>) -> DispatchResult
pub fn claim_vesting_bonus(origin: OriginFor<T>) -> DispatchResult
sourcepub fn claim_vesting_bonus_for_other(
origin: OriginFor<T>,
target: <T::Lookup as StaticLookup>::Source
) -> DispatchResult
pub fn claim_vesting_bonus_for_other( origin: OriginFor<T>, target: <T::Lookup as StaticLookup>::Source ) -> DispatchResult
Trait Implementations§
source§impl<T: Config> GetStorageVersion for Pallet<T>
impl<T: Config> GetStorageVersion for Pallet<T>
source§fn current_storage_version() -> StorageVersion
fn current_storage_version() -> StorageVersion
source§fn on_chain_storage_version() -> StorageVersion
fn on_chain_storage_version() -> StorageVersion
source§impl<T: Config> Hooks<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> Hooks<<T as Config>::BlockNumber> for Pallet<T>
§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
on_finalize
).
Implement to have something happen using the remaining weight.
Will not fire if the remaining weight is 0.
Return the weight used, the hook will subtract it from current weight used
and pass the result to the next on_idle
hook if it exists.§fn on_initialize(_n: BlockNumber) -> Weight
fn on_initialize(_n: BlockNumber) -> Weight
§fn on_runtime_upgrade() -> Weight
fn on_runtime_upgrade() -> Weight
§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()
source§impl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OffchainWorker<<T as Config>::BlockNumber> for Pallet<T>
source§fn offchain_worker(n: <T as Config>::BlockNumber)
fn offchain_worker(n: <T as Config>::BlockNumber)
source§impl<T: Config> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OnFinalize<<T as Config>::BlockNumber> for Pallet<T>
source§fn on_finalize(n: <T as Config>::BlockNumber)
fn on_finalize(n: <T as Config>::BlockNumber)
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>::BlockNumber> for Pallet<T>
impl<T: Config> OnIdle<<T as Config>::BlockNumber> for Pallet<T>
source§fn on_idle(n: <T as Config>::BlockNumber, remaining_weight: Weight) -> Weight
fn on_idle(n: <T as Config>::BlockNumber, remaining_weight: Weight) -> Weight
remaining_weight
to make sure it is high enough to allow for
your pallet’s extra computation. Read moresource§impl<T: Config> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>
impl<T: Config> OnInitialize<<T as Config>::BlockNumber> for Pallet<T>
source§fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
fn on_initialize(n: <T as Config>::BlockNumber) -> Weight
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
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> PartialEq<Pallet<T>> for Pallet<T>
impl<T> PartialEq<Pallet<T>> for Pallet<T>
impl<T> Eq for Pallet<T>
Auto Trait Implementations§
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> 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>,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§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>
§impl<T> IsType<T> for T
impl<T> IsType<T> for T
§impl<T> PalletVersionToStorageVersionHelper for Twhere
T: GetStorageVersion + PalletInfoAccess,
impl<T> PalletVersionToStorageVersionHelper for Twhere T: GetStorageVersion + PalletInfoAccess,
§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<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 Swhere
T: Bounded,
S: TryInto<T>,
impl<T, S> UniqueSaturatedInto<T> for Swhere T: Bounded, S: TryInto<T>,
§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T
.