difftreelog
code refactor & comments
in: master
12 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -12147,7 +12147,7 @@
[[package]]
name = "uc-rpc"
-version = "0.1.3"
+version = "0.1.4"
dependencies = [
"anyhow",
"app-promotion-rpc",
client/rpc/CHANGELOG.mddiffbeforeafterboth--- a/client/rpc/CHANGELOG.md
+++ b/client/rpc/CHANGELOG.md
@@ -3,15 +3,21 @@
All notable changes to this project will be documented in this file.
<!-- bureaucrate goes here -->
+
+## [v0.1.4] 2022-09-08
+
+### Added
+- Support RPC for `AppPromotion` pallet.
+
## [v0.1.3] 2022-08-16
### Other changes
-- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a
+- build: Upgrade polkadot to v0.9.27 2c498572636f2b34d53b1c51b7283a761a7dc90a
-- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf8
+- build: Upgrade polkadot to v0.9.26 85515e54c4ca1b82a2630034e55dcc804c643bf8
-- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
+- build: Upgrade polkadot to v0.9.25 cdfb9bdc7b205ff1b5134f034ef9973d769e5e6b
## [0.1.2] - 2022-08-12
client/rpc/Cargo.tomldiffbeforeafterboth--- a/client/rpc/Cargo.toml
+++ b/client/rpc/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "uc-rpc"
-version = "0.1.3"
+version = "0.1.4"
license = "GPLv3"
edition = "2021"
pallets/app-promotion/src/lib.rsdiffbeforeafterboth--- a/pallets/app-promotion/src/lib.rs
+++ b/pallets/app-promotion/src/lib.rs
@@ -22,9 +22,6 @@
//!
//! ### Dispatchable Functions
//!
-//! * `start_inflation` - This method sets the inflation start date. Can be only called once.
-//! Inflation start block can be backdated and will catch up. The method will create Treasury
-//! account if it does not exist and perform the first inflation deposit.
// #![recursion_limit = "1024"]
#![cfg_attr(not(feature = "std"), no_std)]
@@ -48,7 +45,6 @@
use pallet_balances::BalanceLock;
pub use types::*;
-// use up_common::constants::{DAYS, UNIQUE};
use up_data_structs::CollectionId;
use frame_support::{
@@ -87,16 +83,20 @@
#[pallet::config]
pub trait Config: frame_system::Config + pallet_evm::account::Config {
+ /// Type to interact with the native token
type Currency: ExtendedLockableCurrency<Self::AccountId>
+ ReservableCurrency<Self::AccountId>;
+ /// Type for interacting with collections
type CollectionHandler: CollectionHandler<
AccountId = Self::AccountId,
CollectionId = CollectionId,
>;
+ /// Type for interacting with conrtacts
type ContractHandler: ContractHandler<AccountId = Self::CrossAccountId, ContractId = H160>;
+ /// ID for treasury
type TreasuryAccountId: Get<Self::AccountId>;
/// The app's pallet id, used for deriving its sovereign account ID.
@@ -106,15 +106,18 @@
/// In relay blocks.
#[pallet::constant]
type RecalculationInterval: Get<Self::BlockNumber>;
- /// In relay blocks.
+
+ /// In parachain blocks.
#[pallet::constant]
type PendingInterval: Get<Self::BlockNumber>;
+ /// Rate of return for interval in blocks defined in `RecalculationInterval`.
#[pallet::constant]
- type Nominal: Get<BalanceOf<Self>>;
+ type IntervalIncome: Get<Perbill>;
+ /// Decimals for the `Currency`.
#[pallet::constant]
- type IntervalIncome: Get<Perbill>;
+ type Nominal: Get<BalanceOf<Self>>;
/// Weight information for extrinsics in this pallet.
type WeightInfo: WeightInfo;
@@ -133,6 +136,12 @@
#[pallet::event]
#[pallet::generate_deposit(fn deposit_event)]
pub enum Event<T: Config> {
+ /// Staking recalculation was performed
+ ///
+ /// # Arguments
+ /// * AccountId: ID of the staker.
+ /// * Balance : recalculation base
+ /// * Balance : total income
StakingRecalculation(
/// An recalculated staker
T::AccountId,
@@ -141,22 +150,42 @@
/// Amount of accrued interest
BalanceOf<T>,
),
+
+ /// Staking was performed
+ ///
+ /// # Arguments
+ /// * AccountId: ID of the staker
+ /// * Balance : staking amount
Stake(T::AccountId, BalanceOf<T>),
+
+ /// Unstaking was performed
+ ///
+ /// # Arguments
+ /// * AccountId: ID of the staker
+ /// * Balance : unstaking amount
Unstake(T::AccountId, BalanceOf<T>),
+
+ /// The admin was set
+ ///
+ /// # Arguments
+ /// * AccountId: ID of the admin
SetAdmin(T::AccountId),
}
#[pallet::error]
pub enum Error<T> {
- /// Error due to action requiring admin to be set
+ /// Error due to action requiring admin to be set.
AdminNotSet,
- /// No permission to perform an action
+ /// No permission to perform an action.
NoPermission,
- /// Insufficient funds to perform an action
+ /// Insufficient funds to perform an action.
NotSufficientFunds,
+ /// Occurs when a pending unstake cannot be added in this block. PENDING_LIMIT_PER_BLOCK` limits exceeded.
PendingForBlockOverflow,
- /// An error related to the fact that an invalid argument was passed to perform an action
+ /// The error is due to the fact that the collection/contract must already be sponsored in order to perform the action.
SponsorNotSet,
+ /// Errors caused by incorrect actions with a locked balance.
+ IncorrectLockedBalanceOperation,
}
#[pallet::storage]
@@ -189,7 +218,7 @@
ValueQuery,
>;
- /// Stores hash a record for which the last revenue recalculation was performed.
+ /// Stores a key for record for which the next revenue recalculation would be performed.
/// If `None`, then recalculation has not yet been performed or calculations have been completed for all stakers.
#[pallet::storage]
#[pallet::getter(fn get_next_calculated_record)]
@@ -198,6 +227,9 @@
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
+ /// Block overflow is impossible due to the fact that the unstake algorithm in on_initialize
+ /// implies the execution of a strictly limited number of relatively lightweight operations.
+ /// A separate benchmark has been implemented to scale the weight depending on the number of pendings.
fn on_initialize(current_block_number: T::BlockNumber) -> Weight
where
<T as frame_system::Config>::BlockNumber: From<u32>,
@@ -242,15 +274,13 @@
);
ensure!(
- amount >= Into::<BalanceOf<T>>::into(100u128) * T::Nominal::get(),
+ amount >= <BalanceOf<T>>::from(100u128) * T::Nominal::get(),
ArithmeticError::Underflow
);
let balance =
<<T as Config>::Currency as Currency<T::AccountId>>::free_balance(&staker_id);
- // ensure!(balance >= amount, ArithmeticError::Underflow);
-
<<T as Config>::Currency as Currency<T::AccountId>>::ensure_can_withdraw(
&staker_id,
amount,
@@ -325,7 +355,7 @@
<PendingUnstake<T>>::insert(block, pendings);
- Self::unlock_balance_unchecked(&staker_id, total_staked);
+ Self::unlock_balance(&staker_id, total_staked)?;
<T::Currency as ReservableCurrency<T::AccountId>>::reserve(&staker_id, total_staked)?;
@@ -400,8 +430,9 @@
);
ensure!(
- T::ContractHandler::sponsor(contract_id)?.ok_or(<Error<T>>::SponsorNotSet)?
- == T::CrossAccountId::from_sub(Self::account_id()),
+ T::ContractHandler::sponsor(contract_id)?
+ .ok_or(<Error<T>>::SponsorNotSet)?
+ .as_sub() == &Self::account_id(),
<Error<T>>::NoPermission
);
T::ContractHandler::remove_contract_sponsor(contract_id)
@@ -469,77 +500,9 @@
// / T::RecalculationInterval::get())
// .into() + 1,
// &mut income_acc,
- // );
- // }
- // }
- // }
-
- // {
- // let mut stakers_number = stakers_number.unwrap_or(20);
- // let last_id = RefCell::new(None);
- // let income_acc = RefCell::new(BalanceOf::<T>::default());
- // let amount_acc = RefCell::new(BalanceOf::<T>::default());
-
- // let flush_stake = || -> DispatchResult {
- // if let Some(last_id) = &*last_id.borrow() {
- // if !income_acc.borrow().is_zero() {
- // <T::Currency as Currency<T::AccountId>>::transfer(
- // &T::TreasuryAccountId::get(),
- // last_id,
- // *income_acc.borrow(),
- // ExistenceRequirement::KeepAlive,
- // )
- // .and_then(|_| {
- // Self::add_lock_balance(last_id, *income_acc.borrow());
- // <TotalStaked<T>>::try_mutate(|staked| {
- // staked
- // .checked_add(&*income_acc.borrow())
- // .ok_or(ArithmeticError::Overflow.into())
- // })
- // })?;
-
- // Self::deposit_event(Event::StakingRecalculation(
- // last_id.clone(),
- // *amount_acc.borrow(),
- // *income_acc.borrow(),
- // ));
- // }
-
- // *income_acc.borrow_mut() = BalanceOf::<T>::default();
- // *amount_acc.borrow_mut() = BalanceOf::<T>::default();
- // }
- // Ok(())
- // };
-
- // while let Some((
- // (current_id, staked_block),
- // (amount, next_recalc_block_for_stake),
- // )) = storage_iterator.next()
- // {
- // if stakers_number == 0 {
- // NextCalculatedRecord::<T>::set(Some((current_id, staked_block)));
- // break;
- // }
- // stakers_number -= 1;
- // if last_id.borrow().as_ref() != Some(¤t_id) {
- // flush_stake()?;
- // };
- // *last_id.borrow_mut() = Some(current_id.clone());
- // if current_recalc_block >= next_recalc_block_for_stake {
- // *amount_acc.borrow_mut() += amount;
- // Self::recalculate_and_insert_stake(
- // ¤t_id,
- // staked_block,
- // next_recalc_block,
- // amount,
- // ((current_recalc_block - next_recalc_block_for_stake)
- // / T::RecalculationInterval::get())
- // .into() + 1,
- // &mut *income_acc.borrow_mut(),
// );
// }
// }
- // flush_stake()?;
// }
{
@@ -620,10 +583,20 @@
T::PalletId::get().into_account_truncating()
}
- fn unlock_balance_unchecked(staker: &T::AccountId, amount: BalanceOf<T>) {
- let mut locked_balance = Self::get_locked_balance(staker).map(|l| l.amount).unwrap();
- locked_balance -= amount;
- Self::set_lock_unchecked(staker, locked_balance);
+ fn unlock_balance(staker: &T::AccountId, amount: BalanceOf<T>) -> DispatchResult {
+ let locked_balance = Self::get_locked_balance(staker)
+ .map(|l| l.amount)
+ .ok_or(<Error<T>>::IncorrectLockedBalanceOperation)?;
+
+ // It is understood that we cannot unlock more funds than were locked by staking.
+ // Therefore, if implemented correctly, this error should not occur.
+ Self::set_lock_unchecked(
+ staker,
+ locked_balance
+ .checked_sub(&amount)
+ .ok_or(ArithmeticError::Underflow)?,
+ );
+ Ok(())
}
fn add_lock_balance(staker: &T::AccountId, amount: BalanceOf<T>) -> DispatchResult {
@@ -745,6 +718,9 @@
where
<<T as Config>::Currency as Currency<T::AccountId>>::Balance: Sum,
{
+ /// Since user funds are not transferred anywhere by staking, overflow protection is provided
+ /// at the level of the associated type `Balance` of `Currency` trait. In order to overflow,
+ /// the staker must have more funds on his account than the maximum set for `Balance` type.
pub fn cross_id_pending_unstake(staker: Option<T::CrossAccountId>) -> BalanceOf<T> {
staker.map_or(
PendingUnstake::<T>::iter_values()
pallets/unique/CHANGELOG.mddiffbeforeafterboth--- a/pallets/unique/CHANGELOG.md
+++ b/pallets/unique/CHANGELOG.md
@@ -8,6 +8,8 @@
### Added
+- Methods `force_set_sponsor` , `force_remove_collection_sponsor` to be able to administer sponsorships with other pallets. Added to implement `AppPromotion` pallet logic.
+
## [v0.1.3] 2022-08-16
### Other changes
tests/src/interfaces/augment-api-consts.tsdiffbeforeafterboth1// Auto-generated via `yarn polkadot-types-from-chain`, do not edit2/* eslint-disable */34// import type lookup before we augment - in some environments5// this is required to allow for ambient/previous definitions6import '@polkadot/api-base/types/consts';78import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';9import type { Option, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';10import type { Codec } from '@polkadot/types-codec/types';11import type { Perbill, Permill } from '@polkadot/types/interfaces/runtime';12import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, SpVersionRuntimeVersion } from '@polkadot/types/lookup';1314export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;1516declare module '@polkadot/api-base/types/consts' {17 interface AugmentedConsts<ApiType extends ApiTypes> {18 appPromotion: {19 intervalIncome: Perbill & AugmentedConst<ApiType>;20 nominal: u128 & AugmentedConst<ApiType>;21 /**22 * The app's pallet id, used for deriving its sovereign account ID.23 **/24 palletId: FrameSupportPalletId & AugmentedConst<ApiType>;25 /**26 * In relay blocks.27 **/28 pendingInterval: u32 & AugmentedConst<ApiType>;29 /**30 * In relay blocks.31 **/32 recalculationInterval: u32 & AugmentedConst<ApiType>;33 /**34 * Generic const35 **/36 [key: string]: Codec;37 };38 balances: {39 /**40 * The minimum amount required to keep an account open.41 **/42 existentialDeposit: u128 & AugmentedConst<ApiType>;43 /**44 * The maximum number of locks that should exist on an account.45 * Not strictly enforced, but used for weight estimation.46 **/47 maxLocks: u32 & AugmentedConst<ApiType>;48 /**49 * The maximum number of named reserves that can exist on an account.50 **/51 maxReserves: u32 & AugmentedConst<ApiType>;52 /**53 * Generic const54 **/55 [key: string]: Codec;56 };57 common: {58 /**59 * Maximum admins per collection.60 **/61 collectionAdminsLimit: u32 & AugmentedConst<ApiType>;62 /**63 * Set price to create a collection.64 **/65 collectionCreationPrice: u128 & AugmentedConst<ApiType>;66 /**67 * Generic const68 **/69 [key: string]: Codec;70 };71 configuration: {72 defaultMinGasPrice: u64 & AugmentedConst<ApiType>;73 defaultWeightToFeeCoefficient: u32 & AugmentedConst<ApiType>;74 /**75 * Generic const76 **/77 [key: string]: Codec;78 };79 inflation: {80 /**81 * Number of blocks that pass between treasury balance updates due to inflation82 **/83 inflationBlockInterval: u32 & AugmentedConst<ApiType>;84 /**85 * Generic const86 **/87 [key: string]: Codec;88 };89 scheduler: {90 /**91 * The maximum weight that may be scheduled per block for any dispatchables of less92 * priority than `schedule::HARD_DEADLINE`.93 **/94 maximumWeight: u64 & AugmentedConst<ApiType>;95 /**96 * The maximum number of scheduled calls in the queue for a single block.97 * Not strictly enforced, but used for weight estimation.98 **/99 maxScheduledPerBlock: u32 & AugmentedConst<ApiType>;100 /**101 * Generic const102 **/103 [key: string]: Codec;104 };105 system: {106 /**107 * Maximum number of block number to block hash mappings to keep (oldest pruned first).108 **/109 blockHashCount: u32 & AugmentedConst<ApiType>;110 /**111 * The maximum length of a block (in bytes).112 **/113 blockLength: FrameSystemLimitsBlockLength & AugmentedConst<ApiType>;114 /**115 * Block & extrinsics weights: base values and limits.116 **/117 blockWeights: FrameSystemLimitsBlockWeights & AugmentedConst<ApiType>;118 /**119 * The weight of runtime database operations the runtime can invoke.120 **/121 dbWeight: FrameSupportWeightsRuntimeDbWeight & AugmentedConst<ApiType>;122 /**123 * The designated SS85 prefix of this chain.124 * 125 * This replaces the "ss58Format" property declared in the chain spec. Reason is126 * that the runtime should know about the prefix in order to make use of it as127 * an identifier of the chain.128 **/129 ss58Prefix: u16 & AugmentedConst<ApiType>;130 /**131 * Get the chain's current version.132 **/133 version: SpVersionRuntimeVersion & AugmentedConst<ApiType>;134 /**135 * Generic const136 **/137 [key: string]: Codec;138 };139 timestamp: {140 /**141 * The minimum period between blocks. Beware that this is different to the *expected*142 * period that the block production apparatus provides. Your chosen consensus system will143 * generally work with this to determine a sensible block time. e.g. For Aura, it will be144 * double this period on default settings.145 **/146 minimumPeriod: u64 & AugmentedConst<ApiType>;147 /**148 * Generic const149 **/150 [key: string]: Codec;151 };152 transactionPayment: {153 /**154 * A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their155 * `priority`156 * 157 * This value is multipled by the `final_fee` to obtain a "virtual tip" that is later158 * added to a tip component in regular `priority` calculations.159 * It means that a `Normal` transaction can front-run a similarly-sized `Operational`160 * extrinsic (with no tip), by including a tip value greater than the virtual tip.161 * 162 * ```rust,ignore163 * // For `Normal`164 * let priority = priority_calc(tip);165 * 166 * // For `Operational`167 * let virtual_tip = (inclusion_fee + tip) * OperationalFeeMultiplier;168 * let priority = priority_calc(tip + virtual_tip);169 * ```170 * 171 * Note that since we use `final_fee` the multiplier applies also to the regular `tip`172 * sent with the transaction. So, not only does the transaction get a priority bump based173 * on the `inclusion_fee`, but we also amplify the impact of tips applied to `Operational`174 * transactions.175 **/176 operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;177 /**178 * Generic const179 **/180 [key: string]: Codec;181 };182 treasury: {183 /**184 * Percentage of spare funds (if any) that are burnt per spend period.185 **/186 burn: Permill & AugmentedConst<ApiType>;187 /**188 * The maximum number of approvals that can wait in the spending queue.189 * 190 * NOTE: This parameter is also used within the Bounties Pallet extension if enabled.191 **/192 maxApprovals: u32 & AugmentedConst<ApiType>;193 /**194 * The treasury's pallet id, used for deriving its sovereign account ID.195 **/196 palletId: FrameSupportPalletId & AugmentedConst<ApiType>;197 /**198 * Fraction of a proposal's value that should be bonded in order to place the proposal.199 * An accepted proposal gets these back. A rejected proposal does not.200 **/201 proposalBond: Permill & AugmentedConst<ApiType>;202 /**203 * Maximum amount of funds that should be placed in a deposit for making a proposal.204 **/205 proposalBondMaximum: Option<u128> & AugmentedConst<ApiType>;206 /**207 * Minimum amount of funds that should be placed in a deposit for making a proposal.208 **/209 proposalBondMinimum: u128 & AugmentedConst<ApiType>;210 /**211 * Period between successive spends.212 **/213 spendPeriod: u32 & AugmentedConst<ApiType>;214 /**215 * Generic const216 **/217 [key: string]: Codec;218 };219 vesting: {220 /**221 * The minimum amount transferred to call `vested_transfer`.222 **/223 minVestedTransfer: u128 & AugmentedConst<ApiType>;224 /**225 * Generic const226 **/227 [key: string]: Codec;228 };229 } // AugmentedConsts230} // declare module1// Auto-generated via `yarn polkadot-types-from-chain`, do not edit2/* eslint-disable */34// import type lookup before we augment - in some environments5// this is required to allow for ambient/previous definitions6import '@polkadot/api-base/types/consts';78import type { ApiTypes, AugmentedConst } from '@polkadot/api-base/types';9import type { Option, u128, u16, u32, u64, u8 } from '@polkadot/types-codec';10import type { Codec } from '@polkadot/types-codec/types';11import type { Perbill, Permill } from '@polkadot/types/interfaces/runtime';12import type { FrameSupportPalletId, FrameSupportWeightsRuntimeDbWeight, FrameSystemLimitsBlockLength, FrameSystemLimitsBlockWeights, SpVersionRuntimeVersion } from '@polkadot/types/lookup';1314export type __AugmentedConst<ApiType extends ApiTypes> = AugmentedConst<ApiType>;1516declare module '@polkadot/api-base/types/consts' {17 interface AugmentedConsts<ApiType extends ApiTypes> {18 appPromotion: {19 /**20 * Rate of return for interval in blocks defined in `RecalculationInterval`.21 **/22 intervalIncome: Perbill & AugmentedConst<ApiType>;23 /**24 * Decimals for the `Currency`.25 **/26 nominal: u128 & AugmentedConst<ApiType>;27 /**28 * The app's pallet id, used for deriving its sovereign account ID.29 **/30 palletId: FrameSupportPalletId & AugmentedConst<ApiType>;31 /**32 * In parachain blocks.33 **/34 pendingInterval: u32 & AugmentedConst<ApiType>;35 /**36 * In relay blocks.37 **/38 recalculationInterval: u32 & AugmentedConst<ApiType>;39 /**40 * Generic const41 **/42 [key: string]: Codec;43 };44 balances: {45 /**46 * The minimum amount required to keep an account open.47 **/48 existentialDeposit: u128 & AugmentedConst<ApiType>;49 /**50 * The maximum number of locks that should exist on an account.51 * Not strictly enforced, but used for weight estimation.52 **/53 maxLocks: u32 & AugmentedConst<ApiType>;54 /**55 * The maximum number of named reserves that can exist on an account.56 **/57 maxReserves: u32 & AugmentedConst<ApiType>;58 /**59 * Generic const60 **/61 [key: string]: Codec;62 };63 common: {64 /**65 * Maximum admins per collection.66 **/67 collectionAdminsLimit: u32 & AugmentedConst<ApiType>;68 /**69 * Set price to create a collection.70 **/71 collectionCreationPrice: u128 & AugmentedConst<ApiType>;72 /**73 * Generic const74 **/75 [key: string]: Codec;76 };77 configuration: {78 defaultMinGasPrice: u64 & AugmentedConst<ApiType>;79 defaultWeightToFeeCoefficient: u32 & AugmentedConst<ApiType>;80 /**81 * Generic const82 **/83 [key: string]: Codec;84 };85 inflation: {86 /**87 * Number of blocks that pass between treasury balance updates due to inflation88 **/89 inflationBlockInterval: u32 & AugmentedConst<ApiType>;90 /**91 * Generic const92 **/93 [key: string]: Codec;94 };95 scheduler: {96 /**97 * The maximum weight that may be scheduled per block for any dispatchables of less98 * priority than `schedule::HARD_DEADLINE`.99 **/100 maximumWeight: u64 & AugmentedConst<ApiType>;101 /**102 * The maximum number of scheduled calls in the queue for a single block.103 * Not strictly enforced, but used for weight estimation.104 **/105 maxScheduledPerBlock: u32 & AugmentedConst<ApiType>;106 /**107 * Generic const108 **/109 [key: string]: Codec;110 };111 system: {112 /**113 * Maximum number of block number to block hash mappings to keep (oldest pruned first).114 **/115 blockHashCount: u32 & AugmentedConst<ApiType>;116 /**117 * The maximum length of a block (in bytes).118 **/119 blockLength: FrameSystemLimitsBlockLength & AugmentedConst<ApiType>;120 /**121 * Block & extrinsics weights: base values and limits.122 **/123 blockWeights: FrameSystemLimitsBlockWeights & AugmentedConst<ApiType>;124 /**125 * The weight of runtime database operations the runtime can invoke.126 **/127 dbWeight: FrameSupportWeightsRuntimeDbWeight & AugmentedConst<ApiType>;128 /**129 * The designated SS85 prefix of this chain.130 * 131 * This replaces the "ss58Format" property declared in the chain spec. Reason is132 * that the runtime should know about the prefix in order to make use of it as133 * an identifier of the chain.134 **/135 ss58Prefix: u16 & AugmentedConst<ApiType>;136 /**137 * Get the chain's current version.138 **/139 version: SpVersionRuntimeVersion & AugmentedConst<ApiType>;140 /**141 * Generic const142 **/143 [key: string]: Codec;144 };145 timestamp: {146 /**147 * The minimum period between blocks. Beware that this is different to the *expected*148 * period that the block production apparatus provides. Your chosen consensus system will149 * generally work with this to determine a sensible block time. e.g. For Aura, it will be150 * double this period on default settings.151 **/152 minimumPeriod: u64 & AugmentedConst<ApiType>;153 /**154 * Generic const155 **/156 [key: string]: Codec;157 };158 transactionPayment: {159 /**160 * A fee mulitplier for `Operational` extrinsics to compute "virtual tip" to boost their161 * `priority`162 * 163 * This value is multipled by the `final_fee` to obtain a "virtual tip" that is later164 * added to a tip component in regular `priority` calculations.165 * It means that a `Normal` transaction can front-run a similarly-sized `Operational`166 * extrinsic (with no tip), by including a tip value greater than the virtual tip.167 * 168 * ```rust,ignore169 * // For `Normal`170 * let priority = priority_calc(tip);171 * 172 * // For `Operational`173 * let virtual_tip = (inclusion_fee + tip) * OperationalFeeMultiplier;174 * let priority = priority_calc(tip + virtual_tip);175 * ```176 * 177 * Note that since we use `final_fee` the multiplier applies also to the regular `tip`178 * sent with the transaction. So, not only does the transaction get a priority bump based179 * on the `inclusion_fee`, but we also amplify the impact of tips applied to `Operational`180 * transactions.181 **/182 operationalFeeMultiplier: u8 & AugmentedConst<ApiType>;183 /**184 * Generic const185 **/186 [key: string]: Codec;187 };188 treasury: {189 /**190 * Percentage of spare funds (if any) that are burnt per spend period.191 **/192 burn: Permill & AugmentedConst<ApiType>;193 /**194 * The maximum number of approvals that can wait in the spending queue.195 * 196 * NOTE: This parameter is also used within the Bounties Pallet extension if enabled.197 **/198 maxApprovals: u32 & AugmentedConst<ApiType>;199 /**200 * The treasury's pallet id, used for deriving its sovereign account ID.201 **/202 palletId: FrameSupportPalletId & AugmentedConst<ApiType>;203 /**204 * Fraction of a proposal's value that should be bonded in order to place the proposal.205 * An accepted proposal gets these back. A rejected proposal does not.206 **/207 proposalBond: Permill & AugmentedConst<ApiType>;208 /**209 * Maximum amount of funds that should be placed in a deposit for making a proposal.210 **/211 proposalBondMaximum: Option<u128> & AugmentedConst<ApiType>;212 /**213 * Minimum amount of funds that should be placed in a deposit for making a proposal.214 **/215 proposalBondMinimum: u128 & AugmentedConst<ApiType>;216 /**217 * Period between successive spends.218 **/219 spendPeriod: u32 & AugmentedConst<ApiType>;220 /**221 * Generic const222 **/223 [key: string]: Codec;224 };225 vesting: {226 /**227 * The minimum amount transferred to call `vested_transfer`.228 **/229 minVestedTransfer: u128 & AugmentedConst<ApiType>;230 /**231 * Generic const232 **/233 [key: string]: Codec;234 };235 } // AugmentedConsts236} // declare moduletests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-errors.ts
+++ b/tests/src/interfaces/augment-api-errors.ts
@@ -13,23 +13,30 @@
interface AugmentedErrors<ApiType extends ApiTypes> {
appPromotion: {
/**
- * Error due to action requiring admin to be set
+ * Error due to action requiring admin to be set.
**/
AdminNotSet: AugmentedError<ApiType>;
/**
- * An error related to the fact that an invalid argument was passed to perform an action
+ * Errors caused by incorrect actions with a locked balance.
**/
- InvalidArgument: AugmentedError<ApiType>;
+ IncorrectLockedBalanceOperation: AugmentedError<ApiType>;
/**
- * No permission to perform an action
+ * No permission to perform an action.
**/
NoPermission: AugmentedError<ApiType>;
/**
- * Insufficient funds to perform an action
+ * Insufficient funds to perform an action.
**/
NotSufficientFunds: AugmentedError<ApiType>;
+ /**
+ * Occurs when a pending unstake cannot be added in this block. PENDING_LIMIT_PER_BLOCK` limits exceeded.
+ **/
PendingForBlockOverflow: AugmentedError<ApiType>;
/**
+ * The error is due to the fact that the collection/contract must already be sponsored in order to perform the action.
+ **/
+ SponsorNotSet: AugmentedError<ApiType>;
+ /**
* Generic error
**/
[key: string]: AugmentedError<ApiType>;
tests/src/interfaces/augment-api-events.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-events.ts
+++ b/tests/src/interfaces/augment-api-events.ts
@@ -16,9 +16,37 @@
declare module '@polkadot/api-base/types/events' {
interface AugmentedEvents<ApiType extends ApiTypes> {
appPromotion: {
+ /**
+ * The admin was set
+ *
+ * # Arguments
+ * * AccountId: ID of the admin
+ **/
SetAdmin: AugmentedEvent<ApiType, [AccountId32]>;
+ /**
+ * Staking was performed
+ *
+ * # Arguments
+ * * AccountId: ID of the staker
+ * * Balance : staking amount
+ **/
Stake: AugmentedEvent<ApiType, [AccountId32, u128]>;
+ /**
+ * Staking recalculation was performed
+ *
+ * # Arguments
+ * * AccountId: ID of the staker.
+ * * Balance : recalculation base
+ * * Balance : total income
+ **/
StakingRecalculation: AugmentedEvent<ApiType, [AccountId32, u128, u128]>;
+ /**
+ * Unstaking was performed
+ *
+ * # Arguments
+ * * AccountId: ID of the staker
+ * * Balance : unstaking amount
+ **/
Unstake: AugmentedEvent<ApiType, [AccountId32, u128]>;
/**
* Generic event
tests/src/interfaces/augment-api-query.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-query.ts
+++ b/tests/src/interfaces/augment-api-query.ts
@@ -20,13 +20,10 @@
appPromotion: {
admin: AugmentedQuery<ApiType, () => Observable<Option<AccountId32>>, []> & QueryableStorageEntry<ApiType, []>;
/**
- * Stores hash a record for which the last revenue recalculation was performed.
+ * Stores a key for record for which the next revenue recalculation would be performed.
* If `None`, then recalculation has not yet been performed or calculations have been completed for all stakers.
**/
nextCalculatedRecord: AugmentedQuery<ApiType, () => Observable<Option<ITuple<[AccountId32, u32]>>>, []> & QueryableStorageEntry<ApiType, []>;
- /**
- * Amount of tokens pending unstake per user per block.
- **/
pendingUnstake: AugmentedQuery<ApiType, (arg: u32 | AnyNumber | Uint8Array) => Observable<Vec<ITuple<[AccountId32, u128]>>>, [u32]> & QueryableStorageEntry<ApiType, [u32]>;
/**
* Amount of tokens staked by account in the blocknumber.
tests/src/interfaces/default/types.tsdiffbeforeafterboth--- a/tests/src/interfaces/default/types.ts
+++ b/tests/src/interfaces/default/types.ts
@@ -846,8 +846,9 @@
readonly isNoPermission: boolean;
readonly isNotSufficientFunds: boolean;
readonly isPendingForBlockOverflow: boolean;
- readonly isInvalidArgument: boolean;
- readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFunds' | 'PendingForBlockOverflow' | 'InvalidArgument';
+ readonly isSponsorNotSet: boolean;
+ readonly isIncorrectLockedBalanceOperation: boolean;
+ readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFunds' | 'PendingForBlockOverflow' | 'SponsorNotSet' | 'IncorrectLockedBalanceOperation';
}
/** @name PalletAppPromotionEvent */
tests/src/interfaces/lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/lookup.ts
+++ b/tests/src/interfaces/lookup.ts
@@ -3115,7 +3115,7 @@
* Lookup416: pallet_app_promotion::pallet::Error<T>
**/
PalletAppPromotionError: {
- _enum: ['AdminNotSet', 'NoPermission', 'NotSufficientFunds', 'PendingForBlockOverflow', 'InvalidArgument']
+ _enum: ['AdminNotSet', 'NoPermission', 'NotSufficientFunds', 'PendingForBlockOverflow', 'SponsorNotSet', 'IncorrectLockedBalanceOperation']
},
/**
* Lookup419: pallet_evm::pallet::Error<T>
tests/src/interfaces/types-lookup.tsdiffbeforeafterboth--- a/tests/src/interfaces/types-lookup.ts
+++ b/tests/src/interfaces/types-lookup.ts
@@ -3309,8 +3309,9 @@
readonly isNoPermission: boolean;
readonly isNotSufficientFunds: boolean;
readonly isPendingForBlockOverflow: boolean;
- readonly isInvalidArgument: boolean;
- readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFunds' | 'PendingForBlockOverflow' | 'InvalidArgument';
+ readonly isSponsorNotSet: boolean;
+ readonly isIncorrectLockedBalanceOperation: boolean;
+ readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFunds' | 'PendingForBlockOverflow' | 'SponsorNotSet' | 'IncorrectLockedBalanceOperation';
}
/** @name PalletEvmError (419) */