difftreelog
Merge pull request #255 from UniqueNetwork/feature/CORE-247
in: master
Inflation pallet block provider added. Setted up to relay chain.
8 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -11679,6 +11679,7 @@
"pallet-evm-migration",
"pallet-evm-transaction-payment",
"pallet-fungible",
+ "pallet-inflation",
"pallet-nonfungible",
"pallet-randomness-collective-flip",
"pallet-refungible",
pallets/inflation/src/lib.rsdiffbeforeafterboth--- a/pallets/inflation/src/lib.rs
+++ b/pallets/inflation/src/lib.rs
@@ -3,13 +3,8 @@
// file 'LICENSE', which is part of this source code package.
//
-#![recursion_limit = "1024"]
+// #![recursion_limit = "1024"]
#![cfg_attr(not(feature = "std"), no_std)]
-
-#[cfg(feature = "std")]
-pub use std::*;
-
-pub use serde::{Serialize, Deserialize};
#[cfg(feature = "runtime-benchmarks")]
mod benchmarking;
@@ -17,65 +12,74 @@
#[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},
+ traits::{Currency, Get},
};
-
-// #[cfg(feature = "runtime-benchmarks")]
-pub use frame_support::dispatch::DispatchResult;
-
+pub use pallet::*;
use sp_runtime::{
Perbill,
- traits::{Zero},
+ traits::{BlockNumberProvider},
};
+
use sp_std::convert::TryInto;
-
-use frame_system::{self as system};
-/// 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
-pub const YEAR: u32 = 2_629_800; // 12-second block
+pub const YEAR: u32 = 5_259_600; // 6-second block
+ // pub const YEAR: u32 = 2_629_800; // 12-second block
pub const TOTAL_YEARS_UNTIL_FLAT: u32 = 9;
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::*;
-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>;
}
-}
-decl_module! {
- pub struct Module<T: Config> for enum Call
- where
- origin: T::Origin,
- {
- const InflationBlockInterval: T::BlockNumber = T::InflationBlockInterval::get();
+ #[pallet::pallet]
+ #[pallet::generate_store(pub(super) trait Store)]
+ pub struct Pallet<T>(_);
+
+ /// starting year total issuance
+ #[pallet::storage]
+ pub type StartingYearTotalIssuance<T: Config> =
+ StorageValue<Value = BalanceOf<T>, QueryKind = ValueQuery>;
- fn on_initialize(now: T::BlockNumber) -> Weight
+ /// Current inflation for `InflationBlockInterval` number of blocks
+ #[pallet::storage]
+ pub type BlockInflation<T: Config> = StorageValue<Value = BalanceOf<T>, QueryKind = ValueQuery>;
+
+ /// 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| {
@@ -84,47 +88,108 @@
};
let block_interval: u32 = T::InflationBlockInterval::get().try_into().unwrap_or(0);
+ let current_relay_block = T::BlockNumberProvider::current_block_number();
+ let next_inflation: T::BlockNumber = <NextInflationBlock<T>>::get();
+ add_weight(1, 0, 5_000_000);
- // TODO: Rewrite inflation to use block timestamp instead of block number
- // let _now = <timestamp::Module<T>>::get();
+ // 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) {
+ // 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);
+ }
- // Recalculate inflation on the first block of the year (or if it is not initialized yet)
- if (now % T::BlockNumber::from(YEAR)).is_zero() || <BlockInflation<T>>::get().is_zero() {
- let current_year: u32 = (now / T::BlockNumber::from(YEAR)).try_into().unwrap_or(0);
+ T::Currency::deposit_into_existing(
+ &T::TreasuryAccountId::get(),
+ <BlockInflation<T>>::get(),
+ )
+ .ok();
- let one_percent = Perbill::from_percent(1);
+ // Update inflation block
+ <NextInflationBlock<T>>::set(next_inflation + block_interval.into());
- 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());
+ 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)?;
- // First time deposit
- T::Currency::deposit_creating(&T::TreasuryAccountId::get(), <BlockInflation<T>>::get());
+ // Start inflation if it has not been yet initialized
+ let next_inflation: T::BlockNumber = <NextInflationBlock<T>>::get();
+ if next_inflation == 0u32.into() {
+ // 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());
- add_weight(7, 6, 28_300_000);
+ // 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(),
+ );
}
- // Apply inflation every InflationBlockInterval blocks and in the 1st block to initialize Treasury account
- else if (now % T::BlockNumber::from(block_interval)).is_zero() {
- T::Currency::deposit_into_existing(&T::TreasuryAccountId::get(), <BlockInflation<T>>::get()).ok();
+ 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);
- add_weight(3, 2, 12_900_000);
- }
+ let one_percent = Perbill::from_percent(1);
- consumed_weight
+ 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());
}
}
pallets/inflation/src/tests.rsdiffbeforeafterboth--- a/pallets/inflation/src/tests.rs
+++ b/pallets/inflation/src/tests.rs
@@ -3,22 +3,23 @@
use crate as pallet_inflation;
use frame_support::{
- traits::{Currency},
- parameter_types,
-};
-use frame_support::{
- traits::{OnInitialize, Everything},
+ assert_ok, parameter_types,
+ traits::{Currency, OnInitialize, Everything},
};
+use frame_system::RawOrigin;
use sp_core::H256;
use sp_runtime::{
- traits::{BlakeTwo256, IdentityLookup},
+ traits::{BlakeTwo256, BlockNumberProvider, IdentityLookup},
testing::Header,
};
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
-const YEAR: u64 = 2_629_800;
+const YEAR: u64 = 5_259_600; // 6-second blocks
+ // const YEAR: u64 = 2_629_800; // 12-second blocks
+ // Expected 100-block inflation for year 1 is 100 * 100_000_000 / YEAR = FIRST_YEAR_BLOCK_INFLATION
+const FIRST_YEAR_BLOCK_INFLATION: u64 = 1901;
parameter_types! {
pub const ExistentialDeposit: u64 = 1;
@@ -85,12 +86,22 @@
parameter_types! {
pub TreasuryAccountId: u64 = 1234;
pub const InflationBlockInterval: u32 = 100; // every time per how many blocks inflation is applied
+ pub static MockBlockNumberProvider: u64 = 0;
}
+impl BlockNumberProvider for MockBlockNumberProvider {
+ type BlockNumber = u64;
+
+ fn current_block_number() -> Self::BlockNumber {
+ Self::get()
+ }
+}
+
impl pallet_inflation::Config for Test {
type Currency = Balances;
type TreasuryAccountId = TreasuryAccountId;
type InflationBlockInterval = InflationBlockInterval;
+ type BlockNumberProvider = MockBlockNumberProvider;
}
pub fn new_test_ext() -> sp_io::TestExternalities {
@@ -100,6 +111,29 @@
.into()
}
+macro_rules! block_inflation {
+ // Block inflation doesn't have any argumets
+ () => {
+ // Return BlockInflation state variable current value
+ <pallet_inflation::BlockInflation<Test>>::get()
+ };
+}
+
+#[test]
+fn uninitialized_inflation() {
+ new_test_ext().execute_with(|| {
+ let initial_issuance: u64 = 1_000_000_000;
+ let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
+ assert_eq!(Balances::free_balance(1234), initial_issuance);
+
+ // BlockInflation should be set after inflation is started
+ // first inflation deposit should be equal to BlockInflation
+ MockBlockNumberProvider::set(1);
+
+ assert_eq!(block_inflation!(), 0);
+ });
+}
+
#[test]
fn inflation_works() {
new_test_ext().execute_with(|| {
@@ -108,16 +142,25 @@
let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
assert_eq!(Balances::free_balance(1234), initial_issuance);
- // BlockInflation should be set after 1st block and
+ // BlockInflation should be set after inflation is started
// first inflation deposit should be equal to BlockInflation
- Inflation::on_initialize(1);
+ MockBlockNumberProvider::set(1);
- // Expected 100-block inflation for year 1 is 100 * 100_000_000 / YEAR = 3803
- assert_eq!(Inflation::block_inflation(), 3803);
+ // Start inflation as sudo
+ assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));
+ assert_eq!(block_inflation!(), FIRST_YEAR_BLOCK_INFLATION);
assert_eq!(
Balances::free_balance(1234) - initial_issuance,
- Inflation::block_inflation()
+ block_inflation!()
);
+
+ // Trigger inflation
+ MockBlockNumberProvider::set(102);
+ Inflation::on_initialize(0);
+ assert_eq!(
+ Balances::free_balance(1234) - initial_issuance,
+ 2 * block_inflation!()
+ );
});
}
@@ -128,25 +171,27 @@
let initial_issuance: u64 = 1_000_000_000;
let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
assert_eq!(Balances::free_balance(1234), initial_issuance);
- Inflation::on_initialize(1);
+ MockBlockNumberProvider::set(1);
- // Next inflation deposit happens when block is multiple of InflationBlockInterval
- let mut block: u32 = 2;
+ // Start inflation as sudo
+ assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));
+
+ // Next inflation deposit happens when block is greater then or equal to NextInflationBlock
+ let mut block: u64 = 2;
let balance_before: u64 = Balances::free_balance(1234);
- while block % InflationBlockInterval::get() != 0 {
- Inflation::on_initialize(block as u64);
+ while block < <pallet_inflation::NextInflationBlock<Test>>::get() {
+ MockBlockNumberProvider::set(block as u64);
+ Inflation::on_initialize(0);
block += 1;
}
let balance_just_before: u64 = Balances::free_balance(1234);
assert_eq!(balance_before, balance_just_before);
// The block with inflation
- Inflation::on_initialize(block as u64);
+ MockBlockNumberProvider::set(block as u64);
+ Inflation::on_initialize(0);
let balance_after: u64 = Balances::free_balance(1234);
- assert_eq!(
- balance_after - balance_just_before,
- Inflation::block_inflation()
- );
+ assert_eq!(balance_after - balance_just_before, block_inflation!());
});
}
@@ -157,59 +202,56 @@
let initial_issuance: u64 = 1_000_000_000;
let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
assert_eq!(Balances::free_balance(1234), initial_issuance);
- Inflation::on_initialize(1);
+ MockBlockNumberProvider::set(1);
+ // Start inflation as sudo
+ assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));
+
// Go through all the block inflations for year 1,
// total issuance will be updated accordingly
- for block in (100..YEAR).step_by(100) {
- Inflation::on_initialize(block);
+ // Inflation is set to start in block 1, so first iteration is block 101
+ for block in (101..YEAR).step_by(100) {
+ MockBlockNumberProvider::set(block);
+ Inflation::on_initialize(0);
}
assert_eq!(
- initial_issuance + (3803 * (YEAR / 100)),
+ initial_issuance + (FIRST_YEAR_BLOCK_INFLATION * (YEAR / 100)),
<Balances as Currency<_>>::total_issuance()
);
- Inflation::on_initialize(YEAR);
- let block_inflation_year_1 = Inflation::block_inflation();
- // Expected 100-block inflation for year 2: 100 * 9.33% * initial issuance * 110% / YEAR = 3904
- assert_eq!(block_inflation_year_1, 3904);
+ MockBlockNumberProvider::set(YEAR + 1);
+ Inflation::on_initialize(0);
+ let block_inflation_year_2 = block_inflation!();
+ // Expected 100-block inflation for year 2: 100 * 9.33% * initial issuance * 110% / YEAR == 1951
+ let expecter_year_2_inflation: u64 = (initial_issuance
+ + FIRST_YEAR_BLOCK_INFLATION * YEAR / 100)
+ * 933 * 100 / (10000 * YEAR);
+ assert_eq!(block_inflation_year_2 / 10, expecter_year_2_inflation / 10); // divide by 10 for approx. equality
});
}
#[test]
-fn inflation_in_1_to_9_years() {
+fn inflation_after_year_10_is_flat() {
new_test_ext().execute_with(|| {
// Total issuance = 1_000_000_000
let initial_issuance: u64 = 1_000_000_000;
let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
assert_eq!(Balances::free_balance(1234), initial_issuance);
- Inflation::on_initialize(1);
+ MockBlockNumberProvider::set(YEAR * 9 + 1);
- for year in 1..=9 {
- let block_inflation_year_before = Inflation::block_inflation();
- Inflation::on_initialize(YEAR * year);
- let block_inflation_year_after = Inflation::block_inflation();
+ // Start inflation as sudo
+ assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));
- // SBP M2 review: this is actually not true (not for the first few years)
- // Assert that next year inflation is less than previous year inflation
- assert!(block_inflation_year_before > block_inflation_year_after);
+ // Let inflation catch up
+ for _year in 1..=9 {
+ Inflation::on_initialize(0);
}
- });
-}
-#[test]
-fn inflation_after_year_10_is_flat() {
- new_test_ext().execute_with(|| {
- // Total issuance = 1_000_000_000
- let initial_issuance: u64 = 1_000_000_000;
- let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
- assert_eq!(Balances::free_balance(1234), initial_issuance);
- Inflation::on_initialize(YEAR * 9);
-
for year in 10..=20 {
- let block_inflation_year_before = Inflation::block_inflation();
- Inflation::on_initialize(YEAR * year);
- let block_inflation_year_after = Inflation::block_inflation();
+ let block_inflation_year_before = block_inflation!();
+ MockBlockNumberProvider::set(YEAR * year + 1);
+ Inflation::on_initialize(0);
+ let block_inflation_year_after = block_inflation!();
// Assert that next year inflation is equal to previous year inflation
assert_eq!(block_inflation_year_before, block_inflation_year_after);
@@ -231,25 +273,32 @@
let _ = <Balances as Currency<_>>::deposit_creating(&1234, initial_issuance);
assert_eq!(Balances::free_balance(1234), initial_issuance);
+ // Start inflation as sudo
+ assert_ok!(Inflation::start_inflation(RawOrigin::Root.into(), 1));
+
for year in 0..=10 {
// Year first block
- Inflation::on_initialize(year * YEAR);
- let mut actual_payout = Inflation::block_inflation();
+ MockBlockNumberProvider::set(YEAR * year + 1);
+ Inflation::on_initialize(0);
+ let mut actual_payout = block_inflation!();
assert_eq!(actual_payout, payout_by_year[year as usize]);
// Year second block
- Inflation::on_initialize(year * YEAR + 1);
- actual_payout = Inflation::block_inflation();
+ MockBlockNumberProvider::set(YEAR * year + 2);
+ Inflation::on_initialize(0);
+ actual_payout = block_inflation!();
assert_eq!(actual_payout, payout_by_year[year as usize]);
// Year middle block
- Inflation::on_initialize(year * YEAR + YEAR / 2);
- actual_payout = Inflation::block_inflation();
+ MockBlockNumberProvider::set(year * YEAR + YEAR / 2);
+ Inflation::on_initialize(0);
+ actual_payout = block_inflation!();
assert_eq!(actual_payout, payout_by_year[year as usize]);
// Year last block
- Inflation::on_initialize((year + 1) * YEAR - 1);
- actual_payout = Inflation::block_inflation();
+ MockBlockNumberProvider::set((year + 1) * YEAR);
+ Inflation::on_initialize(0);
+ actual_payout = block_inflation!();
assert_eq!(actual_payout, payout_by_year[year as usize]);
}
});
runtime/Cargo.tomldiffbeforeafterboth1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Unique Runtime'8edition = '2021'9homepage = 'https://unique.network'10license = 'All Rights Reserved'11name = 'unique-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version = '0.9.13'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-ethereum/runtime-benchmarks',27 'pallet-evm-migration/runtime-benchmarks',28 'pallet-evm-coder-substrate/runtime-benchmarks',29 'pallet-balances/runtime-benchmarks',30 'pallet-timestamp/runtime-benchmarks',31 'pallet-common/runtime-benchmarks',32 'pallet-fungible/runtime-benchmarks',33 'pallet-refungible/runtime-benchmarks',34 'pallet-nonfungible/runtime-benchmarks',35 'pallet-unique/runtime-benchmarks',36# 'pallet-inflation/runtime-benchmarks',37 'pallet-xcm/runtime-benchmarks',38 'sp-runtime/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',40]41std = [42 'codec/std',43 'cumulus-pallet-aura-ext/std',44 'cumulus-pallet-parachain-system/std',45 'cumulus-pallet-xcm/std',46 'cumulus-pallet-xcmp-queue/std',47 'cumulus-primitives-core/std',48 'cumulus-primitives-utility/std',49 'frame-executive/std',50 'frame-support/std',51 'frame-system/std',52 'frame-system-rpc-runtime-api/std',53 'pallet-aura/std',54 'pallet-balances/std',55 # 'pallet-contracts/std',56 # 'pallet-contracts-primitives/std',57 # 'pallet-contracts-rpc-runtime-api/std',58 # 'pallet-contract-helpers/std',59 'pallet-randomness-collective-flip/std',60 'pallet-sudo/std',61 'pallet-timestamp/std',62 'pallet-transaction-payment/std',63 'pallet-transaction-payment-rpc-runtime-api/std',64 'pallet-treasury/std',65 # 'pallet-vesting/std',66 'pallet-evm/std',67 'pallet-evm-migration/std',68 'pallet-evm-contract-helpers/std',69 'pallet-evm-transaction-payment/std',70 'pallet-evm-coder-substrate/std',71 'pallet-ethereum/std',72 'fp-rpc/std',73 'up-rpc/std',74 'up-evm-mapping/std',75 'fp-self-contained/std',76 'parachain-info/std',77 'serde',78# 'pallet-inflation/std',79 'pallet-common/std',80 'pallet-fungible/std',81 'pallet-refungible/std',82 'pallet-nonfungible/std',83 'pallet-unique/std',84 'pallet-unq-scheduler/std',85 'pallet-charge-transaction/std',86 'up-data-structs/std',87 'sp-api/std',88 'sp-block-builder/std',89 "sp-consensus-aura/std",90 'sp-core/std',91 'sp-inherents/std',92 'sp-io/std',93 'sp-offchain/std',94 'sp-runtime/std',95 'sp-session/std',96 'sp-std/std',97 'sp-transaction-pool/std',98 'sp-version/std',99 'xcm/std',100 'xcm-builder/std',101 'xcm-executor/std',102103 "orml-vesting/std",104]105limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']106107################################################################################108# Substrate Dependencies109110[dependencies.codec]111default-features = false112features = ['derive']113package = 'parity-scale-codec'114version = '2.3.0'115116[dependencies.frame-benchmarking]117default-features = false118git = 'https://github.com/paritytech/substrate.git'119optional = true120branch = 'polkadot-v0.9.13'121122[dependencies.frame-executive]123default-features = false124git = 'https://github.com/paritytech/substrate.git'125branch = 'polkadot-v0.9.13'126127[dependencies.frame-support]128default-features = false129git = 'https://github.com/paritytech/substrate.git'130branch = 'polkadot-v0.9.13'131132[dependencies.frame-system]133default-features = false134git = 'https://github.com/paritytech/substrate.git'135branch = 'polkadot-v0.9.13'136137[dependencies.frame-system-benchmarking]138default-features = false139git = 'https://github.com/paritytech/substrate.git'140optional = true141branch = 'polkadot-v0.9.13'142143[dependencies.frame-system-rpc-runtime-api]144default-features = false145git = 'https://github.com/paritytech/substrate.git'146branch = 'polkadot-v0.9.13'147148[dependencies.hex-literal]149optional = true150version = '0.3.3'151152[dependencies.serde]153default-features = false154features = ['derive']155optional = true156version = '1.0.130'157158[dependencies.pallet-aura]159default-features = false160git = 'https://github.com/paritytech/substrate.git'161branch = 'polkadot-v0.9.13'162163[dependencies.pallet-balances]164default-features = false165git = 'https://github.com/paritytech/substrate.git'166branch = 'polkadot-v0.9.13'167168# Contracts specific packages169# [dependencies.pallet-contracts]170# git = 'https://github.com/paritytech/substrate.git'171# default-features = false172# branch = 'polkadot-v0.9.13'173# version = '4.0.0-dev'174175# [dependencies.pallet-contracts-primitives]176# git = 'https://github.com/paritytech/substrate.git'177# default-features = false178# branch = 'polkadot-v0.9.13'179# version = '4.0.0-dev'180181# [dependencies.pallet-contracts-rpc-runtime-api]182# git = 'https://github.com/paritytech/substrate.git'183# default-features = false184# branch = 'polkadot-v0.9.13'185# version = '4.0.0-dev'186187[dependencies.pallet-randomness-collective-flip]188default-features = false189git = 'https://github.com/paritytech/substrate.git'190branch = 'polkadot-v0.9.13'191192[dependencies.pallet-sudo]193default-features = false194git = 'https://github.com/paritytech/substrate.git'195branch = 'polkadot-v0.9.13'196197[dependencies.pallet-timestamp]198default-features = false199git = 'https://github.com/paritytech/substrate.git'200branch = 'polkadot-v0.9.13'201202[dependencies.pallet-transaction-payment]203default-features = false204git = 'https://github.com/paritytech/substrate.git'205branch = 'polkadot-v0.9.13'206207[dependencies.pallet-transaction-payment-rpc-runtime-api]208default-features = false209git = 'https://github.com/paritytech/substrate.git'210branch = 'polkadot-v0.9.13'211212[dependencies.pallet-treasury]213default-features = false214git = 'https://github.com/paritytech/substrate.git'215branch = 'polkadot-v0.9.13'216217# [dependencies.pallet-vesting]218# default-features = false219# git = 'https://github.com/paritytech/substrate.git'220# branch = 'polkadot-v0.9.13'221222[dependencies.sp-arithmetic]223default-features = false224git = 'https://github.com/paritytech/substrate.git'225branch = 'polkadot-v0.9.13'226227[dependencies.sp-api]228default-features = false229git = 'https://github.com/paritytech/substrate.git'230branch = 'polkadot-v0.9.13'231232[dependencies.sp-block-builder]233default-features = false234git = 'https://github.com/paritytech/substrate.git'235branch = 'polkadot-v0.9.13'236237[dependencies.sp-core]238default-features = false239git = 'https://github.com/paritytech/substrate.git'240branch = 'polkadot-v0.9.13'241242[dependencies.sp-consensus-aura]243default-features = false244git = 'https://github.com/paritytech/substrate.git'245branch = 'polkadot-v0.9.13'246247[dependencies.sp-inherents]248default-features = false249git = 'https://github.com/paritytech/substrate.git'250branch = 'polkadot-v0.9.13'251252[dependencies.sp-io]253default-features = false254git = 'https://github.com/paritytech/substrate.git'255branch = 'polkadot-v0.9.13'256257[dependencies.sp-offchain]258default-features = false259git = 'https://github.com/paritytech/substrate.git'260branch = 'polkadot-v0.9.13'261262[dependencies.sp-runtime]263default-features = false264git = 'https://github.com/paritytech/substrate.git'265branch = 'polkadot-v0.9.13'266267[dependencies.sp-session]268default-features = false269git = 'https://github.com/paritytech/substrate.git'270branch = 'polkadot-v0.9.13'271272[dependencies.sp-std]273default-features = false274git = 'https://github.com/paritytech/substrate.git'275branch = 'polkadot-v0.9.13'276277[dependencies.sp-transaction-pool]278default-features = false279git = 'https://github.com/paritytech/substrate.git'280branch = 'polkadot-v0.9.13'281282[dependencies.sp-version]283default-features = false284git = 'https://github.com/paritytech/substrate.git'285branch = 'polkadot-v0.9.13'286287[dependencies.smallvec]288version = '1.6.1'289290################################################################################291# Cumulus dependencies292293[dependencies.parachain-info]294default-features = false295git = 'https://github.com/paritytech/cumulus.git'296branch = 'polkadot-v0.9.13'297298[dependencies.cumulus-pallet-aura-ext]299git = 'https://github.com/paritytech/cumulus.git'300branch = 'polkadot-v0.9.13'301default-features = false302303[dependencies.cumulus-pallet-parachain-system]304git = 'https://github.com/paritytech/cumulus.git'305branch = 'polkadot-v0.9.13'306default-features = false307308[dependencies.cumulus-primitives-core]309git = 'https://github.com/paritytech/cumulus.git'310branch = 'polkadot-v0.9.13'311default-features = false312313[dependencies.cumulus-pallet-xcm]314git = 'https://github.com/paritytech/cumulus.git'315branch = 'polkadot-v0.9.13'316default-features = false317318[dependencies.cumulus-pallet-dmp-queue]319git = 'https://github.com/paritytech/cumulus.git'320branch = 'polkadot-v0.9.13'321default-features = false322323[dependencies.cumulus-pallet-xcmp-queue]324git = 'https://github.com/paritytech/cumulus.git'325branch = 'polkadot-v0.9.13'326default-features = false327328[dependencies.cumulus-primitives-utility]329git = 'https://github.com/paritytech/cumulus.git'330branch = 'polkadot-v0.9.13'331default-features = false332333[dependencies.cumulus-primitives-timestamp]334git = 'https://github.com/paritytech/cumulus.git'335branch = 'polkadot-v0.9.13'336default-features = false337338################################################################################339# Polkadot dependencies340341[dependencies.polkadot-parachain]342git = 'https://github.com/paritytech/polkadot'343branch = 'release-v0.9.13'344default-features = false345346[dependencies.xcm]347git = 'https://github.com/paritytech/polkadot'348branch = 'release-v0.9.13'349default-features = false350351[dependencies.xcm-builder]352git = 'https://github.com/paritytech/polkadot'353branch = 'release-v0.9.13'354default-features = false355356[dependencies.xcm-executor]357git = 'https://github.com/paritytech/polkadot'358branch = 'release-v0.9.13'359default-features = false360361[dependencies.pallet-xcm]362git = 'https://github.com/paritytech/polkadot'363branch = 'release-v0.9.13'364default-features = false365366[dependencies.orml-vesting]367git = 'https://github.com/UniqueNetwork/open-runtime-module-library'368branch = 'polkadot-v0.9.13'369version = "0.4.1-dev" 370default-features = false371372################################################################################373# local dependencies374375[dependencies]376scale-info = { version = "1.0.0", default-features = false, features = [377 "derive",378] }379derivative = "2.2.0"380pallet-unique = { path = '../pallets/unique', default-features = false }381up-rpc = { path = "../primitives/rpc", default-features = false }382up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }383# pallet-inflation = { path = '../pallets/inflation', default-features = false }384up-data-structs = { path = '../primitives/data-structs', default-features = false }385pallet-common = { default-features = false, path = "../pallets/common" }386pallet-fungible = { default-features = false, path = "../pallets/fungible" }387pallet-refungible = { default-features = false, path = "../pallets/refungible" }388pallet-nonfungible = { default-features = false, path = "../pallets/nonfungible" }389pallet-unq-scheduler = { path = '../pallets/scheduler', default-features = false }390# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }391pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.13', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }392pallet-evm-migration = { path = '../pallets/evm-migration', default-features = false }393pallet-evm-contract-helpers = { path = '../pallets/evm-contract-helpers', default-features = false }394pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }395pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }396397pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.13" }398pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.13" }399fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.13" }400fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.13" }401402################################################################################403# Build Dependencies404405[build-dependencies.substrate-wasm-builder]406git = 'https://github.com/paritytech/substrate.git'407branch = 'polkadot-v0.9.13'1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6build = 'build.rs'7description = 'Unique Runtime'8edition = '2021'9homepage = 'https://unique.network'10license = 'All Rights Reserved'11name = 'unique-runtime'12repository = 'https://github.com/UniqueNetwork/unique-chain'13version = '0.9.13'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-ethereum/runtime-benchmarks',27 'pallet-evm-migration/runtime-benchmarks',28 'pallet-evm-coder-substrate/runtime-benchmarks',29 'pallet-balances/runtime-benchmarks',30 'pallet-timestamp/runtime-benchmarks',31 'pallet-common/runtime-benchmarks',32 'pallet-fungible/runtime-benchmarks',33 'pallet-refungible/runtime-benchmarks',34 'pallet-nonfungible/runtime-benchmarks',35 'pallet-unique/runtime-benchmarks',36 'pallet-inflation/runtime-benchmarks',37 'pallet-xcm/runtime-benchmarks',38 'sp-runtime/runtime-benchmarks',39 'xcm-builder/runtime-benchmarks',40]41std = [42 'codec/std',43 'cumulus-pallet-aura-ext/std',44 'cumulus-pallet-parachain-system/std',45 'cumulus-pallet-xcm/std',46 'cumulus-pallet-xcmp-queue/std',47 'cumulus-primitives-core/std',48 'cumulus-primitives-utility/std',49 'frame-executive/std',50 'frame-support/std',51 'frame-system/std',52 'frame-system-rpc-runtime-api/std',53 'pallet-aura/std',54 'pallet-balances/std',55 # 'pallet-contracts/std',56 # 'pallet-contracts-primitives/std',57 # 'pallet-contracts-rpc-runtime-api/std',58 # 'pallet-contract-helpers/std',59 'pallet-randomness-collective-flip/std',60 'pallet-sudo/std',61 'pallet-timestamp/std',62 'pallet-transaction-payment/std',63 'pallet-transaction-payment-rpc-runtime-api/std',64 'pallet-treasury/std',65 # 'pallet-vesting/std',66 'pallet-evm/std',67 'pallet-evm-migration/std',68 'pallet-evm-contract-helpers/std',69 'pallet-evm-transaction-payment/std',70 'pallet-evm-coder-substrate/std',71 'pallet-ethereum/std',72 'fp-rpc/std',73 'up-rpc/std',74 'up-evm-mapping/std',75 'fp-self-contained/std',76 'parachain-info/std',77 'serde',78 'pallet-inflation/std',79 'pallet-common/std',80 'pallet-fungible/std',81 'pallet-refungible/std',82 'pallet-nonfungible/std',83 'pallet-unique/std',84 'pallet-unq-scheduler/std',85 'pallet-charge-transaction/std',86 'up-data-structs/std',87 'sp-api/std',88 'sp-block-builder/std',89 "sp-consensus-aura/std",90 'sp-core/std',91 'sp-inherents/std',92 'sp-io/std',93 'sp-offchain/std',94 'sp-runtime/std',95 'sp-session/std',96 'sp-std/std',97 'sp-transaction-pool/std',98 'sp-version/std',99 'xcm/std',100 'xcm-builder/std',101 'xcm-executor/std',102103 "orml-vesting/std",104]105limit-testing = ['pallet-unique/limit-testing', 'up-data-structs/limit-testing']106107################################################################################108# Substrate Dependencies109110[dependencies.codec]111default-features = false112features = ['derive']113package = 'parity-scale-codec'114version = '2.3.0'115116[dependencies.frame-benchmarking]117default-features = false118git = 'https://github.com/paritytech/substrate.git'119optional = true120branch = 'polkadot-v0.9.13'121122[dependencies.frame-executive]123default-features = false124git = 'https://github.com/paritytech/substrate.git'125branch = 'polkadot-v0.9.13'126127[dependencies.frame-support]128default-features = false129git = 'https://github.com/paritytech/substrate.git'130branch = 'polkadot-v0.9.13'131132[dependencies.frame-system]133default-features = false134git = 'https://github.com/paritytech/substrate.git'135branch = 'polkadot-v0.9.13'136137[dependencies.frame-system-benchmarking]138default-features = false139git = 'https://github.com/paritytech/substrate.git'140optional = true141branch = 'polkadot-v0.9.13'142143[dependencies.frame-system-rpc-runtime-api]144default-features = false145git = 'https://github.com/paritytech/substrate.git'146branch = 'polkadot-v0.9.13'147148[dependencies.hex-literal]149optional = true150version = '0.3.3'151152[dependencies.serde]153default-features = false154features = ['derive']155optional = true156version = '1.0.130'157158[dependencies.pallet-aura]159default-features = false160git = 'https://github.com/paritytech/substrate.git'161branch = 'polkadot-v0.9.13'162163[dependencies.pallet-balances]164default-features = false165git = 'https://github.com/paritytech/substrate.git'166branch = 'polkadot-v0.9.13'167168# Contracts specific packages169# [dependencies.pallet-contracts]170# git = 'https://github.com/paritytech/substrate.git'171# default-features = false172# branch = 'polkadot-v0.9.13'173# version = '4.0.0-dev'174175# [dependencies.pallet-contracts-primitives]176# git = 'https://github.com/paritytech/substrate.git'177# default-features = false178# branch = 'polkadot-v0.9.13'179# version = '4.0.0-dev'180181# [dependencies.pallet-contracts-rpc-runtime-api]182# git = 'https://github.com/paritytech/substrate.git'183# default-features = false184# branch = 'polkadot-v0.9.13'185# version = '4.0.0-dev'186187[dependencies.pallet-randomness-collective-flip]188default-features = false189git = 'https://github.com/paritytech/substrate.git'190branch = 'polkadot-v0.9.13'191192[dependencies.pallet-sudo]193default-features = false194git = 'https://github.com/paritytech/substrate.git'195branch = 'polkadot-v0.9.13'196197[dependencies.pallet-timestamp]198default-features = false199git = 'https://github.com/paritytech/substrate.git'200branch = 'polkadot-v0.9.13'201202[dependencies.pallet-transaction-payment]203default-features = false204git = 'https://github.com/paritytech/substrate.git'205branch = 'polkadot-v0.9.13'206207[dependencies.pallet-transaction-payment-rpc-runtime-api]208default-features = false209git = 'https://github.com/paritytech/substrate.git'210branch = 'polkadot-v0.9.13'211212[dependencies.pallet-treasury]213default-features = false214git = 'https://github.com/paritytech/substrate.git'215branch = 'polkadot-v0.9.13'216217# [dependencies.pallet-vesting]218# default-features = false219# git = 'https://github.com/paritytech/substrate.git'220# branch = 'polkadot-v0.9.13'221222[dependencies.sp-arithmetic]223default-features = false224git = 'https://github.com/paritytech/substrate.git'225branch = 'polkadot-v0.9.13'226227[dependencies.sp-api]228default-features = false229git = 'https://github.com/paritytech/substrate.git'230branch = 'polkadot-v0.9.13'231232[dependencies.sp-block-builder]233default-features = false234git = 'https://github.com/paritytech/substrate.git'235branch = 'polkadot-v0.9.13'236237[dependencies.sp-core]238default-features = false239git = 'https://github.com/paritytech/substrate.git'240branch = 'polkadot-v0.9.13'241242[dependencies.sp-consensus-aura]243default-features = false244git = 'https://github.com/paritytech/substrate.git'245branch = 'polkadot-v0.9.13'246247[dependencies.sp-inherents]248default-features = false249git = 'https://github.com/paritytech/substrate.git'250branch = 'polkadot-v0.9.13'251252[dependencies.sp-io]253default-features = false254git = 'https://github.com/paritytech/substrate.git'255branch = 'polkadot-v0.9.13'256257[dependencies.sp-offchain]258default-features = false259git = 'https://github.com/paritytech/substrate.git'260branch = 'polkadot-v0.9.13'261262[dependencies.sp-runtime]263default-features = false264git = 'https://github.com/paritytech/substrate.git'265branch = 'polkadot-v0.9.13'266267[dependencies.sp-session]268default-features = false269git = 'https://github.com/paritytech/substrate.git'270branch = 'polkadot-v0.9.13'271272[dependencies.sp-std]273default-features = false274git = 'https://github.com/paritytech/substrate.git'275branch = 'polkadot-v0.9.13'276277[dependencies.sp-transaction-pool]278default-features = false279git = 'https://github.com/paritytech/substrate.git'280branch = 'polkadot-v0.9.13'281282[dependencies.sp-version]283default-features = false284git = 'https://github.com/paritytech/substrate.git'285branch = 'polkadot-v0.9.13'286287[dependencies.smallvec]288version = '1.6.1'289290################################################################################291# Cumulus dependencies292293[dependencies.parachain-info]294default-features = false295git = 'https://github.com/paritytech/cumulus.git'296branch = 'polkadot-v0.9.13'297298[dependencies.cumulus-pallet-aura-ext]299git = 'https://github.com/paritytech/cumulus.git'300branch = 'polkadot-v0.9.13'301default-features = false302303[dependencies.cumulus-pallet-parachain-system]304git = 'https://github.com/paritytech/cumulus.git'305branch = 'polkadot-v0.9.13'306default-features = false307308[dependencies.cumulus-primitives-core]309git = 'https://github.com/paritytech/cumulus.git'310branch = 'polkadot-v0.9.13'311default-features = false312313[dependencies.cumulus-pallet-xcm]314git = 'https://github.com/paritytech/cumulus.git'315branch = 'polkadot-v0.9.13'316default-features = false317318[dependencies.cumulus-pallet-dmp-queue]319git = 'https://github.com/paritytech/cumulus.git'320branch = 'polkadot-v0.9.13'321default-features = false322323[dependencies.cumulus-pallet-xcmp-queue]324git = 'https://github.com/paritytech/cumulus.git'325branch = 'polkadot-v0.9.13'326default-features = false327328[dependencies.cumulus-primitives-utility]329git = 'https://github.com/paritytech/cumulus.git'330branch = 'polkadot-v0.9.13'331default-features = false332333[dependencies.cumulus-primitives-timestamp]334git = 'https://github.com/paritytech/cumulus.git'335branch = 'polkadot-v0.9.13'336default-features = false337338################################################################################339# Polkadot dependencies340341[dependencies.polkadot-parachain]342git = 'https://github.com/paritytech/polkadot'343branch = 'release-v0.9.13'344default-features = false345346[dependencies.xcm]347git = 'https://github.com/paritytech/polkadot'348branch = 'release-v0.9.13'349default-features = false350351[dependencies.xcm-builder]352git = 'https://github.com/paritytech/polkadot'353branch = 'release-v0.9.13'354default-features = false355356[dependencies.xcm-executor]357git = 'https://github.com/paritytech/polkadot'358branch = 'release-v0.9.13'359default-features = false360361[dependencies.pallet-xcm]362git = 'https://github.com/paritytech/polkadot'363branch = 'release-v0.9.13'364default-features = false365366[dependencies.orml-vesting]367git = 'https://github.com/UniqueNetwork/open-runtime-module-library'368branch = 'polkadot-v0.9.13'369version = "0.4.1-dev" 370default-features = false371372################################################################################373# local dependencies374375[dependencies]376scale-info = { version = "1.0.0", default-features = false, features = [377 "derive",378] }379derivative = "2.2.0"380pallet-unique = { path = '../pallets/unique', default-features = false }381up-rpc = { path = "../primitives/rpc", default-features = false }382up-evm-mapping = { path = "../primitives/evm-mapping", default-features = false }383pallet-inflation = { path = '../pallets/inflation', default-features = false }384up-data-structs = { path = '../primitives/data-structs', default-features = false }385pallet-common = { default-features = false, path = "../pallets/common" }386pallet-fungible = { default-features = false, path = "../pallets/fungible" }387pallet-refungible = { default-features = false, path = "../pallets/refungible" }388pallet-nonfungible = { default-features = false, path = "../pallets/nonfungible" }389pallet-unq-scheduler = { path = '../pallets/scheduler', default-features = false }390# pallet-contract-helpers = { path = '../pallets/contract-helpers', default-features = false, version = '0.1.0' }391pallet-charge-transaction = { git = "https://github.com/UniqueNetwork/pallet-sponsoring", branch = 'polkadot-v0.9.13', package = "pallet-template-transaction-payment", default-features = false, version = '3.0.0' }392pallet-evm-migration = { path = '../pallets/evm-migration', default-features = false }393pallet-evm-contract-helpers = { path = '../pallets/evm-contract-helpers', default-features = false }394pallet-evm-transaction-payment = { path = '../pallets/evm-transaction-payment', default-features = false }395pallet-evm-coder-substrate = { default-features = false, path = "../pallets/evm-coder-substrate" }396397pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.13" }398pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.13" }399fp-rpc = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.13" }400fp-self-contained = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.13" }401402################################################################################403# Build Dependencies404405[build-dependencies.substrate-wasm-builder]406git = 'https://github.com/paritytech/substrate.git'407branch = 'polkadot-v0.9.13'runtime/src/lib.rsdiffbeforeafterboth--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -785,17 +785,18 @@
type Event = Event;
type WeightInfo = pallet_unique::weights::SubstrateWeight<Self>;
}
-/*
+
parameter_types! {
pub const InflationBlockInterval: BlockNumber = 100; // every time per how many blocks inflation is applied
-} */
+}
/// Used for the pallet inflation
-/* impl pallet_inflation::Config for Runtime {
+impl pallet_inflation::Config for Runtime {
type Currency = Balances;
type TreasuryAccountId = TreasuryAccountId;
type InflationBlockInterval = InflationBlockInterval;
-} */
+ type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
+}
// parameter_types! {
// pub MaximumSchedulerWeight: Weight = Perbill::from_percent(50) *
@@ -882,7 +883,7 @@
DmpQueue: cumulus_pallet_dmp_queue::{Pallet, Call, Storage, Event<T>} = 53,
// Unique Pallets
- // Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
+ Inflation: pallet_inflation::{Pallet, Call, Storage} = 60,
Unique: pallet_unique::{Pallet, Call, Storage, Event<T>} = 61,
// Scheduler: pallet_unq_scheduler::{Pallet, Call, Storage, Event<T>} = 62,
// free = 63
@@ -1367,7 +1368,7 @@
list_benchmark!(list, extra, pallet_evm_migration, EvmMigration);
list_benchmark!(list, extra, pallet_unique, Unique);
- //list_benchmark!(list, extra, pallet_inflation, Inflation);
+ list_benchmark!(list, extra, pallet_inflation, Inflation);
list_benchmark!(list, extra, pallet_fungible, Fungible);
list_benchmark!(list, extra, pallet_refungible, Refungible);
list_benchmark!(list, extra, pallet_nonfungible, Nonfungible);
@@ -1401,7 +1402,7 @@
add_benchmark!(params, batches, pallet_evm_migration, EvmMigration);
add_benchmark!(params, batches, pallet_unique, Unique);
- //add_benchmark!(params, batches, pallet_inflation, Inflation);
+ add_benchmark!(params, batches, pallet_inflation, Inflation);
add_benchmark!(params, batches, pallet_fungible, Fungible);
add_benchmark!(params, batches, pallet_refungible, Refungible);
add_benchmark!(params, batches, pallet_nonfungible, Nonfungible);
tests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth--- a/tests/src/creditFeesToTreasury.test.ts
+++ b/tests/src/creditFeesToTreasury.test.ts
@@ -34,7 +34,7 @@
// Skip the inflation block pauses if the block is close to inflation block
// until the inflation happens
/*eslint no-async-promise-executor: "off"*/
-/*function skipInflationBlock(api: ApiPromise): Promise<void> {
+function skipInflationBlock(api: ApiPromise): Promise<void> {
const promise = new Promise<void>(async (resolve) => {
const blockInterval = (await api.consts.inflation.inflationBlockInterval).toNumber();
const unsubscribe = await api.rpc.chain.subscribeNewHeads(head => {
@@ -49,7 +49,7 @@
});
return promise;
-}*/
+}
describe('integration test: Fees must be credited to Treasury:', () => {
before(async () => {
@@ -61,7 +61,7 @@
it('Total issuance does not change', async () => {
await usingApi(async (api) => {
- //await skipInflationBlock(api);
+ await skipInflationBlock(api);
await waitNewBlocks(api, 1);
const totalBefore = (await api.query.balances.totalIssuance()).toBigInt();
@@ -81,7 +81,7 @@
it('Sender balance decreased by fee+sent amount, Treasury balance increased by fee', async () => {
await usingApi(async (api) => {
- //await skipInflationBlock(api);
+ await skipInflationBlock(api);
await waitNewBlocks(api, 1);
const alicePrivateKey = privateKey('//Alice');
@@ -125,7 +125,7 @@
it('NFT Transactions also send fees to Treasury', async () => {
await usingApi(async (api) => {
- //await skipInflationBlock(api);
+ await skipInflationBlock(api);
await waitNewBlocks(api, 1);
const treasuryBalanceBefore = (await api.query.system.account(TREASURY)).data.free.toBigInt();
@@ -144,7 +144,7 @@
it('Fees are sane', async () => {
await usingApi(async (api) => {
- //await skipInflationBlock(api);
+ await skipInflationBlock(api);
await waitNewBlocks(api, 1);
const aliceBalanceBefore: bigint = (await api.query.system.account(alicesPublicKey)).data.free.toBigInt();
@@ -161,7 +161,7 @@
it('NFT Transfer fee is close to 0.1 Unique', async () => {
await usingApi(async (api) => {
- //await skipInflationBlock(api);
+ await skipInflationBlock(api);
await waitNewBlocks(api, 1);
const collectionId = await createCollectionExpectSuccess();
tests/src/inflation.test.tsdiffbeforeafterboth--- a/tests/src/inflation.test.ts
+++ b/tests/src/inflation.test.ts
@@ -5,21 +5,32 @@
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
-import {default as usingApi} from './substrate/substrate-api';
+import {default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync} from './substrate/substrate-api';
+import privateKey from './substrate/privateKey';
chai.use(chaiAsPromised);
const expect = chai.expect;
-describe.skip('integration test: Inflation', () => {
+describe('integration test: Inflation', () => {
it('First year inflation is 10%', async () => {
await usingApi(async (api) => {
+ // Make sure non-sudo can't start inflation
+ const tx = api.tx.inflation.startInflation(1);
+ const bob = privateKey('//Bob');
+ await expect(submitTransactionExpectFailAsync(bob, tx)).to.be.rejected;
+
+ // Start inflation on relay block 1 (Alice is sudo)
+ const alice = privateKey('//Alice');
+ const sudoTx = api.tx.sudo.sudo(tx as any);
+ await submitTransactionAsync(alice, sudoTx);
+
const blockInterval = (api.consts.inflation.inflationBlockInterval).toBigInt();
const totalIssuanceStart = (await api.query.inflation.startingYearTotalIssuance()).toBigInt();
const blockInflation = (await api.query.inflation.blockInflation()).toBigInt();
- // const YEAR = 5259600n; // 6-second block. Blocks in one year
- const YEAR = 2629800n; // 12-second block. Blocks in one year
+ const YEAR = 5259600n; // 6-second block. Blocks in one year
+ // const YEAR = 2629800n; // 12-second block. Blocks in one year
const totalExpectedInflation = totalIssuanceStart / 10n;
const totalActualInflation = blockInflation * YEAR / blockInterval;
tests/src/pallet-presence.test.tsdiffbeforeafterboth--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -34,7 +34,7 @@
'polkadotxcm',
'cumulusxcm',
'dmpqueue',
- //'inflation',
+ 'inflation',
'unique',
'nonfungible',
'refungible',