Skip to content

Commit

Permalink
remove bancor module from bifrost runtime (#269)
Browse files Browse the repository at this point in the history
* remove bancor module from bifrost runtime

* cargo +nightly fmt --all
  • Loading branch information
herryho committed Sep 4, 2021
1 parent d3138dd commit 463ed25
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 52 deletions.
20 changes: 10 additions & 10 deletions node/service/src/chain_spec/bifrost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ use std::{
};

use bifrost_runtime::{
constants::currency::DOLLARS, AccountId, AuraId, Balance, BalancesConfig, BancorConfig,
BlockNumber, CollatorSelectionConfig, CouncilConfig, DemocracyConfig, GenesisConfig,
IndicesConfig, ParachainInfoConfig, SessionConfig, SudoConfig, SystemConfig,
TechnicalCommitteeConfig, VestingConfig, WASM_BINARY,
constants::currency::DOLLARS, AccountId, AuraId, Balance, BalancesConfig, BlockNumber,
CollatorSelectionConfig, CouncilConfig, DemocracyConfig, GenesisConfig, IndicesConfig,
ParachainInfoConfig, SessionConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig,
VestingConfig, WASM_BINARY,
};
use cumulus_primitives_core::ParaId;
use hex_literal::hex;
Expand Down Expand Up @@ -93,12 +93,12 @@ pub fn bifrost_genesis(
aura_ext: Default::default(),
parachain_system: Default::default(),
vesting: VestingConfig { vesting: vestings },
bancor: BancorConfig {
bancor_pools: vec![
(CurrencyId::Token(TokenSymbol::DOT), 10_000 * DOLLARS),
(CurrencyId::Token(TokenSymbol::KSM), 1_000_000 * DOLLARS),
],
},
// bancor: BancorConfig {
// bancor_pools: vec![
// (CurrencyId::Token(TokenSymbol::DOT), 10_000 * DOLLARS),
// (CurrencyId::Token(TokenSymbol::KSM), 1_000_000 * DOLLARS),
// ],
// },
}
}

Expand Down
84 changes: 42 additions & 42 deletions runtime/bifrost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,18 +992,18 @@ parameter_types! {
// type TransactType = SalpTransactType;
// }

parameter_types! {
pub const InterventionPercentage: Percent = Percent::from_percent(75);
pub const DailyReleasePercentage: Percent = Percent::from_percent(5);
}
// 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 = weights::bifrost_bancor::WeightInfo<Runtime>;
}
// impl bifrost_bancor::Config for Runtime {
// type Event = Event;
// type InterventionPercentage = InterventionPercentage;
// type DailyReleasePercentage = DailyReleasePercentage;
// type MultiCurrency = Currencies;
// type WeightInfo = weights::bifrost_bancor::WeightInfo<Runtime>;
// }

// Bifrost modules end

Expand Down Expand Up @@ -1068,7 +1068,7 @@ construct_runtime! {
// Bifrost modules
FlexibleFee: bifrost_flexible_fee::{Pallet, Call, Storage, Event<T>} = 100,
// Salp: bifrost_salp::{Pallet, Call, Storage, Event<T>} = 105,
Bancor: bifrost_bancor::{Pallet, Call, Storage, Event<T>, Config<T>} = 106,
// Bancor: bifrost_bancor::{Pallet, Call, Storage, Event<T>, Config<T>} = 106,
}
}

Expand Down Expand Up @@ -1235,39 +1235,39 @@ impl_runtime_apis! {
}
}

impl bifrost_bancor_runtime_api::BancorRuntimeApi<Block, CurrencyId, Balance> for Runtime {
fn get_bancor_token_amount_out(token_id: CurrencyId, vstoken_amount: Balance) -> Balance {
let rs = Bancor::calculate_price_for_token(token_id, vstoken_amount);
match rs {
Ok(val) => val,
_ => Zero::zero(),
}
}
// impl bifrost_bancor_runtime_api::BancorRuntimeApi<Block, CurrencyId, Balance> for Runtime {
// fn get_bancor_token_amount_out(token_id: CurrencyId, vstoken_amount: Balance) -> Balance {
// let rs = Bancor::calculate_price_for_token(token_id, vstoken_amount);
// match rs {
// Ok(val) => val,
// _ => Zero::zero(),
// }
// }

fn get_bancor_vstoken_amount_out(token_id: CurrencyId, token_amount: Balance) -> Balance {
let rs = Bancor::calculate_price_for_vstoken(token_id, token_amount);
match rs {
Ok(val) => val,
_ => Zero::zero(),
}
}
// fn get_bancor_vstoken_amount_out(token_id: CurrencyId, token_amount: Balance) -> Balance {
// let rs = Bancor::calculate_price_for_vstoken(token_id, token_amount);
// match rs {
// Ok(val) => val,
// _ => Zero::zero(),
// }
// }

fn get_instant_vstoken_price(currency_id: CurrencyId) -> (Balance, Balance) {
let rs = Bancor::get_instant_vstoken_price(currency_id);
match rs {
Ok((nominator, denominator)) => (nominator, denominator),
_ => (Zero::zero(), Zero::zero()),
}
}
// fn get_instant_vstoken_price(currency_id: CurrencyId) -> (Balance, Balance) {
// let rs = Bancor::get_instant_vstoken_price(currency_id);
// match rs {
// Ok((nominator, denominator)) => (nominator, denominator),
// _ => (Zero::zero(), Zero::zero()),
// }
// }

fn get_instant_token_price(currency_id: CurrencyId) -> (Balance, Balance) {
let rs = Bancor::get_instant_token_price(currency_id);
match rs {
Ok((nominator, denominator)) => (nominator, denominator),
_ => (Zero::zero(), Zero::zero()),
}
}
}
// fn get_instant_token_price(currency_id: CurrencyId) -> (Balance, Balance) {
// let rs = Bancor::get_instant_token_price(currency_id);
// match rs {
// Ok((nominator, denominator)) => (nominator, denominator),
// _ => (Zero::zero(), Zero::zero()),
// }
// }
// }

// impl bifrost_salp_rpc_runtime_api::SalpRuntimeApi<Block, ParaId, AccountId,Balance> for Runtime {
// fn get_contribution(index: ParaId, who: AccountId) -> Balance {
Expand Down

0 comments on commit 463ed25

Please sign in to comment.