diff --git a/Cargo.lock b/Cargo.lock index a5df9b2d05..4379218996 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -784,8 +784,6 @@ dependencies = [ name = "bifrost-runtime" version = "0.8.0" dependencies = [ - "bifrost-bancor", - "bifrost-bancor-runtime-api", "bifrost-flexible-fee", "bifrost-flexible-fee-rpc-runtime-api", "bifrost-runtime-common", diff --git a/node/service/src/chain_spec/bifrost.rs b/node/service/src/chain_spec/bifrost.rs index 6dde6619ca..4d85b235ef 100644 --- a/node/service/src/chain_spec/bifrost.rs +++ b/node/service/src/chain_spec/bifrost.rs @@ -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, TokensConfig, VestingConfig, WASM_BINARY, + constants::currency::DOLLARS, AccountId, AuraId, Balance, BalancesConfig, BlockNumber, + CollatorSelectionConfig, CouncilConfig, DemocracyConfig, GenesisConfig, IndicesConfig, + ParachainInfoConfig, SessionConfig, SudoConfig, SystemConfig, TechnicalCommitteeConfig, + TokensConfig, VestingConfig, WASM_BINARY, }; use cumulus_primitives_core::ParaId; use frame_benchmarking::{account, whitelisted_caller}; @@ -98,9 +98,6 @@ pub fn bifrost_genesis( parachain_system: Default::default(), vesting: VestingConfig { vesting: vestings }, tokens: TokensConfig { balances: tokens }, - bancor: BancorConfig { - bancor_pools: vec![(CurrencyId::Token(TokenSymbol::KSM), 1_000_000 * DOLLARS)], - }, } } diff --git a/runtime/bifrost/Cargo.toml b/runtime/bifrost/Cargo.toml index a9e14e78ff..5d6a64a428 100644 --- a/runtime/bifrost/Cargo.toml +++ b/runtime/bifrost/Cargo.toml @@ -80,8 +80,6 @@ xcm-builder = { git = "https://github.com/paritytech/polkadot", branch = "releas xcm-executor = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.9", default-features = false } # Bifrost -bifrost-bancor = { path = "../../pallets/bancor", default-features = false } -bifrost-bancor-runtime-api = { path = "../../pallets/bancor/rpc/runtime-api", default-features = false } bifrost-flexible-fee = { path = "../../pallets/flexible-fee", default-features = false } bifrost-flexible-fee-rpc-runtime-api = { path = "../../pallets/flexible-fee/rpc/runtime-api", default-features = false } bifrost-runtime-common = { package = "bifrost-runtime-common", path = "../common", default-features = false } @@ -163,8 +161,6 @@ std = [ "bifrost-runtime-common/std", "bifrost-flexible-fee/std", "bifrost-flexible-fee-rpc-runtime-api/std", - "bifrost-bancor/std", - "bifrost-bancor-runtime-api/std", "bifrost-salp/std", "bifrost-salp-rpc-runtime-api/std", ] @@ -189,7 +185,6 @@ runtime-benchmarks = [ "xcm-builder/runtime-benchmarks", "bifrost-flexible-fee/runtime-benchmarks", "bifrost-salp/runtime-benchmarks", - "bifrost-bancor/runtime-benchmarks", ] try-runtime = [ diff --git a/runtime/bifrost/src/lib.rs b/runtime/bifrost/src/lib.rs index 123bdfa560..b62fdee06e 100644 --- a/runtime/bifrost/src/lib.rs +++ b/runtime/bifrost/src/lib.rs @@ -1013,7 +1013,7 @@ parameter_types! { } impl bifrost_salp::Config for Runtime { - type BancorPool = Bancor; + type BancorPool = (); type BifrostXcmExecutor = BifrostXcmAdaptor; type Event = Event; type LeasePeriod = LeasePeriod; @@ -1042,19 +1042,6 @@ impl bifrost_salp::Config for Runtime { type TransactType = SalpTransactType; } -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; -} - // Bifrost modules end construct_runtime! { @@ -1119,7 +1106,6 @@ construct_runtime! { // Bifrost modules FlexibleFee: bifrost_flexible_fee::{Pallet, Call, Storage, Event} = 100, Salp: bifrost_salp::{Pallet, Call, Storage, Event} = 105, - Bancor: bifrost_bancor::{Pallet, Call, Storage, Event, Config} = 106, } } @@ -1286,40 +1272,6 @@ impl_runtime_apis! { } } - impl bifrost_bancor_runtime_api::BancorRuntimeApi 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_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()), - } - } - } - impl bifrost_salp_rpc_runtime_api::SalpRuntimeApi for Runtime { fn get_contribution(index: ParaId, who: AccountId) -> (Balance,RpcContributionStatus) { let rs = Salp::contribution_by_fund(index, &who); @@ -1341,7 +1293,6 @@ impl_runtime_apis! { let mut list = Vec::::new(); - list_benchmark!(list, extra, bifrost_bancor, Bancor); list_benchmark!(list, extra, bifrost_flexible_fee, FlexibleFee); list_benchmark!(list, extra, bifrost_salp, Salp); diff --git a/runtime/bifrost/src/weights/bifrost_bancor.rs b/runtime/bifrost/src/weights/bifrost_bancor.rs deleted file mode 100644 index a038cea54e..0000000000 --- a/runtime/bifrost/src/weights/bifrost_bancor.rs +++ /dev/null @@ -1,66 +0,0 @@ -// This file is part of Bifrost. - -// Copyright (C) 2019-2021 Liebi Technologies (UK) Ltd. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Autogenerated weights for bifrost_bancor -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 -//! DATE: 2021-08-11, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("asgard-local"), DB CACHE: 128 - -// Executed Command: -// target/release/bifrost -// benchmark -// --chain=asgard-local -// --steps=50 -// --repeat=20 -// --pallet=bifrost_bancor -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --header=./HEADER-GPL3 -// --output=./runtime/asgard/src/weights/bifrost_bancor.rs - -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for bifrost_bancor. -pub struct WeightInfo(PhantomData); -impl bifrost_bancor::WeightInfo for WeightInfo { - fn add_token_to_pool() -> Weight { - (64_271_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn exchange_for_token() -> Weight { - (91_953_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn exchange_for_vstoken() -> Weight { - (79_409_000 as Weight) - .saturating_add(T::DbWeight::get().reads(3 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn on_initialize() -> Weight { - (21_690_000 as Weight).saturating_add(T::DbWeight::get().reads(3 as Weight)) - } -} diff --git a/runtime/bifrost/src/weights/mod.rs b/runtime/bifrost/src/weights/mod.rs index 5d2799f4bc..d86013d5af 100644 --- a/runtime/bifrost/src/weights/mod.rs +++ b/runtime/bifrost/src/weights/mod.rs @@ -20,7 +20,6 @@ //! A list of the different weight modules for our runtime. -pub mod bifrost_bancor; pub mod bifrost_flexible_fee; pub mod bifrost_salp; pub mod frame_system;