difftreelog
Convert inflation to FRAMEv2 and update
in: master
3 files changed
pallets/inflation/src/lib.rsdiffbeforeafterboth--- a/pallets/inflation/src/lib.rs
+++ b/pallets/inflation/src/lib.rs
@@ -5,45 +5,32 @@
#![recursion_limit = "1024"]
#![cfg_attr(not(feature = "std"), no_std)]
-
-#[cfg(feature = "std")]
-pub use std::*;
-
-pub use serde::{Serialize, Deserialize};
+#![allow(
+ clippy::too_many_arguments,
+ clippy::unnecessary_mut_passed,
+ clippy::unused_unit
+)]
-#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
-
#[cfg(test)]
+mod mock;
+#[cfg(test)]
mod tests;
-pub use frame_support::{
- construct_runtime, decl_module, decl_storage, ensure,
- traits::{
- Currency, ExistenceRequirement, Get, Imbalance, KeyOwnerProofSystem, OnUnbalanced,
- Randomness, IsSubType, WithdrawReasons,
- },
- weights::{
- constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
- DispatchInfo, GetDispatchInfo, IdentityFee, Pays, PostDispatchInfo, Weight,
- WeightToFeePolynomial, DispatchClass,
- },
- StorageValue, transactional,
+use frame_support::{
+ dispatch::{DispatchResult},
+ ensure,
+ traits::{Currency, Get},
};
-
-// #[cfg(feature = "runtime-benchmarks")]
-pub use frame_support::dispatch::DispatchResult;
-
+pub use pallet::*;
use sp_runtime::{
Perbill,
- traits::{BlockNumberProvider},
+ traits::{BlockNumberProvider}
};
-use sp_std::convert::TryInto;
-use frame_system::{self as system};
+use std::convert::TryInto;
-/// The balance type of this module.
-pub type BalanceOf<T> =
+type BalanceOf<T> =
<<T as Config>::Currency as Currency<<T as frame_system::Config>::AccountId>>::Balance;
pub const YEAR: u32 = 5_259_600; // 6-second block
@@ -52,39 +39,55 @@
pub const START_INFLATION_PERCENT: u32 = 10;
pub const END_INFLATION_PERCENT: u32 = 4;
-pub trait Config: system::Config {
- type Currency: Currency<Self::AccountId>;
- type TreasuryAccountId: Get<Self::AccountId>;
- type InflationBlockInterval: Get<Self::BlockNumber>;
+#[frame_support::pallet]
+pub mod pallet {
+ use super::*;
+ use frame_support::pallet_prelude::*;
+ use frame_system::pallet_prelude::*;
- // The block number provider
- type BlockNumberProvider: BlockNumberProvider<BlockNumber = Self::BlockNumber>;
-}
+ #[pallet::error]
+ pub enum Error<T> {
+ /// Inflation has already been initialized
+ AlreadyInitialized,
+ }
-decl_storage! {
- trait Store for Module<T: Config> as Inflation {
- /// starting year total issuance
- pub StartingYearTotalIssuance get(fn starting_year_total_issuance): BalanceOf<T>;
+ #[pallet::config]
+ pub trait Config: frame_system::Config {
+ type Currency: Currency<Self::AccountId>;
+ type TreasuryAccountId: Get<Self::AccountId>;
+
+ // The block number provider
+ type BlockNumberProvider: BlockNumberProvider<BlockNumber = Self::BlockNumber>;
- /// Current block inflation
- pub BlockInflation get(fn block_inflation): BalanceOf<T>;
+ /// Number of blocks that pass between treasury balance updates due to inflation
+ #[pallet::constant]
+ type InflationBlockInterval: Get<Self::BlockNumber>;
+ }
- /// Next (relay) block when inflation is applied. This value is approximate.
- pub NextInflationBlock get(fn next_inflation_block): T::BlockNumber;
+ #[pallet::pallet]
+ #[pallet::generate_store(pub(super) trait Store)]
+ pub struct Pallet<T>(_);
- /// Next (relay) block when inflation is recalculated. This value is approximate.
- pub NextRecalculationBlock get(fn next_recalculation_block): T::BlockNumber;
- }
-}
+ /// starting year total issuance
+ #[pallet::storage]
+ pub type StartingYearTotalIssuance<T: Config> = StorageValue<Value = BalanceOf<T>, QueryKind = ValueQuery>;
-decl_module! {
- pub struct Module<T: Config> for enum Call
- where
- origin: T::Origin,
- {
- const InflationBlockInterval: T::BlockNumber = T::InflationBlockInterval::get();
+ /// Current inflation for `InflationBlockInterval` number of blocks
+ #[pallet::storage]
+ pub type BlockInflation<T: Config> = StorageValue<Value = BalanceOf<T>, QueryKind = ValueQuery>;
- fn on_initialize() -> Weight
+ /// Next target (relay) block when inflation will be applied
+ #[pallet::storage]
+ pub type NextInflationBlock<T: Config> = StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;
+
+ /// Next target (relay) block when inflation is recalculated
+ #[pallet::storage]
+ pub type NextRecalculationBlock<T: Config> = StorageValue<Value = T::BlockNumber, QueryKind = ValueQuery>;
+
+ #[pallet::hooks]
+ impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T> {
+ fn on_initialize(_: T::BlockNumber) -> Weight
+ where <T as frame_system::Config>::BlockNumber: From<u32>
{
let mut consumed_weight = 0;
let mut add_weight = |reads, writes, weight| {
@@ -93,55 +96,96 @@
};
let block_interval: u32 = T::InflationBlockInterval::get().try_into().unwrap_or(0);
- let _now = T::BlockNumberProvider::current_block_number();
- let next_recalculation: T::BlockNumber = <NextRecalculationBlock<T>>::get();
+ let current_relay_block = T::BlockNumberProvider::current_block_number();
let next_inflation: T::BlockNumber = <NextInflationBlock<T>>::get();
- add_weight(2, 0, 5_000_000);
+ add_weight(1, 0, 5_000_000);
- // Recalculate inflation on the first block of the year (or if it is not initialized yet)
- if _now >= next_recalculation {
- let current_year: u32 = (next_recalculation / T::BlockNumber::from(YEAR)).try_into().unwrap_or(0);
+ // Apply inflation every InflationBlockInterval blocks
+ // If next_inflation == 0, this means inflation wasn't yet initialized
+ if (next_inflation != 0u32.into()) && (current_relay_block >= next_inflation) {
- let one_percent = Perbill::from_percent(1);
-
- if current_year <= TOTAL_YEARS_UNTIL_FLAT {
- let amount: BalanceOf<T> = Perbill::from_rational(
- block_interval * (START_INFLATION_PERCENT * TOTAL_YEARS_UNTIL_FLAT - current_year * (START_INFLATION_PERCENT - END_INFLATION_PERCENT)),
- YEAR * TOTAL_YEARS_UNTIL_FLAT
- ) * ( one_percent * T::Currency::total_issuance() );
- <BlockInflation<T>>::put(amount);
- }
- else {
- let amount: BalanceOf<T> = Perbill::from_rational(
- block_interval * END_INFLATION_PERCENT,
- YEAR
- ) * (one_percent * T::Currency::total_issuance());
- <BlockInflation<T>>::put(amount);
+ // Recalculate inflation on the first block of the year (or if it is not initialized yet)
+ // Do the "current_relay_block >= next_recalculation" check in the "current_relay_block >= next_inflation"
+ // block because it saves InflationBlockInterval DB reads for NextRecalculationBlock.
+ let next_recalculation: T::BlockNumber = <NextRecalculationBlock<T>>::get();
+ add_weight(1, 0, 0);
+ if current_relay_block >= next_recalculation {
+ Self::recalculate_inflation(next_recalculation);
+ add_weight(0, 4, 5_000_000);
}
- <StartingYearTotalIssuance<T>>::set(T::Currency::total_issuance());
-
- // First time deposit
- T::Currency::deposit_creating(&T::TreasuryAccountId::get(), <BlockInflation<T>>::get());
-
- // Update recalculation and inflation blocks
- <NextRecalculationBlock<T>>::set(next_recalculation + YEAR.into());
- <NextInflationBlock<T>>::set(next_recalculation + block_interval.into());
- add_weight(7, 8, 28_300_000);
- }
-
- // Apply inflation every InflationBlockInterval blocks and in the 1st block to initialize Treasury account
- else if _now >= next_inflation {
T::Currency::deposit_into_existing(&T::TreasuryAccountId::get(), <BlockInflation<T>>::get()).ok();
// Update inflation block
<NextInflationBlock<T>>::set(next_inflation + block_interval.into());
- add_weight(3, 3, 12_900_000);
+ add_weight(3, 3, 10_000_000);
}
consumed_weight
}
+ }
+ #[pallet::call]
+ impl<T: Config> Pallet<T> {
+ /// 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.
+ ///
+ /// # Permissions
+ ///
+ /// * Root
+ ///
+ /// # Arguments
+ ///
+ /// * inflation_start_relay_block: The relay chain block at which inflation should start
+ #[pallet::weight(0)]
+ pub fn start_inflation(origin: OriginFor<T>, inflation_start_relay_block: T::BlockNumber) -> DispatchResult
+ where <T as frame_system::Config>::BlockNumber: From<u32> {
+ ensure_root(origin)?;
+
+ // Ensure inflation has not been yet initialized
+ let next_inflation: T::BlockNumber = <NextInflationBlock<T>>::get();
+ ensure!(next_inflation == 0u32.into(), Error::<T>::AlreadyInitialized);
+
+ // Recalculate inflation. This can be backdated and will catch up.
+ Self::recalculate_inflation(inflation_start_relay_block);
+ let block_interval: u32 = T::InflationBlockInterval::get().try_into().unwrap_or(0);
+ <NextInflationBlock<T>>::set(inflation_start_relay_block + block_interval.into());
+
+ // First time deposit - create Treasury account so that we can call deposit_into_existing everywhere else
+ T::Currency::deposit_creating(&T::TreasuryAccountId::get(), <BlockInflation<T>>::get());
+
+ Ok(())
+ }
}
}
+
+impl<T: Config> Pallet<T> {
+ pub fn recalculate_inflation(recalculation_block: T::BlockNumber) {
+
+ let current_year: u32 = (recalculation_block / T::BlockNumber::from(YEAR)).try_into().unwrap_or(0);
+ let block_interval: u32 = T::InflationBlockInterval::get().try_into().unwrap_or(0);
+
+ let one_percent = Perbill::from_percent(1);
+
+ if current_year <= TOTAL_YEARS_UNTIL_FLAT {
+ let amount: BalanceOf<T> = Perbill::from_rational(
+ block_interval * (START_INFLATION_PERCENT * TOTAL_YEARS_UNTIL_FLAT - current_year * (START_INFLATION_PERCENT - END_INFLATION_PERCENT)),
+ YEAR * TOTAL_YEARS_UNTIL_FLAT
+ ) * ( one_percent * T::Currency::total_issuance() );
+ <BlockInflation<T>>::put(amount);
+ }
+ else {
+ let amount: BalanceOf<T> = Perbill::from_rational(
+ block_interval * END_INFLATION_PERCENT,
+ YEAR
+ ) * (one_percent * T::Currency::total_issuance());
+ <BlockInflation<T>>::put(amount);
+ }
+ <StartingYearTotalIssuance<T>>::set(T::Currency::total_issuance());
+
+ // Update recalculation and inflation blocks
+ <NextRecalculationBlock<T>>::set(recalculation_block + YEAR.into());
+ }
+}
\ No newline at end of file
runtime/Cargo.tomldiffbeforeafterboth1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Unique Runtime'8edition = '2018'9homepage = 'https://unique.network'10license = 'All Rights Reserved'11name = 'unique-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version = '0.9.12'1415[package.metadata.docs.rs]16targets = ['x86_64-unknown-linux-gnu']1718[features]19default = ['std']20runtime-benchmarks = [21 'hex-literal',22 'frame-benchmarking',23 'frame-support/runtime-benchmarks',24 'frame-system-benchmarking',25 'frame-system/runtime-benchmarks',26 'pallet-evm-migration/runtime-benchmarks',27 'pallet-balances/runtime-benchmarks',28 'pallet-timestamp/runtime-benchmarks',29 'pallet-common/runtime-benchmarks',30 'pallet-fungible/runtime-benchmarks',31 'pallet-refungible/runtime-benchmarks',32 'pallet-nonfungible/runtime-benchmarks',33 'pallet-unique/runtime-benchmarks',34 'pallet-inflation/runtime-benchmarks',35 'pallet-xcm/runtime-benchmarks',36 'sp-runtime/runtime-benchmarks',37 'xcm-builder/runtime-benchmarks',38]39std = [40 'codec/std',41 'cumulus-pallet-aura-ext/std',42 'cumulus-pallet-parachain-system/std',43 'cumulus-pallet-xcm/std',44 'cumulus-pallet-xcmp-queue/std',45 'cumulus-primitives-core/std',46 'cumulus-primitives-utility/std',47 'frame-executive/std',48 'frame-support/std',49 'frame-system/std',50 'frame-system-rpc-runtime-api/std',51 'pallet-aura/std',52 'pallet-balances/std',53 # 'pallet-contracts/std',54 # 'pallet-contracts-primitives/std',55 # 'pallet-contracts-rpc-runtime-api/std',56 # 'pallet-contract-helpers/std',57 'pallet-randomness-collective-flip/std',58 'pallet-sudo/std',59 'pallet-timestamp/std',60 'pallet-transaction-payment/std',61 'pallet-transaction-payment-rpc-runtime-api/std',62 'pallet-treasury/std',63 # 'pallet-vesting/std',64 'pallet-evm/std',65 'pallet-evm-migration/std',66 'pallet-evm-contract-helpers/std',67 'pallet-evm-transaction-payment/std',68 'pallet-evm-coder-substrate/std',69 'pallet-ethereum/std',70 'fp-rpc/std',71 'up-rpc/std',72 'up-evm-mapping/std',73 'fp-self-contained/std',74 'parachain-info/std',75 'serde',76 'pallet-inflation/std',77 'pallet-common/std',78 'pallet-fungible/std',79 'pallet-refungible/std',80 'pallet-nonfungible/std',81 'pallet-unique/std',82 'pallet-unq-scheduler/std',83 'pallet-charge-transaction/std',84 'up-data-structs/std',85 'sp-api/std',86 'sp-block-builder/std',87 "sp-consensus-aura/std",88 'sp-core/std',89 'sp-inherents/std',90 'sp-io/std',91 'sp-offchain/std',92 'sp-runtime/std',93 'sp-session/std',94 'sp-std/std',95 'sp-transaction-pool/std',96 'sp-version/std',97 'xcm/std',98 'xcm-builder/std',99 'xcm-executor/std',100101 "orml-vesting/std",102]103limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']104105################################################################################106# Substrate Dependencies107108[dependencies.codec]109default-features = false110features = ['derive']111package = 'parity-scale-codec'112version = '2.3.0'113114[dependencies.frame-benchmarking]115default-features = false116git = 'https://github.com/paritytech/substrate.git'117optional = true118branch = 'polkadot-v0.9.12'119120[dependencies.frame-executive]121default-features = false122git = 'https://github.com/paritytech/substrate.git'123branch = 'polkadot-v0.9.12'124125[dependencies.frame-support]126default-features = false127git = 'https://github.com/paritytech/substrate.git'128branch = 'polkadot-v0.9.12'129130[dependencies.frame-system]131default-features = false132git = 'https://github.com/paritytech/substrate.git'133branch = 'polkadot-v0.9.12'134135[dependencies.frame-system-benchmarking]136default-features = false137git = 'https://github.com/paritytech/substrate.git'138optional = true139branch = 'polkadot-v0.9.12'140141[dependencies.frame-system-rpc-runtime-api]142default-features = false143git = 'https://github.com/paritytech/substrate.git'144branch = 'polkadot-v0.9.12'145146[dependencies.hex-literal]147optional = true148version = '0.3.3'149150[dependencies.serde]151default-features = false152features = ['derive']153optional = true154version = '1.0.130'155156[dependencies.pallet-aura]157default-features = false158git = 'https://github.com/paritytech/substrate.git'159branch = 'polkadot-v0.9.12'160161[dependencies.pallet-balances]162default-features = false163git = 'https://github.com/paritytech/substrate.git'164branch = 'polkadot-v0.9.12'165166# Contracts specific packages167# [dependencies.pallet-contracts]168# git = 'https://github.com/paritytech/substrate.git'169# default-features = false170# branch = 'polkadot-v0.9.12'171# version = '4.0.0-dev'172173# [dependencies.pallet-contracts-primitives]174# git = 'https://github.com/paritytech/substrate.git'175# default-features = false176# branch = 'polkadot-v0.9.12'177# version = '4.0.0-dev'178179# [dependencies.pallet-contracts-rpc-runtime-api]180# git = 'https://github.com/paritytech/substrate.git'181# default-features = false182# branch = 'polkadot-v0.9.12'183# version = '4.0.0-dev'184185[dependencies.pallet-randomness-collective-flip]186default-features = false187git = 'https://github.com/paritytech/substrate.git'188branch = 'polkadot-v0.9.12'189190[dependencies.pallet-sudo]191default-features = false192git = 'https://github.com/paritytech/substrate.git'193branch = 'polkadot-v0.9.12'194195[dependencies.pallet-timestamp]196default-features = false197git = 'https://github.com/paritytech/substrate.git'198branch = 'polkadot-v0.9.12'199200[dependencies.pallet-transaction-payment]201default-features = false202git = 'https://github.com/paritytech/substrate.git'203branch = 'polkadot-v0.9.12'204205[dependencies.pallet-transaction-payment-rpc-runtime-api]206default-features = false207git = 'https://github.com/paritytech/substrate.git'208branch = 'polkadot-v0.9.12'209210[dependencies.pallet-treasury]211default-features = false212git = 'https://github.com/paritytech/substrate.git'213branch = 'polkadot-v0.9.12'214215# [dependencies.pallet-vesting]216# default-features = false217# git = 'https://github.com/paritytech/substrate.git'218# branch = 'polkadot-v0.9.12'219220[dependencies.sp-arithmetic]221default-features = false222git = 'https://github.com/paritytech/substrate.git'223branch = 'polkadot-v0.9.12'224225[dependencies.sp-api]226default-features = false227git = 'https://github.com/paritytech/substrate.git'228branch = 'polkadot-v0.9.12'229230[dependencies.sp-block-builder]231default-features = false232git = 'https://github.com/paritytech/substrate.git'233branch = 'polkadot-v0.9.12'234235[dependencies.sp-core]236default-features = false237git = 'https://github.com/paritytech/substrate.git'238branch = 'polkadot-v0.9.12'239240[dependencies.sp-consensus-aura]241default-features = false242git = 'https://github.com/paritytech/substrate.git'243branch = 'polkadot-v0.9.12'244245[dependencies.sp-inherents]246default-features = false247git = 'https://github.com/paritytech/substrate.git'248branch = 'polkadot-v0.9.12'249250[dependencies.sp-io]251default-features = false252git = 'https://github.com/paritytech/substrate.git'253branch = 'polkadot-v0.9.12'254255[dependencies.sp-offchain]256default-features = false257git = 'https://github.com/paritytech/substrate.git'258branch = 'polkadot-v0.9.12'259260[dependencies.sp-runtime]261default-features = false262git = 'https://github.com/paritytech/substrate.git'263branch = 'polkadot-v0.9.12'264265[dependencies.sp-session]266default-features = false267git = 'https://github.com/paritytech/substrate.git'268branch = 'polkadot-v0.9.12'269270[dependencies.sp-std]271default-features = false272git = 'https://github.com/paritytech/substrate.git'273branch = 'polkadot-v0.9.12'274275[dependencies.sp-transaction-pool]276default-features = false277git = 'https://github.com/paritytech/substrate.git'278branch = 'polkadot-v0.9.12'279280[dependencies.sp-version]281default-features = false282git = 'https://github.com/paritytech/substrate.git'283branch = 'polkadot-v0.9.12'284285[dependencies.smallvec]286version = '1.6.1'287288################################################################################289# Cumulus dependencies290291[dependencies.parachain-info]292default-features = false293git = 'https://github.com/paritytech/cumulus.git'294branch = 'polkadot-v0.9.12'295296[dependencies.cumulus-pallet-aura-ext]297git = 'https://github.com/paritytech/cumulus.git'298branch = 'polkadot-v0.9.12'299default-features = false300301[dependencies.cumulus-pallet-parachain-system]302git = 'https://github.com/paritytech/cumulus.git'303branch = 'polkadot-v0.9.12'304default-features = false305306[dependencies.cumulus-primitives-core]307git = 'https://github.com/paritytech/cumulus.git'308branch = 'polkadot-v0.9.12'309default-features = false310311[dependencies.cumulus-pallet-xcm]312git = 'https://github.com/paritytech/cumulus.git'313branch = 'polkadot-v0.9.12'314default-features = false315316[dependencies.cumulus-pallet-dmp-queue]317git = 'https://github.com/paritytech/cumulus.git'318branch = 'polkadot-v0.9.12'319default-features = false320321[dependencies.cumulus-pallet-xcmp-queue]322git = 'https://github.com/paritytech/cumulus.git'323branch = 'polkadot-v0.9.12'324default-features = false325326[dependencies.cumulus-primitives-utility]327git = 'https://github.com/paritytech/cumulus.git'328branch = 'polkadot-v0.9.12'329default-features = false330331[dependencies.cumulus-primitives-timestamp]332git = 'https://github.com/paritytech/cumulus.git'333branch = 'polkadot-v0.9.12'334default-features = false335336################################################################################337# Polkadot dependencies338339[dependencies.polkadot-parachain]340git = 'https://github.com/paritytech/polkadot'341branch = 'release-v0.9.12'342default-features = false343344[dependencies.xcm]345git = 'https://github.com/paritytech/polkadot'346branch = 'release-v0.9.12'347default-features = false348349[dependencies.xcm-builder]350git = 'https://github.com/paritytech/polkadot'351branch = 'release-v0.9.12'352default-features = false353354[dependencies.xcm-executor]355git = 'https://github.com/paritytech/polkadot'356branch = 'release-v0.9.12'357default-features = false358359[dependencies.pallet-xcm]360git = 'https://github.com/paritytech/polkadot'361branch = 'release-v0.9.12'362default-features = false363364[dependencies.orml-vesting]365git = 'https://github.com/UniqueNetwork/open-runtime-module-library'366version = "0.4.1-dev" 367default-features = false368369################################################################################370# local dependencies371372[dependencies]373scale-info = { version = "1.0.0", default-features = false, features = [374 "derive",375] }376derivative = "2.2.0"377pallet-unique = { path = '../pallets/unique', default-features = false }378up-rpc = { path = "../primitives/rpc", default-features = false }379up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }380pallet-inflation = { path = '../pallets/inflation', default-features = false }381up-data-structs = { path = '../primitives/data-structs', default-features = false }382pallet-common = { default-features = false, path = "../pallets/common" }383pallet-fungible = { default-features = false, path = "../pallets/fungible" }384pallet-refungible = { default-features = false, path = "../pallets/refungible" }385pallet-nonfungible = { default-features = false, path = "../pallets/nonfungible" }386pallet-unq-scheduler = { path = '../pallets/scheduler', default-features = false }387# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }388pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }389pallet-evm-migration = { path = '../pallets/evm-migration', default-features = false }390pallet-evm-contract-helpers = { path = '../pallets/evm-contract-helpers', default-features = false }391pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }392pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }393394pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }395pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }396fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }397fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }398399################################################################################400# Build Dependencies401402[build-dependencies.substrate-wasm-builder]403git = 'https://github.com/paritytech/substrate.git'404branch = 'polkadot-v0.9.12'1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Unique Runtime'8edition = '2018'9homepage = 'https://unique.network'10license = 'All Rights Reserved'11name = 'unique-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version = '0.9.12'1415[package.metadata.docs.rs]16targets = ['x86_64-unknown-linux-gnu']1718[features]19default = ['std']20runtime-benchmarks = [21 'hex-literal',22 'frame-benchmarking',23 'frame-support/runtime-benchmarks',24 'frame-system-benchmarking',25 'frame-system/runtime-benchmarks',26 'pallet-evm-migration/runtime-benchmarks',27 'pallet-balances/runtime-benchmarks',28 'pallet-timestamp/runtime-benchmarks',29 'pallet-common/runtime-benchmarks',30 'pallet-fungible/runtime-benchmarks',31 'pallet-refungible/runtime-benchmarks',32 'pallet-nonfungible/runtime-benchmarks',33 'pallet-unique/runtime-benchmarks',34 'pallet-inflation/runtime-benchmarks',35 'pallet-xcm/runtime-benchmarks',36 'sp-runtime/runtime-benchmarks',37 'xcm-builder/runtime-benchmarks',38]39std = [40 'codec/std',41 'cumulus-pallet-aura-ext/std',42 'cumulus-pallet-parachain-system/std',43 'cumulus-pallet-xcm/std',44 'cumulus-pallet-xcmp-queue/std',45 'cumulus-primitives-core/std',46 'cumulus-primitives-utility/std',47 'frame-executive/std',48 'frame-support/std',49 'frame-system/std',50 'frame-system-rpc-runtime-api/std',51 'pallet-aura/std',52 'pallet-balances/std',53 # 'pallet-contracts/std',54 # 'pallet-contracts-primitives/std',55 # 'pallet-contracts-rpc-runtime-api/std',56 # 'pallet-contract-helpers/std',57 'pallet-randomness-collective-flip/std',58 'pallet-sudo/std',59 'pallet-timestamp/std',60 'pallet-transaction-payment/std',61 'pallet-transaction-payment-rpc-runtime-api/std',62 'pallet-treasury/std',63 # 'pallet-vesting/std',64 'pallet-evm/std',65 'pallet-evm-migration/std',66 'pallet-evm-contract-helpers/std',67 'pallet-evm-transaction-payment/std',68 'pallet-evm-coder-substrate/std',69 'pallet-ethereum/std',70 'fp-rpc/std',71 'up-rpc/std',72 'up-evm-mapping/std',73 'fp-self-contained/std',74 'parachain-info/std',75 'serde',76 'pallet-inflation/std',77 'pallet-common/std',78 'pallet-fungible/std',79 'pallet-refungible/std',80 'pallet-nonfungible/std',81 'pallet-unique/std',82 'pallet-unq-scheduler/std',83 'pallet-charge-transaction/std',84 'up-data-structs/std',85 'sp-api/std',86 'sp-block-builder/std',87 "sp-consensus-aura/std",88 'sp-core/std',89 'sp-inherents/std',90 'sp-io/std',91 'sp-offchain/std',92 'sp-runtime/std',93 'sp-session/std',94 'sp-std/std',95 'sp-transaction-pool/std',96 'sp-version/std',97 'xcm/std',98 'xcm-builder/std',99 'xcm-executor/std',100101 "orml-vesting/std",102]103limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']104105################################################################################106# Substrate Dependencies107108[dependencies.codec]109default-features = false110features = ['derive']111package = 'parity-scale-codec'112version = '2.3.0'113114[dependencies.frame-benchmarking]115default-features = false116git = 'https://github.com/paritytech/substrate.git'117optional = true118branch = 'polkadot-v0.9.12'119120[dependencies.frame-executive]121default-features = false122git = 'https://github.com/paritytech/substrate.git'123branch = 'polkadot-v0.9.12'124125[dependencies.frame-support]126default-features = false127git = 'https://github.com/paritytech/substrate.git'128branch = 'polkadot-v0.9.12'129130[dependencies.frame-system]131default-features = false132git = 'https://github.com/paritytech/substrate.git'133branch = 'polkadot-v0.9.12'134135[dependencies.frame-system-benchmarking]136default-features = false137git = 'https://github.com/paritytech/substrate.git'138optional = true139branch = 'polkadot-v0.9.12'140141[dependencies.frame-system-rpc-runtime-api]142default-features = false143git = 'https://github.com/paritytech/substrate.git'144branch = 'polkadot-v0.9.12'145146[dependencies.hex-literal]147optional = true148version = '0.3.3'149150[dependencies.serde]151default-features = false152features = ['derive']153optional = true154version = '1.0.130'155156[dependencies.pallet-aura]157default-features = false158git = 'https://github.com/paritytech/substrate.git'159branch = 'polkadot-v0.9.12'160161[dependencies.pallet-balances]162default-features = false163git = 'https://github.com/paritytech/substrate.git'164branch = 'polkadot-v0.9.12'165166# Contracts specific packages167# [dependencies.pallet-contracts]168# git = 'https://github.com/paritytech/substrate.git'169# default-features = false170# branch = 'polkadot-v0.9.12'171# version = '4.0.0-dev'172173# [dependencies.pallet-contracts-primitives]174# git = 'https://github.com/paritytech/substrate.git'175# default-features = false176# branch = 'polkadot-v0.9.12'177# version = '4.0.0-dev'178179# [dependencies.pallet-contracts-rpc-runtime-api]180# git = 'https://github.com/paritytech/substrate.git'181# default-features = false182# branch = 'polkadot-v0.9.12'183# version = '4.0.0-dev'184185[dependencies.pallet-randomness-collective-flip]186default-features = false187git = 'https://github.com/paritytech/substrate.git'188branch = 'polkadot-v0.9.12'189190[dependencies.pallet-sudo]191default-features = false192git = 'https://github.com/paritytech/substrate.git'193branch = 'polkadot-v0.9.12'194195[dependencies.pallet-timestamp]196default-features = false197git = 'https://github.com/paritytech/substrate.git'198branch = 'polkadot-v0.9.12'199200[dependencies.pallet-transaction-payment]201default-features = false202git = 'https://github.com/paritytech/substrate.git'203branch = 'polkadot-v0.9.12'204205[dependencies.pallet-transaction-payment-rpc-runtime-api]206default-features = false207git = 'https://github.com/paritytech/substrate.git'208branch = 'polkadot-v0.9.12'209210[dependencies.pallet-treasury]211default-features = false212git = 'https://github.com/paritytech/substrate.git'213branch = 'polkadot-v0.9.12'214215# [dependencies.pallet-vesting]216# default-features = false217# git = 'https://github.com/paritytech/substrate.git'218# branch = 'polkadot-v0.9.12'219220[dependencies.sp-arithmetic]221default-features = false222git = 'https://github.com/paritytech/substrate.git'223branch = 'polkadot-v0.9.12'224225[dependencies.sp-api]226default-features = false227git = 'https://github.com/paritytech/substrate.git'228branch = 'polkadot-v0.9.12'229230[dependencies.sp-block-builder]231default-features = false232git = 'https://github.com/paritytech/substrate.git'233branch = 'polkadot-v0.9.12'234235[dependencies.sp-core]236default-features = false237git = 'https://github.com/paritytech/substrate.git'238branch = 'polkadot-v0.9.12'239240[dependencies.sp-consensus-aura]241default-features = false242git = 'https://github.com/paritytech/substrate.git'243branch = 'polkadot-v0.9.12'244245[dependencies.sp-inherents]246default-features = false247git = 'https://github.com/paritytech/substrate.git'248branch = 'polkadot-v0.9.12'249250[dependencies.sp-io]251default-features = false252git = 'https://github.com/paritytech/substrate.git'253branch = 'polkadot-v0.9.12'254255[dependencies.sp-offchain]256default-features = false257git = 'https://github.com/paritytech/substrate.git'258branch = 'polkadot-v0.9.12'259260[dependencies.sp-runtime]261default-features = false262git = 'https://github.com/paritytech/substrate.git'263branch = 'polkadot-v0.9.12'264265[dependencies.sp-session]266default-features = false267git = 'https://github.com/paritytech/substrate.git'268branch = 'polkadot-v0.9.12'269270[dependencies.sp-std]271default-features = false272git = 'https://github.com/paritytech/substrate.git'273branch = 'polkadot-v0.9.12'274275[dependencies.sp-transaction-pool]276default-features = false277git = 'https://github.com/paritytech/substrate.git'278branch = 'polkadot-v0.9.12'279280[dependencies.sp-version]281default-features = false282git = 'https://github.com/paritytech/substrate.git'283branch = 'polkadot-v0.9.12'284285[dependencies.smallvec]286version = '1.6.1'287288################################################################################289# Cumulus dependencies290291[dependencies.parachain-info]292default-features = false293git = 'https://github.com/paritytech/cumulus.git'294branch = 'polkadot-v0.9.12'295296[dependencies.cumulus-pallet-aura-ext]297git = 'https://github.com/paritytech/cumulus.git'298branch = 'polkadot-v0.9.12'299default-features = false300301[dependencies.cumulus-pallet-parachain-system]302git = 'https://github.com/paritytech/cumulus.git'303branch = 'polkadot-v0.9.12'304default-features = false305306[dependencies.cumulus-primitives-core]307git = 'https://github.com/paritytech/cumulus.git'308branch = 'polkadot-v0.9.12'309default-features = false310311[dependencies.cumulus-pallet-xcm]312git = 'https://github.com/paritytech/cumulus.git'313branch = 'polkadot-v0.9.12'314default-features = false315316[dependencies.cumulus-pallet-dmp-queue]317git = 'https://github.com/paritytech/cumulus.git'318branch = 'polkadot-v0.9.12'319default-features = false320321[dependencies.cumulus-pallet-xcmp-queue]322git = 'https://github.com/paritytech/cumulus.git'323branch = 'polkadot-v0.9.12'324default-features = false325326[dependencies.cumulus-primitives-utility]327git = 'https://github.com/paritytech/cumulus.git'328branch = 'polkadot-v0.9.12'329default-features = false330331[dependencies.cumulus-primitives-timestamp]332git = 'https://github.com/paritytech/cumulus.git'333branch = 'polkadot-v0.9.12'334default-features = false335336################################################################################337# Polkadot dependencies338339[dependencies.polkadot-parachain]340git = 'https://github.com/paritytech/polkadot'341branch = 'release-v0.9.12'342default-features = false343344[dependencies.xcm]345git = 'https://github.com/paritytech/polkadot'346branch = 'release-v0.9.12'347default-features = false348349[dependencies.xcm-builder]350git = 'https://github.com/paritytech/polkadot'351branch = 'release-v0.9.12'352default-features = false353354[dependencies.xcm-executor]355git = 'https://github.com/paritytech/polkadot'356branch = 'release-v0.9.12'357default-features = false358359[dependencies.pallet-xcm]360git = 'https://github.com/paritytech/polkadot'361branch = 'release-v0.9.12'362default-features = false363364[dependencies.orml-vesting]365git = 'https://github.com/UniqueNetwork/open-runtime-module-library'366version = "0.4.1-dev" 367default-features = false368369################################################################################370# local dependencies371372[dependencies]373scale-info = { version = "1.0.0", default-features = false, features = [374 "derive",375] }376derivative = "2.2.0"377pallet-unique = { path = '../pallets/unique', default-features = false }378up-rpc = { path = "../primitives/rpc", default-features = false }379up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }380pallet-inflation = { path = '../pallets/inflation' }381up-data-structs = { path = '../primitives/data-structs', default-features = false }382pallet-common = { default-features = false, path = "../pallets/common" }383pallet-fungible = { default-features = false, path = "../pallets/fungible" }384pallet-refungible = { default-features = false, path = "../pallets/refungible" }385pallet-nonfungible = { default-features = false, path = "../pallets/nonfungible" }386pallet-unq-scheduler = { path = '../pallets/scheduler', default-features = false }387# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }388pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }389pallet-evm-migration = { path = '../pallets/evm-migration', default-features = false }390pallet-evm-contract-helpers = { path = '../pallets/evm-contract-helpers', default-features = false }391pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }392pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }393394pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }395pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }396fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }397fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12" }398399################################################################################400# Build Dependencies401402[build-dependencies.substrate-wasm-builder]403git = 'https://github.com/paritytech/substrate.git'404branch = 'polkadot-v0.9.12'tests/src/inflation.test.tsdiffbeforeafterboth--- a/tests/src/inflation.test.ts
+++ b/tests/src/inflation.test.ts
@@ -14,6 +14,9 @@
it('First year inflation is 10%', async () => {
await usingApi(async (api) => {
+ // Start inflation on relay block 1
+ await api.tx.inflation.start_inflation(1);
+
const blockInterval = (api.consts.inflation.inflationBlockInterval).toBigInt();
const totalIssuanceStart = (await api.query.inflation.startingYearTotalIssuance()).toBigInt();
const blockInflation = (await api.query.inflation.blockInflation()).toBigInt();