From fdb90c5e165b4d1d65ecb35c3ed2221dae0f374b Mon Sep 17 00:00:00 2001 From: herryho Date: Sat, 24 Jul 2021 16:37:23 +0800 Subject: [PATCH 1/3] - modity add_token_to_pool call to support initial token adding by any account who has enough token balance. - add functionalities to on_initialize hook to release certain amount of token by every block. --- Cargo.lock | 4 +- pallets/bancor/src/lib.rs | 164 +++++++++++++++++++++++++----------- pallets/bancor/src/mock.rs | 37 +++++--- pallets/bancor/src/tests.rs | 55 +++++++++--- pallets/salp/src/mock.rs | 2 + runtime/asgard/src/lib.rs | 14 +-- 6 files changed, 196 insertions(+), 80 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c74ee26837..600e72915e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4858,10 +4858,8 @@ dependencies = [ [[package]] name = "node-inspect" version = "0.8.0" -source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.8#1b758b2a8d151d97d2242260c465b6df9cb8a7a4" dependencies = [ "derive_more", - "log", "parity-scale-codec", "sc-cli", "sc-client-api", @@ -4875,8 +4873,10 @@ dependencies = [ [[package]] name = "node-inspect" version = "0.8.0" +source = "git+https://github.com/paritytech/substrate?branch=polkadot-v0.9.8#1b758b2a8d151d97d2242260c465b6df9cb8a7a4" dependencies = [ "derive_more", + "log", "parity-scale-codec", "sc-cli", "sc-client-api", diff --git a/pallets/bancor/src/lib.rs b/pallets/bancor/src/lib.rs index dd1b873038..a17a3c0a3a 100644 --- a/pallets/bancor/src/lib.rs +++ b/pallets/bancor/src/lib.rs @@ -40,6 +40,8 @@ type AccountIdOf = ::AccountId; type BalanceOf = <::MultiCurrency as MultiCurrency>>::Balance; const BILLION: u128 = 1_000_000_000; +// These time units are defined in number of blocks. +const BLOCKS_PER_DAY: u32 = 60 / 12 * 60 * 24; #[derive(Encode, Decode, Clone, Eq, PartialEq, Debug)] pub struct BancorPool { @@ -63,6 +65,9 @@ pub mod pallet { #[pallet::constant] type InterventionPercentage: Get; + #[pallet::constant] + type DailyReleasePercentage: Get; + /// Set default weight. type WeightInfo: WeightInfo; } @@ -97,6 +102,11 @@ pub mod pallet { #[pallet::getter(fn get_bancor_pool)] pub type BancorPools = StorageMap<_, Blake2_128Concat, CurrencyId, BancorPool>>; + /// Reserve for releasing Tokens to the bancor pool + #[pallet::storage] + #[pallet::getter(fn get_bancor_reserve)] + pub type BancorReserve = StorageMap<_, Blake2_128Concat, CurrencyId, BalanceOf>; + #[pallet::genesis_config] pub struct GenesisConfig { pub bancor_pools: Vec<(CurrencyId, BalanceOf)>, @@ -122,7 +132,8 @@ pub mod pallet { vstoken_base_supply: *base_balance, }; - BancorPools::::insert(currency_id, pool); + BancorPools::::insert(currency_id.clone(), pool); + BancorReserve::::insert(currency_id.clone(), BalanceOf::::from(0u32)); } } } @@ -131,7 +142,90 @@ pub mod pallet { pub struct Pallet(PhantomData); #[pallet::hooks] - impl Hooks for Pallet {} + impl Hooks for Pallet { + // check whether the price of vstoken (token/vstoken) is lower than 75%. if yes, then half of + // this newly released token should be used to buy vstoken, so that the price of vstoken will + // increase. Meanwhile, the other half will be put on the ceiling variable to indicate exchange + // availability. If not, all the newly release token should be put aside to the ceiling to not + // to impact the pool price. + fn on_initialize(_: T::BlockNumber) -> Weight { + // for each bancor pool currency_id, release 5% of reserve tokens to the pool + for (currency_id, reserve_amount) in BancorReserve::::iter() { + let token_amount = reserve_amount + / T::DailyReleasePercentage::get() + .saturating_reciprocal_mul_floor(BalanceOf::::from(BLOCKS_PER_DAY)); + + if token_amount > Zero::zero() { + // get the current price of vstoken + // let (nominator, denominator) = Self::get_instant_vstoken_price(currency_id); + if let Ok((nominator, denominator)) = + Self::get_instant_vstoken_price(currency_id) + { + let amount_kept: BalanceOf; + // if vstoken price is lower than 0.75 token + if T::InterventionPercentage::get() + .saturating_reciprocal_mul_floor(nominator) + <= denominator + { + amount_kept = token_amount / BalanceOf::::saturated_from(2u128); + } else { + amount_kept = token_amount; + } + + let sell_amount = token_amount.saturating_sub(amount_kept); + // deal with ceiling variable + if amount_kept != Zero::zero() { + if let Err(_) = + Self::increase_bancor_pool_ceiling(currency_id, amount_kept) + { + continue; + } + } + // deal with exchange transaction + if sell_amount != Zero::zero() { + // make changes in the bancor pool + if let Ok(vstoken_amount) = + Self::calculate_price_for_vstoken(currency_id, sell_amount) + { + let sell_result = Self::revise_bancor_pool_token_buy_vstoken( + currency_id, + sell_amount, + vstoken_amount, + ); + // if somehow not able to sell token, then add the amount to ceiling. + if let Err(err_msg) = sell_result { + match err_msg { + Error::::BancorPoolNotExist => (), + _ => { + if let Err(_) = Self::increase_bancor_pool_ceiling( + currency_id, + sell_amount, + ) { + continue; + } + } + }; + } + } + } + + // deduct token_amount from BancorReserve + BancorReserve::::mutate(currency_id, |reserve_option| { + match reserve_option { + Some(reserve) => { + *reserve = reserve.saturating_sub(token_amount); + } + _ => (), + } + }); + } + } + } + + // TODO: Estimate weight for this function + 1_000 + } + } #[pallet::call] impl Pallet { @@ -141,9 +235,13 @@ pub mod pallet { currency_id: CurrencyId, token_amount: BalanceOf, ) -> DispatchResult { - ensure_root(origin)?; + let adder = ensure_signed(origin)?; ensure!(currency_id.is_token(), Error::::NotSupportTokenType); + let token_balance = T::MultiCurrency::free_balance(currency_id, &adder); + ensure!(token_balance >= token_amount, Error::::NotEnoughBalance); + + T::MultiCurrency::withdraw(currency_id, &adder, token_amount)?; Self::add_token(currency_id, token_amount)?; Ok(()) @@ -368,7 +466,7 @@ impl Pallet { pool_info.token_ceiling = pool_info.token_ceiling.saturating_add(increase_amount); Ok(()) - }, + } _ => Err(Error::::BancorPoolNotExist), } })?; @@ -392,7 +490,7 @@ impl Pallet { pool_info.token_pool = pool_info.token_pool.saturating_sub(token_amount); pool_info.vstoken_pool = pool_info.vstoken_pool.saturating_sub(vstoken_amount); Ok(()) - }, + } _ => Err(Error::::BancorPoolNotExist), } })?; @@ -416,7 +514,7 @@ impl Pallet { pool_info.token_pool = pool_info.token_pool.saturating_add(token_amount); pool_info.vstoken_pool = pool_info.vstoken_pool.saturating_add(vstoken_amount); Ok(()) - }, + } _ => Err(Error::::BancorPoolNotExist), } })?; @@ -426,49 +524,19 @@ impl Pallet { } impl BancorHandler> for Pallet { - // check whether the price of vstoken (token/vstoken) is lower than 75%. if yes, then half of - // this newly released token should be used to buy vstoken, so that the price of vstoken will - // increase. Meanwhile, the other half will be put on the ceiling variable to indicate exchange - // availability. If not, all the newly release token should be put aside to the ceiling to not - // to impact the pool price. fn add_token(currency_id: CurrencyId, token_amount: BalanceOf) -> Result<(), DispatchError> { - // get the current price of vstoken - let (nominator, denominator) = Self::get_instant_vstoken_price(currency_id)?; - - let amount_kept: BalanceOf; - // if vstoken price is lower than 0.75 token - if T::InterventionPercentage::get().saturating_reciprocal_mul_floor(nominator) <= - denominator - { - amount_kept = token_amount / BalanceOf::::saturated_from(2u128); - } else { - amount_kept = token_amount; - } - - let sell_amount = token_amount.saturating_sub(amount_kept); - - // deal with ceiling variable - if amount_kept != Zero::zero() { - Self::increase_bancor_pool_ceiling(currency_id, amount_kept)?; - } - - // deal with exchange transaction - if sell_amount != Zero::zero() { - // make changes in the bancor pool - let vstoken_amount = Self::calculate_price_for_vstoken(currency_id, sell_amount)?; - let sell_result = Self::revise_bancor_pool_token_buy_vstoken( - currency_id, - sell_amount, - vstoken_amount, - ); - - // if somehow not able to sell token, then add the amount to ceiling. - if let Err(err_msg) = sell_result { - match err_msg { - Error::::BancorPoolNotExist => Err(Error::::BancorPoolNotExist), - _ => Self::increase_bancor_pool_ceiling(currency_id, sell_amount), - }?; - } + ensure!(token_amount >= Zero::zero(), Error::::AmountNotGreaterThanZero); + + if token_amount != Zero::zero() { + BancorReserve::::mutate(currency_id, |reserve_option| -> Result<(), Error> { + match reserve_option { + Some(reserve) => { + *reserve = reserve.saturating_add(token_amount); + Ok(()) + } + _ => Err(Error::::BancorPoolNotExist), + } + })?; } Ok(()) diff --git a/pallets/bancor/src/mock.rs b/pallets/bancor/src/mock.rs index f2515ad3fc..516aadbe67 100644 --- a/pallets/bancor/src/mock.rs +++ b/pallets/bancor/src/mock.rs @@ -18,7 +18,11 @@ #![cfg(test)] -use frame_support::{construct_runtime, parameter_types, traits::GenesisBuild}; +use frame_support::{ + construct_runtime, parameter_types, + traits::GenesisBuild, + traits::{OnFinalize, OnInitialize}, +}; pub use node_primitives::{Balance, CurrencyId, TokenSymbol}; use sp_core::H256; use sp_runtime::{ @@ -109,11 +113,13 @@ impl orml_tokens::Config for Test { parameter_types! { pub const InterventionPercentage: Percent = Percent::from_percent(75); + pub const DailyReleasePercentage: Percent = Percent::from_percent(5); } impl bancor::Config for Test { type Event = Event; type InterventionPercentage = InterventionPercentage; + type DailyReleasePercentage = DailyReleasePercentage; type MultiCurrency = Tokens; type WeightInfo = (); } @@ -147,16 +153,16 @@ impl ExtBuilder { ]) } - pub fn hundred_thousand_for_alice_n_bob(self) -> Self { + pub fn thousand_thousand_for_alice_n_bob(self) -> Self { self.balances(vec![ - (ALICE, KSM, 100_000), - (ALICE, DOT, 100_000), - (ALICE, VSKSM, 100_000), - (ALICE, VSDOT, 100_000), - (BOB, KSM, 100_000), - (BOB, DOT, 100_000), - (BOB, VSKSM, 100_000), - (BOB, VSDOT, 100_000), + (ALICE, KSM, 1_000_000), + (ALICE, DOT, 1_000_000), + (ALICE, VSKSM, 1_000_000), + (ALICE, VSDOT, 1_000_000), + (BOB, KSM, 1_000_000), + (BOB, DOT, 1_000_000), + (BOB, VSKSM, 1_000_000), + (BOB, VSDOT, 1_000_000), ]) } @@ -179,3 +185,14 @@ impl ExtBuilder { t.into() } } + +// simulate block production +pub(crate) fn run_to_block(n: u64) { + while System::block_number() < n { + Bancor::on_finalize(System::block_number()); + System::on_finalize(System::block_number()); + System::set_block_number(System::block_number() + 1); + System::on_initialize(System::block_number()); + Bancor::on_initialize(System::block_number()); + } +} diff --git a/pallets/bancor/src/tests.rs b/pallets/bancor/src/tests.rs index e2ec19f42c..700a4098cf 100644 --- a/pallets/bancor/src/tests.rs +++ b/pallets/bancor/src/tests.rs @@ -22,6 +22,17 @@ use frame_support::{assert_noop, assert_ok}; use crate::{mock::*, *}; +#[test] +fn add_token_to_pool_should_work() { + ExtBuilder::default().one_thousand_for_alice_n_bob().build().execute_with(|| { + assert_eq!(Tokens::free_balance(DOT, &ALICE), 1000); + + assert_ok!(Bancor::add_token_to_pool(Origin::signed(ALICE), DOT, 500)); + assert_eq!(Tokens::free_balance(DOT, &ALICE), 500); + assert_eq!(Bancor::get_bancor_reserve(DOT).unwrap(), 500); + }); +} + #[test] fn exchange_for_token_should_work() { ExtBuilder::default().one_thousand_for_alice_n_bob().build().execute_with(|| { @@ -189,12 +200,16 @@ fn exchange_for_vstoken_should_work() { #[test] fn add_token_should_work() { ExtBuilder::default() - .hundred_thousand_for_alice_n_bob() + .thousand_thousand_for_alice_n_bob() .build() .execute_with(|| { // At the beginning, the price is 1:1, so all the released token should be put into // ceiling. - assert_ok!(Bancor::add_token(DOT, 20000)); + run_to_block(10); + assert_ok!(Bancor::add_token(DOT, 20000000000)); + + let mut dot_reserve = Bancor::get_bancor_reserve(DOT).unwrap(); + assert_eq!(dot_reserve, 20000000000); let dot_pool = Bancor::get_bancor_pool(DOT).unwrap(); assert_eq!( @@ -203,43 +218,55 @@ fn add_token_should_work() { currency_id: CurrencyId::Token(TokenSymbol::DOT), token_pool: 0, vstoken_pool: 0, - token_ceiling: 20000, + token_ceiling: 0, token_base_supply: 2 * VSDOT_BASE_SUPPLY, vstoken_base_supply: VSDOT_BASE_SUPPLY } ); + run_to_block(11); + // price is not lower than 75%, so the released DOT will be put into the ceiling variable + dot_reserve = Bancor::get_bancor_reserve(DOT).unwrap(); + assert_eq!(dot_reserve, 19999861112); + + let dot_pool_ceiling = Bancor::get_bancor_pool(DOT).unwrap().token_ceiling; + assert_eq!(dot_pool_ceiling, 138888); + // if someone buys a lot of tokens, the price of token will dramatically increase and - // the price of vstoken will decrease. Here 20_000 vsDOT can only exchange for 14_641 - // DOT. So the price of vstoken is 73.205% of token. If currently some tokens are + // the price of vstoken will decrease. Here 120000 vsDOT can only exchange for 52111 + // DOT. So the price of vstoken is 43.4258% of token. If currently some tokens are // release, half of them will be put in the ceiling variable while the others will used // to buy back vstokens. - let price = Bancor::calculate_price_for_token(DOT, 20000).unwrap(); - assert_ok!(Bancor::exchange_for_token(Origin::signed(ALICE), DOT, 20000, 1)); + let price = Bancor::calculate_price_for_token(DOT, 120000).unwrap(); + + assert_ok!(Bancor::exchange_for_token(Origin::signed(ALICE), DOT, 120000, 1)); let dot_pool = Bancor::get_bancor_pool(DOT).unwrap(); assert_eq!( dot_pool, BancorPool { currency_id: CurrencyId::Token(TokenSymbol::DOT), token_pool: price, - vstoken_pool: 20000, - token_ceiling: 20000 - price, + vstoken_pool: 120000, + token_ceiling: 138888 - price, token_base_supply: 2 * VSDOT_BASE_SUPPLY, vstoken_base_supply: VSDOT_BASE_SUPPLY } ); - // token_ceiling should be 5359 + 50 = 5409, token_pool should be 14641 - 50 = 14591 + // revise the reserve so that 100 DOT can be released for the convinience. + BancorReserve::::insert(DOT, 14400000); + + run_to_block(12); + // half of the released 100 DOT will be put into ceiling, while the other half will be sold within the bancor pool. let price = Bancor::calculate_price_for_vstoken(DOT, 50).unwrap(); - assert_ok!(Bancor::add_token(DOT, 100)); let dot_pool = Bancor::get_bancor_pool(DOT).unwrap(); assert_eq!( dot_pool, BancorPool { currency_id: CurrencyId::Token(TokenSymbol::DOT), - token_pool: 14641 - 50, - vstoken_pool: 20000 - price, - token_ceiling: 5359 + 50, + token_pool: 52111 - 50, + vstoken_pool: 120000 - price, + token_ceiling: 86777 + 50, token_base_supply: 2 * VSDOT_BASE_SUPPLY, vstoken_base_supply: VSDOT_BASE_SUPPLY } diff --git a/pallets/salp/src/mock.rs b/pallets/salp/src/mock.rs index 07105fc7c1..bd5529afbf 100644 --- a/pallets/salp/src/mock.rs +++ b/pallets/salp/src/mock.rs @@ -147,11 +147,13 @@ impl orml_currencies::Config for Test { parameter_types! { pub const InterventionPercentage: Percent = Percent::from_percent(75); + pub const DailyReleasePercentage: Percent = Percent::from_percent(5); } impl bifrost_bancor::Config for Test { type Event = Event; type InterventionPercentage = InterventionPercentage; + type DailyReleasePercentage = DailyReleasePercentage; type MultiCurrency = Tokens; type WeightInfo = (); } diff --git a/runtime/asgard/src/lib.rs b/runtime/asgard/src/lib.rs index 21d1179f19..507d39d4ce 100644 --- a/runtime/asgard/src/lib.rs +++ b/runtime/asgard/src/lib.rs @@ -312,15 +312,15 @@ impl InstanceFilter for ProxyType { ), ProxyType::Governance => matches!( c, - Call::Democracy(..) | - Call::Council(..) | Call::TechnicalCommittee(..) | - Call::Elections(..) | Call::Treasury(..) | - Call::Bounties(..) | Call::Tips(..) | - Call::Utility(..) + Call::Democracy(..) + | Call::Council(..) | Call::TechnicalCommittee(..) + | Call::Elections(..) + | Call::Treasury(..) | Call::Bounties(..) + | Call::Tips(..) | Call::Utility(..) ), ProxyType::CancelProxy => { matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement(..))) - }, + } } } @@ -964,11 +964,13 @@ impl bifrost_salp::Config for Runtime { parameter_types! { pub const InterventionPercentage: Percent = Percent::from_percent(75); + pub const DailyReleasePercentage: Percent = Percent::from_percent(5); } impl bifrost_bancor::Config for Runtime { type Event = Event; type InterventionPercentage = InterventionPercentage; + type DailyReleasePercentage = DailyReleasePercentage; type MultiCurrency = Currencies; type WeightInfo = bifrost_bancor::weights::BifrostWeight; } From 2f87158f3f7fceb0f4c9c2871d393f840c54b1d7 Mon Sep 17 00:00:00 2001 From: herryho Date: Sat, 24 Jul 2021 16:42:02 +0800 Subject: [PATCH 2/3] cargo +nightly fmt --all --- pallets/bancor/src/lib.rs | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/pallets/bancor/src/lib.rs b/pallets/bancor/src/lib.rs index a17a3c0a3a..d7b4f070fe 100644 --- a/pallets/bancor/src/lib.rs +++ b/pallets/bancor/src/lib.rs @@ -143,16 +143,16 @@ pub mod pallet { #[pallet::hooks] impl Hooks for Pallet { - // check whether the price of vstoken (token/vstoken) is lower than 75%. if yes, then half of - // this newly released token should be used to buy vstoken, so that the price of vstoken will - // increase. Meanwhile, the other half will be put on the ceiling variable to indicate exchange - // availability. If not, all the newly release token should be put aside to the ceiling to not - // to impact the pool price. + // check whether the price of vstoken (token/vstoken) is lower than 75%. if yes, then half + // of this newly released token should be used to buy vstoken, so that the price of vstoken + // will increase. Meanwhile, the other half will be put on the ceiling variable to indicate + // exchange availability. If not, all the newly release token should be put aside to the + // ceiling to not to impact the pool price. fn on_initialize(_: T::BlockNumber) -> Weight { // for each bancor pool currency_id, release 5% of reserve tokens to the pool for (currency_id, reserve_amount) in BancorReserve::::iter() { - let token_amount = reserve_amount - / T::DailyReleasePercentage::get() + let token_amount = reserve_amount / + T::DailyReleasePercentage::get() .saturating_reciprocal_mul_floor(BalanceOf::::from(BLOCKS_PER_DAY)); if token_amount > Zero::zero() { @@ -164,8 +164,8 @@ pub mod pallet { let amount_kept: BalanceOf; // if vstoken price is lower than 0.75 token if T::InterventionPercentage::get() - .saturating_reciprocal_mul_floor(nominator) - <= denominator + .saturating_reciprocal_mul_floor(nominator) <= + denominator { amount_kept = token_amount / BalanceOf::::saturated_from(2u128); } else { @@ -192,7 +192,8 @@ pub mod pallet { sell_amount, vstoken_amount, ); - // if somehow not able to sell token, then add the amount to ceiling. + // if somehow not able to sell token, then add the amount to + // ceiling. if let Err(err_msg) = sell_result { match err_msg { Error::::BancorPoolNotExist => (), @@ -203,7 +204,7 @@ pub mod pallet { ) { continue; } - } + }, }; } } @@ -214,7 +215,7 @@ pub mod pallet { match reserve_option { Some(reserve) => { *reserve = reserve.saturating_sub(token_amount); - } + }, _ => (), } }); @@ -466,7 +467,7 @@ impl Pallet { pool_info.token_ceiling = pool_info.token_ceiling.saturating_add(increase_amount); Ok(()) - } + }, _ => Err(Error::::BancorPoolNotExist), } })?; @@ -490,7 +491,7 @@ impl Pallet { pool_info.token_pool = pool_info.token_pool.saturating_sub(token_amount); pool_info.vstoken_pool = pool_info.vstoken_pool.saturating_sub(vstoken_amount); Ok(()) - } + }, _ => Err(Error::::BancorPoolNotExist), } })?; @@ -514,7 +515,7 @@ impl Pallet { pool_info.token_pool = pool_info.token_pool.saturating_add(token_amount); pool_info.vstoken_pool = pool_info.vstoken_pool.saturating_add(vstoken_amount); Ok(()) - } + }, _ => Err(Error::::BancorPoolNotExist), } })?; @@ -533,7 +534,7 @@ impl BancorHandler> for Pallet { Some(reserve) => { *reserve = reserve.saturating_add(token_amount); Ok(()) - } + }, _ => Err(Error::::BancorPoolNotExist), } })?; From 09e3312a90a9b61825f27024900c5806702fc20c Mon Sep 17 00:00:00 2001 From: herryho Date: Sat, 24 Jul 2021 16:44:31 +0800 Subject: [PATCH 3/3] cargo +nightly fmt --all --- pallets/bancor/src/mock.rs | 3 +-- pallets/bancor/src/tests.rs | 6 ++++-- runtime/asgard/src/lib.rs | 12 ++++++------ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pallets/bancor/src/mock.rs b/pallets/bancor/src/mock.rs index 516aadbe67..79bf26159e 100644 --- a/pallets/bancor/src/mock.rs +++ b/pallets/bancor/src/mock.rs @@ -20,8 +20,7 @@ use frame_support::{ construct_runtime, parameter_types, - traits::GenesisBuild, - traits::{OnFinalize, OnInitialize}, + traits::{GenesisBuild, OnFinalize, OnInitialize}, }; pub use node_primitives::{Balance, CurrencyId, TokenSymbol}; use sp_core::H256; diff --git a/pallets/bancor/src/tests.rs b/pallets/bancor/src/tests.rs index 700a4098cf..8bcce6e726 100644 --- a/pallets/bancor/src/tests.rs +++ b/pallets/bancor/src/tests.rs @@ -225,7 +225,8 @@ fn add_token_should_work() { ); run_to_block(11); - // price is not lower than 75%, so the released DOT will be put into the ceiling variable + // price is not lower than 75%, so the released DOT will be put into the ceiling + // variable dot_reserve = Bancor::get_bancor_reserve(DOT).unwrap(); assert_eq!(dot_reserve, 19999861112); @@ -257,7 +258,8 @@ fn add_token_should_work() { BancorReserve::::insert(DOT, 14400000); run_to_block(12); - // half of the released 100 DOT will be put into ceiling, while the other half will be sold within the bancor pool. + // half of the released 100 DOT will be put into ceiling, while the other half will be + // sold within the bancor pool. let price = Bancor::calculate_price_for_vstoken(DOT, 50).unwrap(); let dot_pool = Bancor::get_bancor_pool(DOT).unwrap(); assert_eq!( diff --git a/runtime/asgard/src/lib.rs b/runtime/asgard/src/lib.rs index 507d39d4ce..4b7ce49229 100644 --- a/runtime/asgard/src/lib.rs +++ b/runtime/asgard/src/lib.rs @@ -312,15 +312,15 @@ impl InstanceFilter for ProxyType { ), ProxyType::Governance => matches!( c, - Call::Democracy(..) - | Call::Council(..) | Call::TechnicalCommittee(..) - | Call::Elections(..) - | Call::Treasury(..) | Call::Bounties(..) - | Call::Tips(..) | Call::Utility(..) + Call::Democracy(..) | + Call::Council(..) | Call::TechnicalCommittee(..) | + Call::Elections(..) | Call::Treasury(..) | + Call::Bounties(..) | Call::Tips(..) | + Call::Utility(..) ), ProxyType::CancelProxy => { matches!(c, Call::Proxy(pallet_proxy::Call::reject_announcement(..))) - } + }, } }