difftreelog
feautres: Pending interval is now tied to relay blocks, contract sponsors and `stopAppPromotion` added. Preparing to integrate the `app-promotion` palette to integrate with Unique and Quartz.
in: master
13 files changed
pallets/app-promotion/src/lib.rsdiffbeforeafterboth37pub mod weights;37pub mod weights;383839use sp_std::{vec::Vec, iter::Sum, borrow::ToOwned};39use sp_std::{vec::Vec, iter::Sum, borrow::ToOwned};40use sp_core::H160;40use codec::EncodeLike;41use codec::EncodeLike;41use pallet_balances::BalanceLock;42use pallet_balances::BalanceLock;42pub use types::ExtendedLockableCurrency;43pub use types::*;434444// use up_common::constants::{DAYS, UNIQUE};45// use up_common::constants::{DAYS, UNIQUE};45use up_data_structs::CollectionId;46use up_data_structs::CollectionId;78 use super::*;79 use super::*;79 use frame_support::{Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key, PalletId};80 use frame_support::{Blake2_128Concat, Twox64Concat, pallet_prelude::*, storage::Key, PalletId};80 use frame_system::pallet_prelude::*;81 use frame_system::pallet_prelude::*;81 use types::CollectionHandler;828283 #[pallet::config]83 #[pallet::config]84 pub trait Config: frame_system::Config + pallet_evm::account::Config {84 pub trait Config: frame_system::Config + pallet_evm::account::Config {89 CollectionId = CollectionId,89 CollectionId = CollectionId,90 >;90 >;919192 type ContractHandler: ContractHandler<AccountId = Self::CrossAccountId, ContractId = H160>;9392 type TreasuryAccountId: Get<Self::AccountId>;94 type TreasuryAccountId: Get<Self::AccountId>;939594 /// The app's pallet id, used for deriving its sovereign account ID.96 /// The app's pallet id, used for deriving its sovereign account ID.98 /// In relay blocks.100 /// In relay blocks.99 #[pallet::constant]101 #[pallet::constant]100 type RecalculationInterval: Get<Self::BlockNumber>;102 type RecalculationInterval: Get<Self::BlockNumber>;101 /// In chain blocks.103 /// In relay blocks.102 #[pallet::constant]104 #[pallet::constant]103 type PendingInterval: Get<Self::BlockNumber>;105 type PendingInterval: Get<Self::BlockNumber>;104106120122121 /// Events compatible with [`frame_system::Config::Event`].123 /// Events compatible with [`frame_system::Config::Event`].122 type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>;124 type Event: IsType<<Self as frame_system::Config>::Event> + From<Event<Self>>;123124 // /// Number of blocks that pass between treasury balance updates due to inflation125 // #[pallet::constant]126 // type InterestBlockInterval: Get<Self::BlockNumber>;127128 // // Weight information for functions of this pallet.129 // type WeightInfo: WeightInfo;130 }125 }131126132 #[pallet::pallet]127 #[pallet::pallet]146141147 #[pallet::error]142 #[pallet::error]148 pub enum Error<T> {143 pub enum Error<T> {144 /// Error due to action requiring admin to be set149 AdminNotSet,145 AdminNotSet,150 /// No permission to perform action146 /// No permission to perform an action151 NoPermission,147 NoPermission,152 /// Insufficient funds to perform an action148 /// Insufficient funds to perform an action153 NotSufficientFounds,149 NotSufficientFounds,150 /// An error related to the fact that an invalid argument was passed to perform an action154 InvalidArgument,151 InvalidArgument,155 AlreadySponsored,156 }152 }157153158 #[pallet::storage]154 #[pallet::storage]183 QueryKind = ValueQuery,179 QueryKind = ValueQuery,184 >;180 >;185181186 /// A block when app-promotion has started182 /// A block when app-promotion has started .I think this is redundant, because we only need `NextInterestBlock`.187 #[pallet::storage]183 #[pallet::storage]188 pub type StartBlock<T: Config> = StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;184 pub type StartBlock<T: Config> = StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;189185285 Ok(())281 Ok(())286 }282 }287283284 #[pallet::weight(0)]285 pub fn stop_app_promotion(origin: OriginFor<T>) -> DispatchResult286 where287 <T as frame_system::Config>::BlockNumber: From<u32>,288 {289 ensure_root(origin)?;290291 if <StartBlock<T>>::get() != 0u32.into() {292 <StartBlock<T>>::set(T::BlockNumber::default());293 <NextInterestBlock<T>>::set(T::BlockNumber::default());294 }295296 Ok(())297 }298288 #[pallet::weight(T::WeightInfo::stake())]299 #[pallet::weight(T::WeightInfo::stake())]289 pub fn stake(staker: OriginFor<T>, amount: BalanceOf<T>) -> DispatchResult {300 pub fn stake(staker: OriginFor<T>, amount: BalanceOf<T>) -> DispatchResult {290 let staker_id = ensure_signed(staker)?;301 let staker_id = ensure_signed(staker)?;341 .ok_or(ArithmeticError::Underflow)?,352 .ok_or(ArithmeticError::Underflow)?,342 );353 );343354344 let block = frame_system::Pallet::<T>::block_number() + T::PendingInterval::get();355 let block =356 T::RelayBlockNumberProvider::current_block_number() + T::PendingInterval::get();345 <PendingUnstake<T>>::insert(357 <PendingUnstake<T>>::insert(346 (&staker_id, block),358 (&staker_id, block),347 <PendingUnstake<T>>::get((&staker_id, block))359 <PendingUnstake<T>>::get((&staker_id, block))415 );427 );416 T::CollectionHandler::remove_collection_sponsor(collection_id)428 T::CollectionHandler::remove_collection_sponsor(collection_id)417 }429 }418 }419}420430421impl<T: Config> Pallet<T> {431 #[pallet::weight(0)]422 // pub fn stake(staker: &T::AccountId, amount: BalanceOf<T>) -> DispatchResult {432 pub fn sponsor_conract(admin: OriginFor<T>, contract_id: H160) -> DispatchResult {423 // let balance = <<T as Config>::Currency as Currency<T::AccountId>>::free_balance(staker);433 let admin_id = ensure_signed(admin)?;424434425 // ensure!(balance >= amount, ArithmeticError::Underflow);435 ensure!(436 admin_id == Admin::<T>::get().ok_or(Error::<T>::AdminNotSet)?,437 Error::<T>::NoPermission438 );426439427 // Self::set_lock_unchecked(staker, amount);440 T::ContractHandler::set_sponsor(441 T::CrossAccountId::from_sub(Self::account_id()),442 contract_id,443 )444 }428445429 // let block_number = <T::BlockNumberProvider as BlockNumberProvider>::current_block_number();446 #[pallet::weight(0)]447 pub fn stop_sponsorign_contract(admin: OriginFor<T>, contract_id: H160) -> DispatchResult {448 let admin_id = ensure_signed(admin)?;430449431 // <Staked<T>>::insert(450 ensure!(432 // (staker, block_number),451 admin_id == Admin::<T>::get().ok_or(Error::<T>::AdminNotSet)?,433 // <Staked<T>>::get((staker, block_number))434 // .checked_add(&amount)435 // .ok_or(ArithmeticError::Overflow)?,452 Error::<T>::NoPermission436 // );453 );437454438 // <TotalStaked<T>>::set(455 ensure!(439 // <TotalStaked<T>>::get()456 T::ContractHandler::get_sponsor(contract_id)?.ok_or(<Error<T>>::InvalidArgument)?440 // .checked_add(&amount)457 == T::CrossAccountId::from_sub(Self::account_id()),441 // .ok_or(ArithmeticError::Overflow)?,458 <Error<T>>::NoPermission442 // );459 );443460 T::ContractHandler::remove_contract_sponsor(contract_id)444 // Ok(())461 }445 // }446447 // pub fn unstake(staker: &T::AccountId, amount: BalanceOf<T>) -> DispatchResult {448 // let mut stakes = Staked::<T>::iter_prefix((staker,)).collect::<Vec<_>>();449450 // let total_staked = stakes451 // .iter()452 // .fold(<BalanceOf<T>>::default(), |acc, (_, amount)| acc + *amount);453454 // ensure!(total_staked >= amount, ArithmeticError::Underflow);455456 // <TotalStaked<T>>::set(457 // <TotalStaked<T>>::get()458 // .checked_sub(&amount)459 // .ok_or(ArithmeticError::Underflow)?,460 // );461462 // let block = <T::BlockNumberProvider>::current_block_number() + WEEK.into();463 // <PendingUnstake<T>>::insert(464 // (staker, block),465 // <PendingUnstake<T>>::get((staker, block))466 // .checked_add(&amount)467 // .ok_or(ArithmeticError::Overflow)?,468 // );469470 // stakes.sort_by_key(|(block, _)| *block);471472 // let mut acc_amount = amount;473 // let new_state = stakes474 // .into_iter()475 // .map_while(|(block, balance_per_block)| {476 // if acc_amount == <BalanceOf<T>>::default() {477 // return None;478 // }479 // if acc_amount <= balance_per_block {480 // let res = (block, balance_per_block - acc_amount, acc_amount);481 // acc_amount = <BalanceOf<T>>::default();482 // return Some(res);483 // } else {484 // acc_amount -= balance_per_block;485 // return Some((block, <BalanceOf<T>>::default(), acc_amount));486 // }487 // })488 // .collect::<Vec<_>>();489490 // new_state491 // .into_iter()492 // .for_each(|(block, to_staked, _to_pending)| {493 // if to_staked == <BalanceOf<T>>::default() {494 // <Staked<T>>::remove((staker, block));495 // } else {496 // <Staked<T>>::insert((staker, block), to_staked);497 // }498 // });499500 // Ok(())501 // }502503 // pub fn sponsor_collection(admin: T::AccountId, collection_id: u32) -> DispatchResult {504 // Ok(())505 // }506507 // pub fn stop_sponsorign_collection(admin: T::AccountId, collection_id: u32) -> DispatchResult {508 // Ok(())509 // }510511 pub fn sponsor_conract(admin: T::AccountId, app_id: u32) -> DispatchResult {512 Ok(())513 }462 }463}514464515 pub fn stop_sponsorign_contract(admin: T::AccountId, app_id: u32) -> DispatchResult {465impl<T: Config> Pallet<T> {516 Ok(())517 }518519 pub fn account_id() -> T::AccountId {466 pub fn account_id() -> T::AccountId {520 T::PalletId::get().into_account_truncating()467 T::PalletId::get().into_account_truncating()521 }468 }522}523469524impl<T: Config> Pallet<T> {525 fn unlock_balance_unchecked(staker: &T::AccountId, amount: BalanceOf<T>) {470 fn unlock_balance_unchecked(staker: &T::AccountId, amount: BalanceOf<T>) {526 let mut locked_balance = Self::get_locked_balance(staker).map(|l| l.amount).unwrap();471 let mut locked_balance = Self::get_locked_balance(staker).map(|l| l.amount).unwrap();527 locked_balance -= amount;472 locked_balance -= amount;pallets/app-promotion/src/types.rsdiffbeforeafterboth9use sp_runtime::DispatchError;9use sp_runtime::DispatchError;10use up_data_structs::{CollectionId, SponsorshipState};10use up_data_structs::{CollectionId, SponsorshipState};11use sp_std::borrow::ToOwned;11use sp_std::borrow::ToOwned;1212use pallet_evm_contract_helpers::{Pallet as EvmHelpersPallet, Config as EvmHelpersConfig, Sponsoring};131314pub trait ExtendedLockableCurrency<AccountId: Parameter>: LockableCurrency<AccountId> {14pub trait ExtendedLockableCurrency<AccountId: Parameter>: LockableCurrency<AccountId> {15 fn locks<KArg>(who: KArg) -> WeakBoundedVec<BalanceLock<Self::Balance>, Self::MaxLocks>15 fn locks<KArg>(who: KArg) -> WeakBoundedVec<BalanceLock<Self::Balance>, Self::MaxLocks>95 }95 }96}96}9798pub trait ContractHandler {99 type ContractId;100 type AccountId;101102 fn set_sponsor(sponsor_id: Self::AccountId, contract_id: Self::ContractId) -> DispatchResult;103104 fn remove_contract_sponsor(collection_id: Self::ContractId) -> DispatchResult;105106 fn get_sponsor(contract_id: Self::ContractId)107 -> Result<Option<Self::AccountId>, DispatchError>;108}109110impl<T: EvmHelpersConfig> ContractHandler for EvmHelpersPallet<T> {111 type ContractId = sp_core::H160;112113 type AccountId = T::CrossAccountId;114115 fn set_sponsor(sponsor_id: Self::AccountId, contract_id: Self::ContractId) -> DispatchResult {116 Sponsoring::<T>::insert(117 contract_id,118 SponsorshipState::<T::CrossAccountId>::Confirmed(sponsor_id),119 );120 Ok(())121 }122123 fn remove_contract_sponsor(contract_id: Self::ContractId) -> DispatchResult {124 Sponsoring::<T>::remove(contract_id);125 Ok(())126 }127128 fn get_sponsor(129 contract_id: Self::ContractId,130 ) -> Result<Option<Self::AccountId>, DispatchError> {131 Ok(Self::get_sponsor(contract_id))132 }133}97134pallets/evm-contract-helpers/src/lib.rsdiffbeforeafterboth75 /// * **Key** - contract address.75 /// * **Key** - contract address.76 /// * **Value** - sponsorship state.76 /// * **Value** - sponsorship state.77 #[pallet::storage]77 #[pallet::storage]78 pub(super) type Sponsoring<T: Config> = StorageMap<78 pub type Sponsoring<T: Config> = StorageMap<79 Hasher = Twox64Concat,79 Hasher = Twox64Concat,80 Key = H160,80 Key = H160,81 Value = SponsorshipState<T::CrossAccountId>,81 Value = SponsorshipState<T::CrossAccountId>,primitives/common/src/constants.rsdiffbeforeafterboth22use crate::types::{BlockNumber, Balance};22use crate::types::{BlockNumber, Balance};232324pub const MILLISECS_PER_BLOCK: u64 = 12000;24pub const MILLISECS_PER_BLOCK: u64 = 12000;25pub const MILLISECS_PER_RELAY_BLOCK: u64 = 6000;252626pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;27pub const SLOT_DURATION: u64 = MILLISECS_PER_BLOCK;272830pub const HOURS: BlockNumber = MINUTES * 60;31pub const HOURS: BlockNumber = MINUTES * 60;31pub const DAYS: BlockNumber = HOURS * 24;32pub const DAYS: BlockNumber = HOURS * 24;3334// These time units are defined in number of relay blocks.35pub const RELAY_MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_RELAY_BLOCK as BlockNumber);36pub const RELAY_HOURS: BlockNumber = RELAY_MINUTES * 60;37pub const RELAY_DAYS: BlockNumber = RELAY_HOURS * 24;323833pub const MICROUNIQUE: Balance = 1_000_000_000_000;39pub const MICROUNIQUE: Balance = 1_000_000_000_000;34pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;40pub const MILLIUNIQUE: Balance = 1_000 * MICROUNIQUE;runtime/common/config/pallets/app_promotion.rsdiffbeforeafterboth161617use crate::{17use crate::{18 runtime_common::config::pallets::{TreasuryAccountId, RelayChainBlockNumberProvider},18 runtime_common::config::pallets::{TreasuryAccountId, RelayChainBlockNumberProvider},19 Runtime, Balances, BlockNumber, Unique, Event,19 Runtime, Balances, BlockNumber, Unique, Event, EvmContractHelpers,20};20};212122use frame_support::{parameter_types, PalletId};22use frame_support::{parameter_types, PalletId};23use sp_arithmetic::Perbill;23use sp_arithmetic::Perbill;24use up_common::{24use up_common::{25 constants::{DAYS, UNIQUE},25 constants::{DAYS, UNIQUE, RELAY_DAYS},26 types::Balance,26 types::Balance,27};27};282829#[cfg(all(not(feature = "unique-runtime"), not(feature = "quartz-runtime")))]29parameter_types! {30parameter_types! {30 pub const AppPromotionId: PalletId = PalletId(*b"appstake");31 pub const AppPromotionId: PalletId = PalletId(*b"appstake");31 pub const RecalculationInterval: BlockNumber = 20;32 pub const RecalculationInterval: BlockNumber = 20;32 pub const PendingInterval: BlockNumber = 10;33 pub const PendingInterval: BlockNumber = 20;33 pub const Nominal: Balance = UNIQUE;34 pub const Nominal: Balance = UNIQUE;34 pub const Day: BlockNumber = DAYS;35 pub const Day: BlockNumber = DAYS;35 pub IntervalIncome: Perbill = Perbill::from_rational(RecalculationInterval::get(), 2 * DAYS) * Perbill::from_rational(5u32, 10_000);36 pub IntervalIncome: Perbill = Perbill::from_rational(RecalculationInterval::get(), RELAY_DAYS) * Perbill::from_rational(5u32, 10_000);36}37}3839#[cfg(any(feature = "unique-runtime", feature = "quartz-runtime"))]40parameter_types! {41 pub const AppPromotionId: PalletId = PalletId(*b"appstake");42 pub const RecalculationInterval: BlockNumber = RELAY_DAYS;43 pub const PendingInterval: BlockNumber = 7 * RELAY_DAYS;44 pub const Nominal: Balance = UNIQUE;45 pub const Day: BlockNumber = RELAY_DAYS;46 pub IntervalIncome: Perbill = Perbill::from_rational(5u32, 10_000);47}374838impl pallet_app_promotion::Config for Runtime {49impl pallet_app_promotion::Config for Runtime {39 type PalletId = AppPromotionId;50 type PalletId = AppPromotionId;40 type CollectionHandler = Unique;51 type CollectionHandler = Unique;52 type ContractHandler = EvmContractHelpers;41 type Currency = Balances;53 type Currency = Balances;42 type WeightInfo = pallet_app_promotion::weights::SubstrateWeight<Self>;54 type WeightInfo = pallet_app_promotion::weights::SubstrateWeight<Self>;43 type TreasuryAccountId = TreasuryAccountId;55 type TreasuryAccountId = TreasuryAccountId;tests/src/app-promotion.test.tsdiffbeforeafterboth707 });707 });708 });708 });709 709710 after(async function () {711 await usingPlaygrounds(async (helper) => {712 await helper.signTransaction(alice, helper.api!.tx.sudo.sudo(helper.api!.tx.promotion.stopAppPromotion()));713 });714 });715 710 it('will credit 0.05% for staking period', async () => {716 it('will credit 0.05% for staking period', async () => {711 // arrange: bob.stake(10000);717 // arrange: bob.stake(10000);770 const staker = await createUser(40n * nominal);776 const staker = await createUser(40n * nominal);771 777 772 await waitForRecalculationBlock(helper.api!);778 await waitForRecalculationBlock(helper.api!);773 // const foo = await helper.api!.registry.getChainProperties().779 774780775 await expect(helper.signTransaction(staker, helper.api!.tx.promotion.stake(10n * nominal))).to.be.eventually.fulfilled;781 await expect(helper.signTransaction(staker, helper.api!.tx.promotion.stake(10n * nominal))).to.be.eventually.fulfilled;776 // await waitNewBlocks(helper.api!, 1);782 777 await expect(helper.signTransaction(staker, helper.api!.tx.promotion.stake(10n * nominal))).to.be.eventually.fulfilled;783 await expect(helper.signTransaction(staker, helper.api!.tx.promotion.stake(10n * nominal))).to.be.eventually.fulfilled;778 // await waitNewBlocks(helper.api!, 1);784 779 await expect(helper.signTransaction(staker, helper.api!.tx.promotion.stake(10n * nominal))).to.be.eventually.fulfilled;785 await expect(helper.signTransaction(staker, helper.api!.tx.promotion.stake(10n * nominal))).to.be.eventually.fulfilled;780 // console.log(await helper.balance.getSubstrate(staker.address));786 781 // await waitNewBlocks(helper.api!, 17);782 await waitForRelayBlock(helper.api!, 34);787 await waitForRelayBlock(helper.api!, 34);783 expect((await helper.api!.rpc.unique.totalStakedPerBlock(normalizeAccountId(staker)))788 expect((await helper.api!.rpc.unique.totalStakedPerBlock(normalizeAccountId(staker)))784 .map(([_, amount]) => amount.toBigInt()))789 .map(([_, amount]) => amount.toBigInt()))785 .to.be.deep.equal([calculateIncome(10n * nominal, 10n), calculateIncome(10n * nominal, 10n), calculateIncome(10n * nominal, 10n)]);790 .to.be.deep.equal([calculateIncome(10n * nominal, 10n), calculateIncome(10n * nominal, 10n), calculateIncome(10n * nominal, 10n)]);786 791 787 // console.log(await getBlockNumber(helper.api!));788 // console.log((await helper.api!.rpc.unique.totalStakedPerBlock(normalizeAccountId(staker))).map(([block, amount]) => [block.toBigInt(), amount.toBigInt()]));789 // console.log(`${calculateIncome(10n * nominal, 10n)} || ${calculateIncome(10n * nominal, 10n, 2)}`);790 // await waitNewBlocks(helper.api!, 10);791 await waitForRelayBlock(helper.api!, 20);792 await waitForRelayBlock(helper.api!, 20);792 // console.log((await helper.api!.rpc.unique.totalStakedPerBlock(normalizeAccountId(staker))).map(([_, amount]) => amount.toBigInt()));793 // console.log(await helper.balance.getSubstrate(staker.address));794 await expect(helper.signTransaction(staker, helper.api!.tx.promotion.unstake(calculateIncome(10n * nominal, 10n, 2) - 10n * nominal))).to.be.eventually.fulfilled;793 await expect(helper.signTransaction(staker, helper.api!.tx.promotion.unstake(calculateIncome(10n * nominal, 10n, 2) - 10n * nominal))).to.be.eventually.fulfilled;795 // console.log(calculateIncome(10n * nominal, 10n, 2));796 // console.log(calculateIncome(10n * nominal, 10n, 3));797 // console.log(calculateIncome(10n * nominal, 10n, 4));798 // console.log(calculateIncome(10n * nominal, 10n, 5));799 expect((await helper.api!.rpc.unique.totalStakedPerBlock(normalizeAccountId(staker)))794 expect((await helper.api!.rpc.unique.totalStakedPerBlock(normalizeAccountId(staker)))800 .map(([_, amount]) => amount.toBigInt()))795 .map(([_, amount]) => amount.toBigInt()))801 .to.be.deep.equal([10n * nominal, calculateIncome(10n * nominal, 10n, 2), calculateIncome(10n * nominal, 10n, 2)]);796 .to.be.deep.equal([10n * nominal, calculateIncome(10n * nominal, 10n, 2), calculateIncome(10n * nominal, 10n, 2)]);802 803 // console.log((await helper.api!.rpc.unique.totalStakedPerBlock(normalizeAccountId(staker))).map(([_, amount]) => amount.toBigInt()));804 805 // console.log(await helper.balance.getSubstrate(staker.address));806 });797 });807 798 808 });799 });tests/src/interfaces/augment-api-consts.tsdiffbeforeafterboth77 * The app's pallet id, used for deriving its sovereign account ID.77 * The app's pallet id, used for deriving its sovereign account ID.78 **/78 **/79 palletId: FrameSupportPalletId & AugmentedConst<ApiType>;79 palletId: FrameSupportPalletId & AugmentedConst<ApiType>;80 /**80 /**81 * In chain blocks.81 * In relay blocks.82 **/82 **/83 pendingInterval: u32 & AugmentedConst<ApiType>;83 pendingInterval: u32 & AugmentedConst<ApiType>;84 /**84 /**85 * In relay blocks.85 * In relay blocks.tests/src/interfaces/augment-api-errors.tsdiffbeforeafterboth430 [key: string]: AugmentedError<ApiType>;430 [key: string]: AugmentedError<ApiType>;431 };431 };432 promotion: {432 promotion: {433 /**434 * Error due to action requiring admin to be set435 **/433 AdminNotSet: AugmentedError<ApiType>;436 AdminNotSet: AugmentedError<ApiType>;434 AlreadySponsored: AugmentedError<ApiType>;437 /**438 * An error related to the fact that an invalid argument was passed to perform an action439 **/435 InvalidArgument: AugmentedError<ApiType>;440 InvalidArgument: AugmentedError<ApiType>;436 /**441 /**437 * No permission to perform action442 * No permission to perform an action438 **/443 **/439 NoPermission: AugmentedError<ApiType>;444 NoPermission: AugmentedError<ApiType>;440 /**445 /**441 * Insufficient funds to perform an action446 * Insufficient funds to perform an actiontests/src/interfaces/augment-api-query.tsdiffbeforeafterboth524 * Amount of tokens staked by account in the blocknumber.524 * Amount of tokens staked by account in the blocknumber.525 **/525 **/526 staked: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<u128>, [AccountId32, u32]> & QueryableStorageEntry<ApiType, [AccountId32, u32]>;526 staked: AugmentedQuery<ApiType, (arg1: AccountId32 | string | Uint8Array, arg2: u32 | AnyNumber | Uint8Array) => Observable<u128>, [AccountId32, u32]> & QueryableStorageEntry<ApiType, [AccountId32, u32]>;527 /**527 /**528 * A block when app-promotion has started528 * A block when app-promotion has started .I think this is redundant, because we only need `NextInterestBlock`.529 **/529 **/530 startBlock: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;530 startBlock: AugmentedQuery<ApiType, () => Observable<u32>, []> & QueryableStorageEntry<ApiType, []>;531 totalStaked: AugmentedQuery<ApiType, () => Observable<u128>, []> & QueryableStorageEntry<ApiType, []>;531 totalStaked: AugmentedQuery<ApiType, () => Observable<u128>, []> & QueryableStorageEntry<ApiType, []>;532 /**532 /**tests/src/interfaces/augment-api-tx.tsdiffbeforeafterboth365 promotion: {365 promotion: {366 setAdminAddress: AugmentedSubmittable<(admin: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr]>;366 setAdminAddress: AugmentedSubmittable<(admin: PalletEvmAccountBasicCrossAccountIdRepr | { Substrate: any } | { Ethereum: any } | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [PalletEvmAccountBasicCrossAccountIdRepr]>;367 sponsorCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;367 sponsorCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;368 sponsorConract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;368 stake: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u128]>;369 stake: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u128]>;369 startAppPromotion: AugmentedSubmittable<(promotionStartRelayBlock: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;370 startAppPromotion: AugmentedSubmittable<(promotionStartRelayBlock: Option<u32> | null | Uint8Array | u32 | AnyNumber) => SubmittableExtrinsic<ApiType>, [Option<u32>]>;371 stopAppPromotion: AugmentedSubmittable<() => SubmittableExtrinsic<ApiType>, []>;370 stopSponsorignCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;372 stopSponsorignCollection: AugmentedSubmittable<(collectionId: u32 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u32]>;373 stopSponsorignContract: AugmentedSubmittable<(contractId: H160 | string | Uint8Array) => SubmittableExtrinsic<ApiType>, [H160]>;371 unstake: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u128]>;374 unstake: AugmentedSubmittable<(amount: u128 | AnyNumber | Uint8Array) => SubmittableExtrinsic<ApiType>, [u128]>;372 /**375 /**373 * Generic tx376 * Generic txtests/src/interfaces/default/types.tsdiffbeforeafterboth816 readonly asStartAppPromotion: {816 readonly asStartAppPromotion: {817 readonly promotionStartRelayBlock: Option<u32>;817 readonly promotionStartRelayBlock: Option<u32>;818 } & Struct;818 } & Struct;819 readonly isStopAppPromotion: boolean;819 readonly isStake: boolean;820 readonly isStake: boolean;820 readonly asStake: {821 readonly asStake: {821 readonly amount: u128;822 readonly amount: u128;832 readonly asStopSponsorignCollection: {833 readonly asStopSponsorignCollection: {833 readonly collectionId: u32;834 readonly collectionId: u32;834 } & Struct;835 } & Struct;836 readonly isSponsorConract: boolean;837 readonly asSponsorConract: {838 readonly contractId: H160;839 } & Struct;840 readonly isStopSponsorignContract: boolean;841 readonly asStopSponsorignContract: {842 readonly contractId: H160;843 } & Struct;835 readonly type: 'SetAdminAddress' | 'StartAppPromotion' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsorignCollection';844 readonly type: 'SetAdminAddress' | 'StartAppPromotion' | 'StopAppPromotion' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsorignCollection' | 'SponsorConract' | 'StopSponsorignContract';836}845}837846838/** @name PalletAppPromotionError */847/** @name PalletAppPromotionError */841 readonly isNoPermission: boolean;850 readonly isNoPermission: boolean;842 readonly isNotSufficientFounds: boolean;851 readonly isNotSufficientFounds: boolean;843 readonly isInvalidArgument: boolean;852 readonly isInvalidArgument: boolean;844 readonly isAlreadySponsored: boolean;845 readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFounds' | 'InvalidArgument' | 'AlreadySponsored';853 readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFounds' | 'InvalidArgument';846}854}847855848/** @name PalletAppPromotionEvent */856/** @name PalletAppPromotionEvent */tests/src/interfaces/lookup.tsdiffbeforeafterboth2463 start_app_promotion: {2463 start_app_promotion: {2464 promotionStartRelayBlock: 'Option<u32>',2464 promotionStartRelayBlock: 'Option<u32>',2465 },2465 },2466 stop_app_promotion: 'Null',2466 stake: {2467 stake: {2467 amount: 'u128',2468 amount: 'u128',2468 },2469 },2474 },2475 },2475 stop_sponsorign_collection: {2476 stop_sponsorign_collection: {2476 collectionId: 'u32'2477 collectionId: 'u32',2477 }2478 },2479 sponsor_conract: {2480 contractId: 'H160',2481 },2482 stop_sponsorign_contract: {2483 contractId: 'H160'2484 }2478 }2485 }2479 },2486 },2480 /**2487 /**3098 * Lookup410: pallet_app_promotion::pallet::Error<T>3105 * Lookup410: pallet_app_promotion::pallet::Error<T>3099 **/3106 **/3100 PalletAppPromotionError: {3107 PalletAppPromotionError: {3101 _enum: ['AdminNotSet', 'NoPermission', 'NotSufficientFounds', 'InvalidArgument', 'AlreadySponsored']3108 _enum: ['AdminNotSet', 'NoPermission', 'NotSufficientFounds', 'InvalidArgument']3102 },3109 },3103 /**3110 /**3104 * Lookup413: pallet_evm::pallet::Error<T>3111 * Lookup413: pallet_evm::pallet::Error<T>tests/src/interfaces/types-lookup.tsdiffbeforeafterboth2669 readonly asStartAppPromotion: {2669 readonly asStartAppPromotion: {2670 readonly promotionStartRelayBlock: Option<u32>;2670 readonly promotionStartRelayBlock: Option<u32>;2671 } & Struct;2671 } & Struct;2672 readonly isStopAppPromotion: boolean;2672 readonly isStake: boolean;2673 readonly isStake: boolean;2673 readonly asStake: {2674 readonly asStake: {2674 readonly amount: u128;2675 readonly amount: u128;2685 readonly asStopSponsorignCollection: {2686 readonly asStopSponsorignCollection: {2686 readonly collectionId: u32;2687 readonly collectionId: u32;2687 } & Struct;2688 } & Struct;2689 readonly isSponsorConract: boolean;2690 readonly asSponsorConract: {2691 readonly contractId: H160;2692 } & Struct;2693 readonly isStopSponsorignContract: boolean;2694 readonly asStopSponsorignContract: {2695 readonly contractId: H160;2696 } & Struct;2688 readonly type: 'SetAdminAddress' | 'StartAppPromotion' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsorignCollection';2697 readonly type: 'SetAdminAddress' | 'StartAppPromotion' | 'StopAppPromotion' | 'Stake' | 'Unstake' | 'SponsorCollection' | 'StopSponsorignCollection' | 'SponsorConract' | 'StopSponsorignContract';2689 }2698 }269026992691 /** @name PalletEvmCall (305) */2700 /** @name PalletEvmCall (305) */3288 readonly isNoPermission: boolean;3297 readonly isNoPermission: boolean;3289 readonly isNotSufficientFounds: boolean;3298 readonly isNotSufficientFounds: boolean;3290 readonly isInvalidArgument: boolean;3299 readonly isInvalidArgument: boolean;3291 readonly isAlreadySponsored: boolean;3292 readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFounds' | 'InvalidArgument' | 'AlreadySponsored';3300 readonly type: 'AdminNotSet' | 'NoPermission' | 'NotSufficientFounds' | 'InvalidArgument';3293 }3301 }329433023295 /** @name PalletEvmError (413) */3303 /** @name PalletEvmError (413) */