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.tsdiffbeforeafterboth--- a/tests/src/interfaces/augment-api-consts.ts
+++ b/tests/src/interfaces/augment-api-consts.ts
@@ -16,14 +16,20 @@
declare module '@polkadot/api-base/types/consts' {
interface AugmentedConsts<ApiType extends ApiTypes> {
appPromotion: {
+ /**
+ * Rate of return for interval in blocks defined in `RecalculationInterval`.
+ **/
intervalIncome: Perbill & AugmentedConst<ApiType>;
+ /**
+ * Decimals for the `Currency`.
+ **/
nominal: u128 & AugmentedConst<ApiType>;
/**
* The app's pallet id, used for deriving its sovereign account ID.
**/
palletId: FrameSupportPalletId & AugmentedConst<ApiType>;
/**
- * In relay blocks.
+ * In parachain blocks.
**/
pendingInterval: u32 & AugmentedConst<ApiType>;
/**
tests/src/interfaces/augment-api-errors.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/errors';78import type { ApiTypes, AugmentedError } from '@polkadot/api-base/types';910export type __AugmentedError<ApiType extends ApiTypes> = AugmentedError<ApiType>;1112declare module '@polkadot/api-base/types/errors' {13 interface AugmentedErrors<ApiType extends ApiTypes> {14 appPromotion: {15 /**16 * Error due to action requiring admin to be set.17 **/18 AdminNotSet: AugmentedError<ApiType>;19 /**20 * Errors caused by incorrect actions with a locked balance.21 **/22 IncorrectLockedBalanceOperation: AugmentedError<ApiType>;23 /**24 * No permission to perform an action.25 **/26 NoPermission: AugmentedError<ApiType>;27 /**28 * Insufficient funds to perform an action.29 **/30 NotSufficientFunds: AugmentedError<ApiType>;31 /**32 * Occurs when a pending unstake cannot be added in this block. PENDING_LIMIT_PER_BLOCK` limits exceeded.33 **/34 PendingForBlockOverflow: AugmentedError<ApiType>;35 /**36 * The error is due to the fact that the collection/contract must already be sponsored in order to perform the action.37 **/38 SponsorNotSet: AugmentedError<ApiType>;39 /**40 * Generic error41 **/42 [key: string]: AugmentedError<ApiType>;43 };44 balances: {45 /**46 * Beneficiary account must pre-exist47 **/48 DeadAccount: AugmentedError<ApiType>;49 /**50 * Value too low to create account due to existential deposit51 **/52 ExistentialDeposit: AugmentedError<ApiType>;53 /**54 * A vesting schedule already exists for this account55 **/56 ExistingVestingSchedule: AugmentedError<ApiType>;57 /**58 * Balance too low to send value59 **/60 InsufficientBalance: AugmentedError<ApiType>;61 /**62 * Transfer/payment would kill account63 **/64 KeepAlive: AugmentedError<ApiType>;65 /**66 * Account liquidity restrictions prevent withdrawal67 **/68 LiquidityRestrictions: AugmentedError<ApiType>;69 /**70 * Number of named reserves exceed MaxReserves71 **/72 TooManyReserves: AugmentedError<ApiType>;73 /**74 * Vesting balance too high to send value75 **/76 VestingBalance: AugmentedError<ApiType>;77 /**78 * Generic error79 **/80 [key: string]: AugmentedError<ApiType>;81 };82 common: {83 /**84 * Account token limit exceeded per collection85 **/86 AccountTokenLimitExceeded: AugmentedError<ApiType>;87 /**88 * Can't transfer tokens to ethereum zero address89 **/90 AddressIsZero: AugmentedError<ApiType>;91 /**92 * Address is not in allow list.93 **/94 AddressNotInAllowlist: AugmentedError<ApiType>;95 /**96 * Requested value is more than the approved97 **/98 ApprovedValueTooLow: AugmentedError<ApiType>;99 /**100 * Tried to approve more than owned101 **/102 CantApproveMoreThanOwned: AugmentedError<ApiType>;103 /**104 * Destroying only empty collections is allowed105 **/106 CantDestroyNotEmptyCollection: AugmentedError<ApiType>;107 /**108 * Exceeded max admin count109 **/110 CollectionAdminCountExceeded: AugmentedError<ApiType>;111 /**112 * Collection description can not be longer than 255 char.113 **/114 CollectionDescriptionLimitExceeded: AugmentedError<ApiType>;115 /**116 * Tried to store more data than allowed in collection field117 **/118 CollectionFieldSizeExceeded: AugmentedError<ApiType>;119 /**120 * Tried to access an external collection with an internal API121 **/122 CollectionIsExternal: AugmentedError<ApiType>;123 /**124 * Tried to access an internal collection with an external API125 **/126 CollectionIsInternal: AugmentedError<ApiType>;127 /**128 * Collection limit bounds per collection exceeded129 **/130 CollectionLimitBoundsExceeded: AugmentedError<ApiType>;131 /**132 * Collection name can not be longer than 63 char.133 **/134 CollectionNameLimitExceeded: AugmentedError<ApiType>;135 /**136 * This collection does not exist.137 **/138 CollectionNotFound: AugmentedError<ApiType>;139 /**140 * Collection token limit exceeded141 **/142 CollectionTokenLimitExceeded: AugmentedError<ApiType>;143 /**144 * Token prefix can not be longer than 15 char.145 **/146 CollectionTokenPrefixLimitExceeded: AugmentedError<ApiType>;147 /**148 * Empty property keys are forbidden149 **/150 EmptyPropertyKey: AugmentedError<ApiType>;151 /**152 * Only ASCII letters, digits, and symbols `_`, `-`, and `.` are allowed153 **/154 InvalidCharacterInPropertyKey: AugmentedError<ApiType>;155 /**156 * Metadata flag frozen157 **/158 MetadataFlagFrozen: AugmentedError<ApiType>;159 /**160 * Sender parameter and item owner must be equal.161 **/162 MustBeTokenOwner: AugmentedError<ApiType>;163 /**164 * No permission to perform action165 **/166 NoPermission: AugmentedError<ApiType>;167 /**168 * Tried to store more property data than allowed169 **/170 NoSpaceForProperty: AugmentedError<ApiType>;171 /**172 * Insufficient funds to perform an action173 **/174 NotSufficientFounds: AugmentedError<ApiType>;175 /**176 * Tried to enable permissions which are only permitted to be disabled177 **/178 OwnerPermissionsCantBeReverted: AugmentedError<ApiType>;179 /**180 * Property key is too long181 **/182 PropertyKeyIsTooLong: AugmentedError<ApiType>;183 /**184 * Tried to store more property keys than allowed185 **/186 PropertyLimitReached: AugmentedError<ApiType>;187 /**188 * Collection is not in mint mode.189 **/190 PublicMintingNotAllowed: AugmentedError<ApiType>;191 /**192 * Only tokens from specific collections may nest tokens under this one193 **/194 SourceCollectionIsNotAllowedToNest: AugmentedError<ApiType>;195 /**196 * Item does not exist197 **/198 TokenNotFound: AugmentedError<ApiType>;199 /**200 * Item is balance not enough201 **/202 TokenValueTooLow: AugmentedError<ApiType>;203 /**204 * Total collections bound exceeded.205 **/206 TotalCollectionsLimitExceeded: AugmentedError<ApiType>;207 /**208 * Collection settings not allowing items transferring209 **/210 TransferNotAllowed: AugmentedError<ApiType>;211 /**212 * The operation is not supported213 **/214 UnsupportedOperation: AugmentedError<ApiType>;215 /**216 * User does not satisfy the nesting rule217 **/218 UserIsNotAllowedToNest: AugmentedError<ApiType>;219 /**220 * Generic error221 **/222 [key: string]: AugmentedError<ApiType>;223 };224 cumulusXcm: {225 /**226 * Generic error227 **/228 [key: string]: AugmentedError<ApiType>;229 };230 dmpQueue: {231 /**232 * The amount of weight given is possibly not enough for executing the message.233 **/234 OverLimit: AugmentedError<ApiType>;235 /**236 * The message index given is unknown.237 **/238 Unknown: AugmentedError<ApiType>;239 /**240 * Generic error241 **/242 [key: string]: AugmentedError<ApiType>;243 };244 ethereum: {245 /**246 * Signature is invalid.247 **/248 InvalidSignature: AugmentedError<ApiType>;249 /**250 * Pre-log is present, therefore transact is not allowed.251 **/252 PreLogExists: AugmentedError<ApiType>;253 /**254 * Generic error255 **/256 [key: string]: AugmentedError<ApiType>;257 };258 evm: {259 /**260 * Not enough balance to perform action261 **/262 BalanceLow: AugmentedError<ApiType>;263 /**264 * Calculating total fee overflowed265 **/266 FeeOverflow: AugmentedError<ApiType>;267 /**268 * Gas price is too low.269 **/270 GasPriceTooLow: AugmentedError<ApiType>;271 /**272 * Nonce is invalid273 **/274 InvalidNonce: AugmentedError<ApiType>;275 /**276 * Calculating total payment overflowed277 **/278 PaymentOverflow: AugmentedError<ApiType>;279 /**280 * Withdraw fee failed281 **/282 WithdrawFailed: AugmentedError<ApiType>;283 /**284 * Generic error285 **/286 [key: string]: AugmentedError<ApiType>;287 };288 evmCoderSubstrate: {289 OutOfFund: AugmentedError<ApiType>;290 OutOfGas: AugmentedError<ApiType>;291 /**292 * Generic error293 **/294 [key: string]: AugmentedError<ApiType>;295 };296 evmContractHelpers: {297 /**298 * No pending sponsor for contract.299 **/300 NoPendingSponsor: AugmentedError<ApiType>;301 /**302 * This method is only executable by contract owner303 **/304 NoPermission: AugmentedError<ApiType>;305 /**306 * Generic error307 **/308 [key: string]: AugmentedError<ApiType>;309 };310 evmMigration: {311 /**312 * Migration of this account is not yet started, or already finished.313 **/314 AccountIsNotMigrating: AugmentedError<ApiType>;315 /**316 * Can only migrate to empty address.317 **/318 AccountNotEmpty: AugmentedError<ApiType>;319 /**320 * Generic error321 **/322 [key: string]: AugmentedError<ApiType>;323 };324 fungible: {325 /**326 * Fungible token does not support nesting.327 **/328 FungibleDisallowsNesting: AugmentedError<ApiType>;329 /**330 * Tried to set data for fungible item.331 **/332 FungibleItemsDontHaveData: AugmentedError<ApiType>;333 /**334 * Fungible tokens hold no ID, and the default value of TokenId for Fungible collection is 0.335 **/336 FungibleItemsHaveNoId: AugmentedError<ApiType>;337 /**338 * Not Fungible item data used to mint in Fungible collection.339 **/340 NotFungibleDataUsedToMintFungibleCollectionToken: AugmentedError<ApiType>;341 /**342 * Setting item properties is not allowed.343 **/344 SettingPropertiesNotAllowed: AugmentedError<ApiType>;345 /**346 * Generic error347 **/348 [key: string]: AugmentedError<ApiType>;349 };350 nonfungible: {351 /**352 * Unable to burn NFT with children353 **/354 CantBurnNftWithChildren: AugmentedError<ApiType>;355 /**356 * Used amount > 1 with NFT357 **/358 NonfungibleItemsHaveNoAmount: AugmentedError<ApiType>;359 /**360 * Not Nonfungible item data used to mint in Nonfungible collection.361 **/362 NotNonfungibleDataUsedToMintFungibleCollectionToken: AugmentedError<ApiType>;363 /**364 * Generic error365 **/366 [key: string]: AugmentedError<ApiType>;367 };368 parachainSystem: {369 /**370 * The inherent which supplies the host configuration did not run this block371 **/372 HostConfigurationNotAvailable: AugmentedError<ApiType>;373 /**374 * No code upgrade has been authorized.375 **/376 NothingAuthorized: AugmentedError<ApiType>;377 /**378 * No validation function upgrade is currently scheduled.379 **/380 NotScheduled: AugmentedError<ApiType>;381 /**382 * Attempt to upgrade validation function while existing upgrade pending383 **/384 OverlappingUpgrades: AugmentedError<ApiType>;385 /**386 * Polkadot currently prohibits this parachain from upgrading its validation function387 **/388 ProhibitedByPolkadot: AugmentedError<ApiType>;389 /**390 * The supplied validation function has compiled into a blob larger than Polkadot is391 * willing to run392 **/393 TooBig: AugmentedError<ApiType>;394 /**395 * The given code upgrade has not been authorized.396 **/397 Unauthorized: AugmentedError<ApiType>;398 /**399 * The inherent which supplies the validation data did not run this block400 **/401 ValidationDataNotAvailable: AugmentedError<ApiType>;402 /**403 * Generic error404 **/405 [key: string]: AugmentedError<ApiType>;406 };407 polkadotXcm: {408 /**409 * The location is invalid since it already has a subscription from us.410 **/411 AlreadySubscribed: AugmentedError<ApiType>;412 /**413 * The given location could not be used (e.g. because it cannot be expressed in the414 * desired version of XCM).415 **/416 BadLocation: AugmentedError<ApiType>;417 /**418 * The version of the `Versioned` value used is not able to be interpreted.419 **/420 BadVersion: AugmentedError<ApiType>;421 /**422 * Could not re-anchor the assets to declare the fees for the destination chain.423 **/424 CannotReanchor: AugmentedError<ApiType>;425 /**426 * The destination `MultiLocation` provided cannot be inverted.427 **/428 DestinationNotInvertible: AugmentedError<ApiType>;429 /**430 * The assets to be sent are empty.431 **/432 Empty: AugmentedError<ApiType>;433 /**434 * The message execution fails the filter.435 **/436 Filtered: AugmentedError<ApiType>;437 /**438 * Origin is invalid for sending.439 **/440 InvalidOrigin: AugmentedError<ApiType>;441 /**442 * The referenced subscription could not be found.443 **/444 NoSubscription: AugmentedError<ApiType>;445 /**446 * There was some other issue (i.e. not to do with routing) in sending the message. Perhaps447 * a lack of space for buffering the message.448 **/449 SendFailure: AugmentedError<ApiType>;450 /**451 * Too many assets have been attempted for transfer.452 **/453 TooManyAssets: AugmentedError<ApiType>;454 /**455 * The desired destination was unreachable, generally because there is a no way of routing456 * to it.457 **/458 Unreachable: AugmentedError<ApiType>;459 /**460 * The message's weight could not be determined.461 **/462 UnweighableMessage: AugmentedError<ApiType>;463 /**464 * Generic error465 **/466 [key: string]: AugmentedError<ApiType>;467 };468 refungible: {469 /**470 * Not Refungible item data used to mint in Refungible collection.471 **/472 NotRefungibleDataUsedToMintFungibleCollectionToken: AugmentedError<ApiType>;473 /**474 * Refungible token can't nest other tokens.475 **/476 RefungibleDisallowsNesting: AugmentedError<ApiType>;477 /**478 * Refungible token can't be repartitioned by user who isn't owns all pieces.479 **/480 RepartitionWhileNotOwningAllPieces: AugmentedError<ApiType>;481 /**482 * Setting item properties is not allowed.483 **/484 SettingPropertiesNotAllowed: AugmentedError<ApiType>;485 /**486 * Maximum refungibility exceeded.487 **/488 WrongRefungiblePieces: AugmentedError<ApiType>;489 /**490 * Generic error491 **/492 [key: string]: AugmentedError<ApiType>;493 };494 rmrkCore: {495 /**496 * Not the target owner of the sent NFT.497 **/498 CannotAcceptNonOwnedNft: AugmentedError<ApiType>;499 /**500 * Not the target owner of the sent NFT.501 **/502 CannotRejectNonOwnedNft: AugmentedError<ApiType>;503 /**504 * NFT was not sent and is not pending.505 **/506 CannotRejectNonPendingNft: AugmentedError<ApiType>;507 /**508 * If an NFT is sent to a descendant, that would form a nesting loop, an ouroboros.509 * Sending to self is redundant.510 **/511 CannotSendToDescendentOrSelf: AugmentedError<ApiType>;512 /**513 * Too many tokens created in the collection, no new ones are allowed.514 **/515 CollectionFullOrLocked: AugmentedError<ApiType>;516 /**517 * Only destroying collections without tokens is allowed.518 **/519 CollectionNotEmpty: AugmentedError<ApiType>;520 /**521 * Collection does not exist, has a wrong type, or does not map to a Unique ID.522 **/523 CollectionUnknown: AugmentedError<ApiType>;524 /**525 * Property of the type of RMRK collection could not be read successfully.526 **/527 CorruptedCollectionType: AugmentedError<ApiType>;528 /**529 * Could not find an ID for a collection. It is likely there were too many collections created on the chain, causing an overflow.530 **/531 NoAvailableCollectionId: AugmentedError<ApiType>;532 /**533 * Token does not exist, or there is no suitable ID for it, likely too many tokens were created in a collection, causing an overflow.534 **/535 NoAvailableNftId: AugmentedError<ApiType>;536 /**537 * Could not find an ID for the resource. It is likely there were too many resources created on an NFT, causing an overflow.538 **/539 NoAvailableResourceId: AugmentedError<ApiType>;540 /**541 * Token is marked as non-transferable, and thus cannot be transferred.542 **/543 NonTransferable: AugmentedError<ApiType>;544 /**545 * No permission to perform action.546 **/547 NoPermission: AugmentedError<ApiType>;548 /**549 * No such resource found.550 **/551 ResourceDoesntExist: AugmentedError<ApiType>;552 /**553 * Resource is not pending for the operation.554 **/555 ResourceNotPending: AugmentedError<ApiType>;556 /**557 * Could not find a property by the supplied key.558 **/559 RmrkPropertyIsNotFound: AugmentedError<ApiType>;560 /**561 * Too many symbols supplied as the property key. The maximum is [256](up_data_structs::MAX_PROPERTY_KEY_LENGTH).562 **/563 RmrkPropertyKeyIsTooLong: AugmentedError<ApiType>;564 /**565 * Too many bytes supplied as the property value. The maximum is [32768](up_data_structs::MAX_PROPERTY_VALUE_LENGTH).566 **/567 RmrkPropertyValueIsTooLong: AugmentedError<ApiType>;568 /**569 * Something went wrong when decoding encoded data from the storage.570 * Perhaps, there was a wrong key supplied for the type, or the data was improperly stored.571 **/572 UnableToDecodeRmrkData: AugmentedError<ApiType>;573 /**574 * Generic error575 **/576 [key: string]: AugmentedError<ApiType>;577 };578 rmrkEquip: {579 /**580 * Base collection linked to this ID does not exist.581 **/582 BaseDoesntExist: AugmentedError<ApiType>;583 /**584 * No Theme named "default" is associated with the Base.585 **/586 NeedsDefaultThemeFirst: AugmentedError<ApiType>;587 /**588 * Could not find an ID for a Base collection. It is likely there were too many collections created on the chain, causing an overflow.589 **/590 NoAvailableBaseId: AugmentedError<ApiType>;591 /**592 * Could not find a suitable ID for a Part, likely too many Part tokens were created in the Base, causing an overflow593 **/594 NoAvailablePartId: AugmentedError<ApiType>;595 /**596 * Cannot assign equippables to a fixed Part.597 **/598 NoEquippableOnFixedPart: AugmentedError<ApiType>;599 /**600 * Part linked to this ID does not exist.601 **/602 PartDoesntExist: AugmentedError<ApiType>;603 /**604 * No permission to perform action.605 **/606 PermissionError: AugmentedError<ApiType>;607 /**608 * Generic error609 **/610 [key: string]: AugmentedError<ApiType>;611 };612 scheduler: {613 /**614 * Failed to schedule a call615 **/616 FailedToSchedule: AugmentedError<ApiType>;617 /**618 * Cannot find the scheduled call.619 **/620 NotFound: AugmentedError<ApiType>;621 /**622 * Reschedule failed because it does not change scheduled time.623 **/624 RescheduleNoChange: AugmentedError<ApiType>;625 /**626 * Given target block number is in the past.627 **/628 TargetBlockNumberInPast: AugmentedError<ApiType>;629 /**630 * Generic error631 **/632 [key: string]: AugmentedError<ApiType>;633 };634 structure: {635 /**636 * While nesting, reached the breadth limit of nesting, exceeding the provided budget.637 **/638 BreadthLimit: AugmentedError<ApiType>;639 /**640 * While nesting, reached the depth limit of nesting, exceeding the provided budget.641 **/642 DepthLimit: AugmentedError<ApiType>;643 /**644 * While nesting, encountered an already checked account, detecting a loop.645 **/646 OuroborosDetected: AugmentedError<ApiType>;647 /**648 * Couldn't find the token owner that is itself a token.649 **/650 TokenNotFound: AugmentedError<ApiType>;651 /**652 * Generic error653 **/654 [key: string]: AugmentedError<ApiType>;655 };656 sudo: {657 /**658 * Sender must be the Sudo account659 **/660 RequireSudo: AugmentedError<ApiType>;661 /**662 * Generic error663 **/664 [key: string]: AugmentedError<ApiType>;665 };666 system: {667 /**668 * The origin filter prevent the call to be dispatched.669 **/670 CallFiltered: AugmentedError<ApiType>;671 /**672 * Failed to extract the runtime version from the new runtime.673 * 674 * Either calling `Core_version` or decoding `RuntimeVersion` failed.675 **/676 FailedToExtractRuntimeVersion: AugmentedError<ApiType>;677 /**678 * The name of specification does not match between the current runtime679 * and the new runtime.680 **/681 InvalidSpecName: AugmentedError<ApiType>;682 /**683 * Suicide called when the account has non-default composite data.684 **/685 NonDefaultComposite: AugmentedError<ApiType>;686 /**687 * There is a non-zero reference count preventing the account from being purged.688 **/689 NonZeroRefCount: AugmentedError<ApiType>;690 /**691 * The specification version is not allowed to decrease between the current runtime692 * and the new runtime.693 **/694 SpecVersionNeedsToIncrease: AugmentedError<ApiType>;695 /**696 * Generic error697 **/698 [key: string]: AugmentedError<ApiType>;699 };700 treasury: {701 /**702 * The spend origin is valid but the amount it is allowed to spend is lower than the703 * amount to be spent.704 **/705 InsufficientPermission: AugmentedError<ApiType>;706 /**707 * Proposer's balance is too low.708 **/709 InsufficientProposersBalance: AugmentedError<ApiType>;710 /**711 * No proposal or bounty at that index.712 **/713 InvalidIndex: AugmentedError<ApiType>;714 /**715 * Proposal has not been approved.716 **/717 ProposalNotApproved: AugmentedError<ApiType>;718 /**719 * Too many approvals in the queue.720 **/721 TooManyApprovals: AugmentedError<ApiType>;722 /**723 * Generic error724 **/725 [key: string]: AugmentedError<ApiType>;726 };727 unique: {728 /**729 * Decimal_points parameter must be lower than [`up_data_structs::MAX_DECIMAL_POINTS`].730 **/731 CollectionDecimalPointLimitExceeded: AugmentedError<ApiType>;732 /**733 * This address is not set as sponsor, use setCollectionSponsor first.734 **/735 ConfirmUnsetSponsorFail: AugmentedError<ApiType>;736 /**737 * Length of items properties must be greater than 0.738 **/739 EmptyArgument: AugmentedError<ApiType>;740 /**741 * Repertition is only supported by refungible collection.742 **/743 RepartitionCalledOnNonRefungibleCollection: AugmentedError<ApiType>;744 /**745 * Generic error746 **/747 [key: string]: AugmentedError<ApiType>;748 };749 vesting: {750 /**751 * The vested transfer amount is too low752 **/753 AmountLow: AugmentedError<ApiType>;754 /**755 * Insufficient amount of balance to lock756 **/757 InsufficientBalanceToLock: AugmentedError<ApiType>;758 /**759 * Failed because the maximum vesting schedules was exceeded760 **/761 MaxVestingSchedulesExceeded: AugmentedError<ApiType>;762 /**763 * This account have too many vesting schedules764 **/765 TooManyVestingSchedules: AugmentedError<ApiType>;766 /**767 * Vesting period is zero768 **/769 ZeroVestingPeriod: AugmentedError<ApiType>;770 /**771 * Number of vests is zero772 **/773 ZeroVestingPeriodCount: AugmentedError<ApiType>;774 /**775 * Generic error776 **/777 [key: string]: AugmentedError<ApiType>;778 };779 xcmpQueue: {780 /**781 * Bad overweight index.782 **/783 BadOverweightIndex: AugmentedError<ApiType>;784 /**785 * Bad XCM data.786 **/787 BadXcm: AugmentedError<ApiType>;788 /**789 * Bad XCM origin.790 **/791 BadXcmOrigin: AugmentedError<ApiType>;792 /**793 * Failed to send XCM message.794 **/795 FailedToSend: AugmentedError<ApiType>;796 /**797 * Provided weight is possibly not enough to execute the message.798 **/799 WeightOverLimit: AugmentedError<ApiType>;800 /**801 * Generic error802 **/803 [key: string]: AugmentedError<ApiType>;804 };805 } // AugmentedErrors806} // declare moduletests/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) */