From 4f2091f4c4828ee0332067dc2aacea31f926212c Mon Sep 17 00:00:00 2001 From: Lipai <1164934857@qq.com> Date: Fri, 16 Sep 2022 22:18:13 +0800 Subject: [PATCH] Feat: distribute crowdloan rewards (#1864) * exact do_create * implement Streaming trait * use in crowdloan * Update lib.rs * add test * add update_leases_bonus & add LeasesBonus * add to runtime & add test * exact minimum_deposit --- Cargo.lock | 1 + pallets/crowdloans/src/benchmarking.rs | 16 +++ pallets/crowdloans/src/lib.rs | 55 +++++++- pallets/crowdloans/src/mock.rs | 2 + pallets/crowdloans/src/tests.rs | 18 +++ pallets/crowdloans/src/types.rs | 22 +++- pallets/crowdloans/src/weights.rs | 12 ++ pallets/streaming/Cargo.toml | 2 + pallets/streaming/src/lib.rs | 118 +++++++++++++----- pallets/streaming/src/tests.rs | 108 ++++++++++++++++ pallets/traits/src/lib.rs | 30 ++++- runtime/heiko/src/lib.rs | 2 + .../heiko/src/weights/pallet_crowdloans.rs | 6 + runtime/kerria/src/lib.rs | 2 + .../kerria/src/weights/pallet_crowdloans.rs | 6 + runtime/parallel/src/lib.rs | 2 + .../parallel/src/weights/pallet_crowdloans.rs | 6 + runtime/vanilla/src/lib.rs | 2 + .../vanilla/src/weights/pallet_crowdloans.rs | 6 + 19 files changed, 379 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 01cf7111f..31709c7c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6943,6 +6943,7 @@ dependencies = [ "pallet-balances", "pallet-currency-adapter", "pallet-timestamp", + "pallet-traits", "parallel-primitives", "parity-scale-codec", "scale-info", diff --git a/pallets/crowdloans/src/benchmarking.rs b/pallets/crowdloans/src/benchmarking.rs index 4481207b2..7c5bcd8f9 100644 --- a/pallets/crowdloans/src/benchmarking.rs +++ b/pallets/crowdloans/src/benchmarking.rs @@ -221,6 +221,22 @@ benchmarks! { assert_last_event::(Event::ProxyUpdated(caller).into()) } + update_leases_bonus { + let bonus_config = BonusConfig { + bonus_per_token: 5, + start_time: Default::default(), + end_time: Default::default(), + }; + }: _( + SystemOrigin::Root, + 6, + 13, + bonus_config + ) + verify { + assert_last_event::(Event::LeasesBonusUpdated((6,13),bonus_config).into()) + } + reopen { let ctoken = 13; let caller: T::AccountId = whitelisted_caller(); diff --git a/pallets/crowdloans/src/lib.rs b/pallets/crowdloans/src/lib.rs index e5b1a0d3e..2de3f98e4 100644 --- a/pallets/crowdloans/src/lib.rs +++ b/pallets/crowdloans/src/lib.rs @@ -67,7 +67,7 @@ pub mod pallet { use sp_std::{boxed::Box, vec::Vec}; use xcm::latest::prelude::*; - use pallet_traits::{VaultTokenCurrenciesFilter, VaultTokenExchangeRateProvider}; + use pallet_traits::{Streaming, VaultTokenCurrenciesFilter, VaultTokenExchangeRateProvider}; use parallel_support::math_helper::f64::{ fixed_u128_from_float, fixed_u128_to_float, power_float, @@ -188,6 +188,12 @@ pub mod pallet { /// To expose XCM helper functions type XCM: XcmHelper, Self::AccountId>; + + /// To expose Streaming related functions + type Streaming: Streaming, BalanceOf>; + + #[pallet::constant] + type GetNativeCurrencyId: Get>; } #[pallet::event] @@ -282,6 +288,8 @@ pub mod pallet { /// Update proxy address /// [account] ProxyUpdated(T::AccountId), + /// Update leases bonus + LeasesBonusUpdated(VaultId, BonusConfig>), } #[pallet::error] @@ -374,6 +382,18 @@ pub mod pallet { #[pallet::getter(fn proxy_address)] pub type ProxyAddress = StorageValue<_, AccountIdOf, OptionQuery>; + #[pallet::storage] + #[pallet::getter(fn leases_bonus)] + pub type LeasesBonus = StorageNMap< + _, + ( + NMapKey, + NMapKey, + ), + BonusConfig>, + ValueQuery, + >; + #[pallet::call] impl Pallet { /// Create a new vault via a governance decision @@ -1141,6 +1161,24 @@ pub mod pallet { Ok(()) } + + /// Update crowdloans proxy address in relaychain + #[pallet::weight(::WeightInfo::update_leases_bonus())] + #[transactional] + pub fn update_leases_bonus( + origin: OriginFor, + lease_start: LeasePeriod, + lease_end: LeasePeriod, + bonus_config: BonusConfig>, + ) -> DispatchResult { + ensure_origin!(UpdateOrigin, origin)?; + LeasesBonus::::insert((&lease_start, &lease_end), bonus_config); + Self::deposit_event(Event::::LeasesBonusUpdated( + (lease_start, lease_end), + bonus_config, + )); + Ok(()) + } } impl Pallet { @@ -1593,6 +1631,21 @@ pub mod pallet { Self::contribution_kill(vault.trie_index, &who, ChildStorageKind::Contributed); + // Bonus for PARA, Not applicable for HKO + let bonus_config = Self::leases_bonus((&lease_start, &lease_end)); + let bonus_amount = amount.saturating_mul(bonus_config.bonus_per_token); + if !bonus_amount.is_zero() { + T::Streaming::create( + Self::account_id(), + who.clone(), + bonus_amount, + T::GetNativeCurrencyId::get(), + bonus_config.start_time, + bonus_config.end_time, + false, + )?; + } + Self::deposit_event(Event::::VaultClaimed( crowdloan, (lease_start, lease_end), diff --git a/pallets/crowdloans/src/mock.rs b/pallets/crowdloans/src/mock.rs index 964fd3cda..7e22e0b74 100644 --- a/pallets/crowdloans/src/mock.rs +++ b/pallets/crowdloans/src/mock.rs @@ -514,6 +514,8 @@ impl crate::Config for Test { type LeasePeriod = LeasePeriod; type LeaseOffset = LeaseOffset; type LeasePerYear = LeasePerYear; + type Streaming = (); + type GetNativeCurrencyId = NativeCurrencyId; } parameter_types! { diff --git a/pallets/crowdloans/src/tests.rs b/pallets/crowdloans/src/tests.rs index 41c3cdce9..0f0b110c0 100644 --- a/pallets/crowdloans/src/tests.rs +++ b/pallets/crowdloans/src/tests.rs @@ -1849,3 +1849,21 @@ fn xcm_proxy_contribute_should_work() { // assert_eq!(ctoken_balance, amount); }); } + +#[test] +fn update_leases_bonus_should_work() { + new_test_ext().execute_with(|| { + let start_lease = 6; + let end_lease = 13; + + let mut config = BonusConfig::default(); + config.bonus_per_token = 5; + assert_ok!(Crowdloans::update_leases_bonus( + frame_system::RawOrigin::Root.into(), + start_lease, + end_lease, + config, + )); + assert_eq!(Crowdloans::leases_bonus((&start_lease, &end_lease)), config,); + }) +} diff --git a/pallets/crowdloans/src/types.rs b/pallets/crowdloans/src/types.rs index 9990254c8..8e84d0448 100644 --- a/pallets/crowdloans/src/types.rs +++ b/pallets/crowdloans/src/types.rs @@ -19,7 +19,7 @@ use super::{AccountIdOf, AssetIdOf, BalanceOf, Config}; use codec::{Decode, Encode}; use frame_system::pallet_prelude::BlockNumberFor; -use primitives::{LeasePeriod, ParaId, TrieIndex, VaultId}; +use primitives::{LeasePeriod, ParaId, Timestamp, TrieIndex, VaultId}; use scale_info::TypeInfo; use sp_runtime::{traits::Zero, RuntimeDebug}; use sp_std::vec::Vec; @@ -144,3 +144,23 @@ impl Default for Releases { Releases::V0_0_0 } } + +#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo)] +pub struct BonusConfig { + // The bonus per-value of the contribute + pub bonus_per_token: Balance, + // The start time of the stream + pub start_time: Timestamp, + // The end time of the stream + pub end_time: Timestamp, +} + +impl Default for BonusConfig { + fn default() -> Self { + BonusConfig { + bonus_per_token: Default::default(), + start_time: Default::default(), + end_time: Default::default(), + } + } +} diff --git a/pallets/crowdloans/src/weights.rs b/pallets/crowdloans/src/weights.rs index 10e31b22b..e5d10e9fd 100644 --- a/pallets/crowdloans/src/weights.rs +++ b/pallets/crowdloans/src/weights.rs @@ -64,6 +64,7 @@ pub trait WeightInfo { fn dissolve_vault() -> Weight; fn refund_for() -> Weight; fn update_proxy() -> Weight; + fn update_leases_bonus() -> Weight; } /// Weights for pallet_crowdloans using the Substrate node and recommended hardware. @@ -291,6 +292,12 @@ impl WeightInfo for SubstrateWeight { .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } + + fn update_leases_bonus() -> Weight { + (31_127_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } } // For backwards compatibility and tests @@ -517,4 +524,9 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(1 as Weight)) .saturating_add(RocksDbWeight::get().writes(2 as Weight)) } + fn update_leases_bonus() -> Weight { + (31_127_000 as Weight) + .saturating_add(RocksDbWeight::get().reads(1 as Weight)) + .saturating_add(RocksDbWeight::get().writes(2 as Weight)) + } } diff --git a/pallets/streaming/Cargo.toml b/pallets/streaming/Cargo.toml index 07db8bc3b..952d4d0f3 100644 --- a/pallets/streaming/Cargo.toml +++ b/pallets/streaming/Cargo.toml @@ -21,6 +21,7 @@ scale-info = { version = '2.1', default-features = false, features = ['d serde = { version = '1.0.136', features = ['derive'], optional = true } sp-runtime = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.28', default-features = false } sp-std = { git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.28', default-features = false } +pallet-traits = { path = '../traits', default-features = false } [dev-dependencies] orml-oracle = { version = '0.4.1-dev' } @@ -47,6 +48,7 @@ std = [ 'pallet-timestamp/std', 'serde', 'scale-info/std', + 'pallet-traits/std', ] try-runtime = ['frame-support/try-runtime'] diff --git a/pallets/streaming/src/lib.rs b/pallets/streaming/src/lib.rs index b4d8f52e5..dbc2d58c4 100644 --- a/pallets/streaming/src/lib.rs +++ b/pallets/streaming/src/lib.rs @@ -30,6 +30,7 @@ use frame_support::{ transactional, PalletId, }; use frame_system::pallet_prelude::*; +use pallet_traits::Streaming as StreamingTrait; use primitives::*; use sp_runtime::{ traits::{AccountIdConversion, One, Zero}, @@ -227,54 +228,24 @@ pub mod pallet { cancellable: bool, ) -> DispatchResultWithPostInfo { let sender = ensure_signed(origin)?; - ensure!(sender != recipient, Error::::RecipientIsAlsoSender); - let minimum_deposit = Self::minimum_deposit(asset_id).ok_or(Error::::InvalidAssetId)?; ensure!( deposit >= minimum_deposit, Error::::DepositLowerThanMinimum ); - - let duration = Self::ensure_valid_duration(start_time, end_time)?; - let rate_per_sec = deposit - .checked_div(duration as u128) - .ok_or(Error::::InvalidRatePerSecond)?; - ensure!(!rate_per_sec.is_zero(), Error::::InvalidRatePerSecond); - - // Transfer deposit asset from sender to global EOA - T::Assets::transfer(asset_id, &sender, &Self::account_id(), deposit, false)?; - - // The remaining balance will be the same value as the deposit due to initialization - let stream: Stream = Stream::new( - deposit, - asset_id, - rate_per_sec, + let stream_id = Self::do_create( sender.clone(), recipient.clone(), + deposit, + asset_id, start_time, end_time, cancellable, - ); - - let stream_id = NextStreamId::::get(); - // Increment next stream id and store the new created stream - NextStreamId::::set( - stream_id - .checked_add(One::one()) - .ok_or(ArithmeticError::Overflow)?, - ); - Streams::::insert(stream_id, stream); - + )?; // Add the stream_id to stream_library for both the sender and receiver. Self::try_push_stream_library(&sender, stream_id, StreamKind::Send)?; Self::try_push_stream_library(&recipient, stream_id, StreamKind::Receive)?; - // Remove the outdated and finished streams, should do update after push - Self::update_finished_stream_library(&sender, &recipient)?; - - Self::deposit_event(Event::::StreamCreated( - stream_id, sender, recipient, deposit, asset_id, start_time, end_time, true, - )); Ok(().into()) } @@ -517,4 +488,83 @@ impl Pallet { Ok(()) } + + pub fn do_create( + sender: AccountOf, + recipient: AccountOf, + deposit: BalanceOf, + asset_id: AssetIdOf, + start_time: Timestamp, + end_time: Timestamp, + cancellable: bool, + ) -> Result { + ensure!(sender != recipient, Error::::RecipientIsAlsoSender); + + let duration = Self::ensure_valid_duration(start_time, end_time)?; + let rate_per_sec = deposit + .checked_div(duration as u128) + .ok_or(Error::::InvalidRatePerSecond)?; + ensure!(!rate_per_sec.is_zero(), Error::::InvalidRatePerSecond); + + // Transfer deposit asset from sender to global EOA + T::Assets::transfer(asset_id, &sender, &Self::account_id(), deposit, false)?; + + // The remaining balance will be the same value as the deposit due to initialization + let stream: Stream = Stream::new( + deposit, + asset_id, + rate_per_sec, + sender.clone(), + recipient.clone(), + start_time, + end_time, + cancellable, + ); + + let stream_id = NextStreamId::::get(); + // Increment next stream id and store the new created stream + NextStreamId::::set( + stream_id + .checked_add(One::one()) + .ok_or(ArithmeticError::Overflow)?, + ); + Streams::::insert(stream_id, stream); + + // Remove the outdated and finished streams, should do update after push + Self::update_finished_stream_library(&sender, &recipient)?; + + Self::deposit_event(Event::::StreamCreated( + stream_id, sender, recipient, deposit, asset_id, start_time, end_time, true, + )); + Ok(stream_id) + } +} + +impl StreamingTrait, AssetIdOf, BalanceOf> for Pallet { + fn create( + sender: AccountOf, + recipient: AccountOf, + deposit: BalanceOf, + asset_id: AssetIdOf, + start_time: Timestamp, + end_time: Timestamp, + cancellable: bool, + ) -> Result<(), DispatchError> { + ensure!( + Self::minimum_deposit(asset_id).is_some(), + Error::::InvalidAssetId + ); + let stream_id = Self::do_create( + sender, + recipient.clone(), + deposit, + asset_id, + start_time, + end_time, + cancellable, + )?; + // Add the stream_id to stream_library for receiver. + Self::try_push_stream_library(&recipient, stream_id, StreamKind::Receive)?; + Ok(()) + } } diff --git a/pallets/streaming/src/tests.rs b/pallets/streaming/src/tests.rs index 621501efb..f50a97025 100644 --- a/pallets/streaming/src/tests.rs +++ b/pallets/streaming/src/tests.rs @@ -787,3 +787,111 @@ fn create_with_minimum_deposit_works() { ); }) } + +#[test] +fn create_with_lots_stream_works() { + new_test_ext().execute_with(|| { + // Set minimum deposit for DOT + assert_ok!(Streaming::set_minimum_deposit( + Origin::root(), + DOT, + dollar(100) + )); + + assert_err!( + Streaming::create(Origin::signed(ALICE), BOB, dollar(99), DOT, 6, 10, false), + Error::::DepositLowerThanMinimum + ); + + assert_ok!(>::create(ALICE, BOB, dollar(99), DOT, 6, 10, false)); + + Assets::mint(Origin::signed(ALICE), DOT, ALICE, dollar(100 * 500)).unwrap(); + let initial_stream_id = NextStreamId::::get(); + let recipient_list = 100..500; + let stream_amount = dollar(101); + // create streams for lots of receiver + for recipient in recipient_list.clone() { + let stream_id = NextStreamId::::get(); + assert_ok!(>::create( + ALICE, recipient, stream_amount, DOT, 6, 19, true + )); + let stream = Streams::::get(stream_id).unwrap(); + assert_eq!( + stream, + Stream::new( + stream_amount, + DOT, + 7769230769230, + ALICE, + recipient, + 6, + 19, + true, + ) + ); + } + + assert_eq!(TimestampPallet::now(), 6000); + // passed 12 seconds + TimestampPallet::set_timestamp(18000); + let mut iter_stream_id = initial_stream_id; + for recipient in recipient_list.clone() { + let stream = Streams::::get(iter_stream_id).unwrap(); + assert_eq!(stream.delta_of(), Ok(12)); + assert_eq!(stream.sender_balance().unwrap(), 7769230769240); + assert_eq!(stream.recipient_balance().unwrap(), 93230769230760); + + assert_ok!(Streaming::withdraw( + Origin::signed(recipient), + iter_stream_id, + 93230769230760 + )); + + let stream = Streams::::get(iter_stream_id).unwrap(); + assert_eq!(stream.sender_balance().unwrap(), 7769230769240); + assert_eq!(stream.recipient_balance().unwrap(), 0); + + iter_stream_id += 1; + } + + // passed 15 seconds + TimestampPallet::set_timestamp(21000); + let mut iter_stream_id = initial_stream_id; + for recipient in recipient_list.clone() { + let stream = Streams::::get(iter_stream_id).unwrap(); + assert_eq!(stream.delta_of(), Ok(13)); + assert_eq!(stream.sender_balance().unwrap(), 0); + assert_eq!(stream.recipient_balance().unwrap(), 7769230769240); + + assert_ok!(Streaming::withdraw( + Origin::signed(recipient), + iter_stream_id, + 7769230769240 + )); + + assert!( + StreamLibrary::::get(ALICE, StreamKind::Finish) + .unwrap() + .len() + <= ::MaxFinishedStreamsCount::get() + .try_into() + .unwrap() + ); + + assert_eq!( + ::Assets::balance(DOT, &recipient), + stream_amount + ); + + iter_stream_id += 1; + } + }) +} diff --git a/pallets/traits/src/lib.rs b/pallets/traits/src/lib.rs index 5e84c2df7..7dd4e0579 100644 --- a/pallets/traits/src/lib.rs +++ b/pallets/traits/src/lib.rs @@ -7,7 +7,9 @@ use scale_info::TypeInfo; use sp_runtime::{traits::Zero, RuntimeDebug}; use sp_std::prelude::*; -use primitives::{CurrencyId, DerivativeIndex, PersistedValidationData, PriceDetail, Rate}; +use primitives::{ + CurrencyId, DerivativeIndex, PersistedValidationData, PriceDetail, Rate, Timestamp, +}; pub mod loans; pub mod ump; @@ -222,3 +224,29 @@ pub trait DistributionStrategy { input: Balance, ) -> Vec<(DerivativeIndex, Balance)>; } + +pub trait Streaming { + fn create( + sender: AccountId, + recipient: AccountId, + deposit: Balance, + asset_id: CurrencyId, + start_time: Timestamp, + end_time: Timestamp, + cancellable: bool, + ) -> Result<(), DispatchError>; +} + +impl Streaming for () { + fn create( + _sender: AccountId, + _recipient: AccountId, + _deposit: Balance, + _asset_id: CurrencyId, + _start_time: Timestamp, + _end_time: Timestamp, + _cancellable: bool, + ) -> Result<(), DispatchError> { + Ok(()) + } +} diff --git a/runtime/heiko/src/lib.rs b/runtime/heiko/src/lib.rs index e38fda2da..3c46bfc4a 100644 --- a/runtime/heiko/src/lib.rs +++ b/runtime/heiko/src/lib.rs @@ -1977,6 +1977,8 @@ impl pallet_crowdloans::Config for Runtime { type LeasePeriod = LeasePeriod; type LeaseOffset = LeaseOffset; type LeasePerYear = LeasePerYear; + type Streaming = (); + type GetNativeCurrencyId = NativeCurrencyId; } parameter_types! { diff --git a/runtime/heiko/src/weights/pallet_crowdloans.rs b/runtime/heiko/src/weights/pallet_crowdloans.rs index f4c1d7b74..19e6a19b4 100644 --- a/runtime/heiko/src/weights/pallet_crowdloans.rs +++ b/runtime/heiko/src/weights/pallet_crowdloans.rs @@ -255,4 +255,10 @@ impl pallet_crowdloans::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } + + fn update_leases_bonus() -> Weight { + (31_127_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } } diff --git a/runtime/kerria/src/lib.rs b/runtime/kerria/src/lib.rs index c52f63ea8..707644f4e 100644 --- a/runtime/kerria/src/lib.rs +++ b/runtime/kerria/src/lib.rs @@ -2152,6 +2152,8 @@ impl pallet_crowdloans::Config for Runtime { type LeasePeriod = LeasePeriod; type LeaseOffset = LeaseOffset; type LeasePerYear = LeasePerYear; + type Streaming = Streaming; + type GetNativeCurrencyId = NativeCurrencyId; } parameter_types! { diff --git a/runtime/kerria/src/weights/pallet_crowdloans.rs b/runtime/kerria/src/weights/pallet_crowdloans.rs index f4c1d7b74..19e6a19b4 100644 --- a/runtime/kerria/src/weights/pallet_crowdloans.rs +++ b/runtime/kerria/src/weights/pallet_crowdloans.rs @@ -255,4 +255,10 @@ impl pallet_crowdloans::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } + + fn update_leases_bonus() -> Weight { + (31_127_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } } diff --git a/runtime/parallel/src/lib.rs b/runtime/parallel/src/lib.rs index ae932aa27..7087b2b40 100644 --- a/runtime/parallel/src/lib.rs +++ b/runtime/parallel/src/lib.rs @@ -1968,6 +1968,8 @@ impl pallet_crowdloans::Config for Runtime { type LeasePeriod = LeasePeriod; type LeaseOffset = LeaseOffset; type LeasePerYear = LeasePerYear; + type Streaming = Streaming; + type GetNativeCurrencyId = NativeCurrencyId; } parameter_types! { diff --git a/runtime/parallel/src/weights/pallet_crowdloans.rs b/runtime/parallel/src/weights/pallet_crowdloans.rs index f4c1d7b74..19e6a19b4 100644 --- a/runtime/parallel/src/weights/pallet_crowdloans.rs +++ b/runtime/parallel/src/weights/pallet_crowdloans.rs @@ -255,4 +255,10 @@ impl pallet_crowdloans::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } + + fn update_leases_bonus() -> Weight { + (31_127_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } } diff --git a/runtime/vanilla/src/lib.rs b/runtime/vanilla/src/lib.rs index f0f9d85fd..e9b4fa3fd 100644 --- a/runtime/vanilla/src/lib.rs +++ b/runtime/vanilla/src/lib.rs @@ -2192,6 +2192,8 @@ impl pallet_crowdloans::Config for Runtime { type LeasePeriod = LeasePeriod; type LeaseOffset = LeaseOffset; type LeasePerYear = LeasePerYear; + type Streaming = (); + type GetNativeCurrencyId = NativeCurrencyId; } parameter_types! { diff --git a/runtime/vanilla/src/weights/pallet_crowdloans.rs b/runtime/vanilla/src/weights/pallet_crowdloans.rs index f4c1d7b74..19e6a19b4 100644 --- a/runtime/vanilla/src/weights/pallet_crowdloans.rs +++ b/runtime/vanilla/src/weights/pallet_crowdloans.rs @@ -255,4 +255,10 @@ impl pallet_crowdloans::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(1 as Weight)) .saturating_add(T::DbWeight::get().writes(2 as Weight)) } + + fn update_leases_bonus() -> Weight { + (31_127_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } }