diff --git a/Cargo.lock b/Cargo.lock index 61a876c7db..7497ae4eda 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -173,7 +173,6 @@ dependencies = [ "bifrost-runtime-common", "bifrost-salp", "bifrost-salp-lite", - "bifrost-salp-lite-rpc-runtime-api", "bifrost-salp-rpc-runtime-api", "bifrost-token-issuer", "bifrost-vesting", @@ -858,7 +857,6 @@ dependencies = [ "bifrost-runtime-common", "bifrost-salp", "bifrost-salp-lite", - "bifrost-salp-lite-rpc-runtime-api", "bifrost-salp-rpc-runtime-api", "bifrost-token-issuer", "bifrost-vesting", @@ -1052,33 +1050,6 @@ dependencies = [ "sp-std", ] -[[package]] -name = "bifrost-salp-lite-rpc-api" -version = "0.8.0" -dependencies = [ - "bifrost-salp-lite-rpc-runtime-api", - "jsonrpc-core", - "jsonrpc-core-client", - "jsonrpc-derive", - "node-primitives", - "parity-scale-codec", - "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", -] - -[[package]] -name = "bifrost-salp-lite-rpc-runtime-api" -version = "0.8.0" -dependencies = [ - "node-primitives", - "parity-scale-codec", - "sp-api", -] - [[package]] name = "bifrost-salp-rpc-api" version = "0.8.0" @@ -5088,8 +5059,6 @@ dependencies = [ "bifrost-flexible-fee-rpc-runtime-api", "bifrost-liquidity-mining-rpc-api", "bifrost-liquidity-mining-rpc-runtime-api", - "bifrost-salp-lite-rpc-api", - "bifrost-salp-lite-rpc-runtime-api", "bifrost-salp-rpc-api", "bifrost-salp-rpc-runtime-api", "jsonrpc-core", @@ -5118,7 +5087,6 @@ dependencies = [ "bifrost-liquidity-mining-rpc-runtime-api", "bifrost-runtime", "bifrost-runtime-common", - "bifrost-salp-lite-rpc-runtime-api", "bifrost-salp-rpc-runtime-api", "bs58 0.3.1", "cumulus-client-consensus-aura", diff --git a/node/rpc/Cargo.toml b/node/rpc/Cargo.toml index 371a8cc4b5..193e9cbc83 100644 --- a/node/rpc/Cargo.toml +++ b/node/rpc/Cargo.toml @@ -23,8 +23,6 @@ bifrost-flexible-fee-rpc = { path = "../../pallets/flexible-fee/rpc" } bifrost-flexible-fee-rpc-runtime-api = { path = "../../pallets/flexible-fee/rpc/runtime-api" } bifrost-salp-rpc-api = { path = "../../pallets/salp/rpc" } bifrost-salp-rpc-runtime-api = { path = "../../pallets/salp/rpc/runtime-api" } -bifrost-salp-lite-rpc-api = { path = "../../pallets/salp-lite/rpc" } -bifrost-salp-lite-rpc-runtime-api = { path = "../../pallets/salp-lite/rpc/runtime-api" } bifrost-liquidity-mining-rpc-api = { path = "../../pallets/liquidity-mining/rpc" } bifrost-liquidity-mining-rpc-runtime-api = { path = "../../pallets/liquidity-mining/rpc/runtime-api" } zenlink-protocol-rpc = "*" diff --git a/node/rpc/src/lib.rs b/node/rpc/src/lib.rs index 240722f9cb..57f77a270b 100644 --- a/node/rpc/src/lib.rs +++ b/node/rpc/src/lib.rs @@ -37,8 +37,6 @@ use bifrost_flexible_fee_rpc::{FeeRpcApi, FlexibleFeeStruct}; use bifrost_flexible_fee_rpc_runtime_api::FlexibleFeeRuntimeApi as FeeRuntimeApi; use bifrost_liquidity_mining_rpc_api::{LiquidityMiningRpcApi, LiquidityMiningRpcWrapper}; use bifrost_liquidity_mining_rpc_runtime_api::LiquidityMiningRuntimeApi; -use bifrost_salp_lite_rpc_api::{SalpLiteRpcApi, SalpLiteRpcWrapper}; -use bifrost_salp_lite_rpc_runtime_api::SalpLiteRuntimeApi; use bifrost_salp_rpc_api::{SalpRpcApi, SalpRpcWrapper}; use bifrost_salp_rpc_runtime_api::SalpRuntimeApi; use node_primitives::{AccountId, Balance, Block, Nonce, ParaId, PoolId}; @@ -79,7 +77,6 @@ where C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: FeeRuntimeApi, C::Api: SalpRuntimeApi, - C::Api: SalpLiteRuntimeApi, C::Api: LiquidityMiningRuntimeApi, C::Api: ZenlinkProtocolRuntimeApi, C::Api: BlockBuilder, @@ -95,8 +92,6 @@ where io.extend_with(SalpRpcApi::to_delegate(SalpRpcWrapper::new(client.clone()))); - io.extend_with(SalpLiteRpcApi::to_delegate(SalpLiteRpcWrapper::new(client.clone()))); - io.extend_with(LiquidityMiningRpcApi::to_delegate(LiquidityMiningRpcWrapper::new( client.clone(), ))); @@ -119,7 +114,6 @@ where C::Api: substrate_frame_rpc_system::AccountNonceApi, C::Api: FeeRuntimeApi, C::Api: SalpRuntimeApi, - C::Api: SalpLiteRuntimeApi, C::Api: LiquidityMiningRuntimeApi, C::Api: ZenlinkProtocolRuntimeApi, C::Api: BlockBuilder, @@ -135,8 +129,6 @@ where io.extend_with(SalpRpcApi::to_delegate(SalpRpcWrapper::new(client.clone()))); - io.extend_with(SalpLiteRpcApi::to_delegate(SalpLiteRpcWrapper::new(client.clone()))); - io.extend_with(LiquidityMiningRpcApi::to_delegate(LiquidityMiningRpcWrapper::new( client.clone(), ))); diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 9dd2068dee..3916536057 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -90,7 +90,6 @@ zenlink-protocol-runtime-api = "*" # Bifrost rpc bifrost-flexible-fee-rpc-runtime-api = { path = "../../pallets/flexible-fee/rpc/runtime-api" } bifrost-salp-rpc-runtime-api = { path = "../../pallets/salp/rpc/runtime-api" } -bifrost-salp-lite-rpc-runtime-api = { path = "../../pallets/salp-lite/rpc/runtime-api" } bifrost-liquidity-mining-rpc-runtime-api = { path = "../../pallets/liquidity-mining/rpc/runtime-api" } [features] diff --git a/node/service/src/client.rs b/node/service/src/client.rs index f38a4d2821..4600164685 100644 --- a/node/service/src/client.rs +++ b/node/service/src/client.rs @@ -50,7 +50,6 @@ pub trait RuntimeApiCollection: + bifrost_flexible_fee_rpc_runtime_api::FlexibleFeeRuntimeApi + bifrost_liquidity_mining_rpc_runtime_api::LiquidityMiningRuntimeApi + bifrost_salp_rpc_runtime_api::SalpRuntimeApi - + bifrost_salp_lite_rpc_runtime_api::SalpLiteRuntimeApi + zenlink_protocol_runtime_api::ZenlinkProtocolApi where >::StateBackend: sp_api::StateBackend, @@ -75,7 +74,6 @@ where AccountId, PoolId, > + bifrost_salp_rpc_runtime_api::SalpRuntimeApi - + bifrost_salp_lite_rpc_runtime_api::SalpLiteRuntimeApi + zenlink_protocol_runtime_api::ZenlinkProtocolApi, >::StateBackend: sp_api::StateBackend, { diff --git a/pallets/salp-lite/rpc/Cargo.toml b/pallets/salp-lite/rpc/Cargo.toml deleted file mode 100644 index e404188ed4..0000000000 --- a/pallets/salp-lite/rpc/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "bifrost-salp-lite-rpc-api" -version = "0.8.0" -authors = ["Ron Yang "] -edition = "2018" - -[dependencies] -serde = { version = "1.0.124", features = ["derive"] } -codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = ["derive"] } -jsonrpc-core = "18.0.0" -jsonrpc-core-client = "18.0.0" -jsonrpc-derive = "18.0.0" -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.12" } -sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.12" } -sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.12" } -sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.12" } -sp-rpc = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.12" } -node-primitives = { path = "../../../node/primitives", default-features = false } -bifrost-salp-lite-rpc-runtime-api = { path = "./runtime-api" } diff --git a/pallets/salp-lite/rpc/runtime-api/Cargo.toml b/pallets/salp-lite/rpc/runtime-api/Cargo.toml deleted file mode 100644 index 72b3033052..0000000000 --- a/pallets/salp-lite/rpc/runtime-api/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "bifrost-salp-lite-rpc-runtime-api" -version = "0.8.0" -authors = ["Ron Yang"] -edition = "2018" - -[dependencies] -codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = ["derive"] } -sp-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.12", default-features = false } -node-primitives = { path = "../../../../node/primitives", default-features = false } - -[features] -default = ["std"] -std = [ - "codec/std", - "sp-api/std", - "node-primitives/std", -] diff --git a/pallets/salp-lite/rpc/runtime-api/src/lib.rs b/pallets/salp-lite/rpc/runtime-api/src/lib.rs deleted file mode 100644 index ebcf15638f..0000000000 --- a/pallets/salp-lite/rpc/runtime-api/src/lib.rs +++ /dev/null @@ -1,35 +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 . - -#![cfg_attr(not(feature = "std"), no_std)] - -use codec::Codec; -use node_primitives::{Balance, RpcContributionStatus}; -use sp_api::decl_runtime_apis; - -decl_runtime_apis! { - pub trait SalpLiteRuntimeApi where - ParaId: Codec, - AccountId: Codec, - { - fn get_contribution( - index: ParaId, - who: AccountId - ) -> (Balance,RpcContributionStatus); - } -} diff --git a/pallets/salp-lite/rpc/src/lib.rs b/pallets/salp-lite/rpc/src/lib.rs deleted file mode 100644 index e66fd59f42..0000000000 --- a/pallets/salp-lite/rpc/src/lib.rs +++ /dev/null @@ -1,86 +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 . - -use std::{marker::PhantomData, sync::Arc}; - -pub use bifrost_salp_lite_rpc_runtime_api::{self as runtime_api, SalpLiteRuntimeApi}; -use codec::Codec; -use jsonrpc_core::{Error as RpcError, ErrorCode, Result as JsonRpcResult}; -use jsonrpc_derive::rpc; -use node_primitives::RpcContributionStatus; -use sp_api::ProvideRuntimeApi; -use sp_blockchain::HeaderBackend; -use sp_rpc::number::NumberOrHex; -use sp_runtime::{generic::BlockId, traits::Block as BlockT}; - -pub use self::gen_client::Client as SalpClient; - -#[derive(Clone, Debug)] -pub struct SalpLiteRpcWrapper { - client: Arc, - _marker: PhantomData, -} - -impl SalpLiteRpcWrapper { - pub fn new(client: Arc) -> Self { - Self { client, _marker: PhantomData } - } -} - -#[rpc] -pub trait SalpLiteRpcApi { - /// rpc method for getting current contribution - #[rpc(name = "salplite_getContribution")] - fn get_contribution( - &self, - index: ParaId, - who: AccountId, - at: Option, - ) -> JsonRpcResult<(NumberOrHex, RpcContributionStatus)>; -} - -impl SalpLiteRpcApi<::Hash, ParaId, AccountId> - for SalpLiteRpcWrapper -where - Block: BlockT, - C: Send + Sync + 'static + ProvideRuntimeApi + HeaderBackend, - C::Api: SalpLiteRuntimeApi, - ParaId: Codec, - AccountId: Codec, -{ - fn get_contribution( - &self, - index: ParaId, - account: AccountId, - at: Option<::Hash>, - ) -> JsonRpcResult<(NumberOrHex, RpcContributionStatus)> { - let salp_rpc_api = self.client.runtime_api(); - let at = BlockId::::hash(at.unwrap_or_else(|| self.client.info().best_hash)); - - let rs = salp_rpc_api.get_contribution(&at, index, account); - - match rs { - Ok((val, status)) => Ok((NumberOrHex::Hex(val.into()), status)), - Err(e) => Err(RpcError { - code: ErrorCode::InternalError, - message: "Failed to get salp contribution.".to_owned(), - data: Some(format!("{:?}", e).into()), - }), - } - } -} diff --git a/pallets/salp-lite/src/benchmarking.rs b/pallets/salp-lite/src/benchmarking.rs index a84784e4ea..bc2663b1bf 100644 --- a/pallets/salp-lite/src/benchmarking.rs +++ b/pallets/salp-lite/src/benchmarking.rs @@ -72,38 +72,6 @@ benchmarks! { assert_last_event::(Event::::Refunded(caller.clone(), fund_index, contribution).into()) } - unlock { - let fund_index = create_fund::(1); - let caller: T::AccountId = whitelisted_caller(); - let caller_origin: T::Origin = RawOrigin::Signed(caller.clone()).into(); - let contribution = T::MinContribution::get(); - contribute_fund::(&caller,fund_index); - assert_ok!(Salp::::fund_success(RawOrigin::Root.into(), fund_index)); - }: _(RawOrigin::Root, caller.clone(),fund_index) - verify { - let fund = Salp::::funds(fund_index).unwrap(); - let (_, status) = Salp::::contribution(fund.trie_index, &caller); - assert_eq!(status, ContributionStatus::Unlocked); - } - - batch_unlock { - let k in 1 .. T::BatchKeysLimit::get(); - let fund_index = create_fund::(1); - let contribution = T::MinContribution::get(); - let mut caller: T::AccountId = whitelisted_caller(); - for i in 0 .. k { - caller = account("contributor", i, 0); - contribute_fund::(&caller,fund_index); - } - assert_ok!(Salp::::fund_success(RawOrigin::Root.into(), fund_index)); - }: _(RawOrigin::Signed(caller.clone()), fund_index) - verify { - let fund = Salp::::funds(fund_index).unwrap(); - let (_, status) = Salp::::contribution(fund.trie_index, &caller); - assert_eq!(status, ContributionStatus::Unlocked); - assert_last_event::(Event::::AllUnlocked(fund_index).into()); - } - redeem { let fund_index = create_fund::(1); let caller: T::AccountId = whitelisted_caller(); diff --git a/pallets/salp-lite/src/lib.rs b/pallets/salp-lite/src/lib.rs index f9dfcd02c0..eb90da5d4d 100644 --- a/pallets/salp-lite/src/lib.rs +++ b/pallets/salp-lite/src/lib.rs @@ -19,12 +19,6 @@ // Ensure we're `no_std` when compiling for Wasm. #![cfg_attr(not(feature = "std"), no_std)] -pub mod migration { - pub fn migrate() { - log::info!("salp migration..."); - } -} - #[cfg(feature = "runtime-benchmarks")] pub mod benchmarking; #[cfg(test)] @@ -106,7 +100,7 @@ pub mod pallet { use super::*; #[pallet::config] - pub trait Config: frame_system::Config + TypeInfo { + pub trait Config: frame_system::Config { type Event: From> + IsType<::Event>; /// ModuleID for the crowdloan module. An appropriate value could be @@ -382,7 +376,7 @@ pub mod pallet { } /// Unlock the reserved vsToken/vsBond after fund success - #[pallet::weight(T::WeightInfo::batch_unlock(T::BatchKeysLimit::get()))] + #[pallet::weight(T::WeightInfo::batch_migrate(T::BatchKeysLimit::get()))] #[transactional] pub fn batch_migrate( origin: OriginFor, @@ -807,19 +801,14 @@ pub mod pallet { } pub trait WeightInfo { - fn unlock() -> Weight; - fn batch_unlock(k: u32) -> Weight; + fn batch_migrate(k: u32) -> Weight; fn refund() -> Weight; fn redeem() -> Weight; } // For backwards compatibility and tests impl WeightInfo for () { - fn unlock() -> Weight { - 50_000_000 as Weight - } - - fn batch_unlock(_k: u32) -> Weight { + fn batch_migrate(_k: u32) -> Weight { 50_000_000 as Weight } diff --git a/pallets/salp-lite/src/mock.rs b/pallets/salp-lite/src/mock.rs index e7dae24376..7a7dbc65d7 100644 --- a/pallets/salp-lite/src/mock.rs +++ b/pallets/salp-lite/src/mock.rs @@ -247,10 +247,6 @@ impl salp::Config for Test { pub struct SalpWeightInfo; impl WeightInfo for SalpWeightInfo { - fn unlock() -> Weight { - 0 - } - fn redeem() -> Weight { 0 } @@ -259,7 +255,7 @@ impl WeightInfo for SalpWeightInfo { 0 } - fn batch_unlock(_k: u32) -> Weight { + fn batch_migrate(_k: u32) -> Weight { 0 } } diff --git a/pallets/salp/rpc/runtime-api/src/lib.rs b/pallets/salp/rpc/runtime-api/src/lib.rs index 1ff6fe7807..a8a2f4f0bc 100644 --- a/pallets/salp/rpc/runtime-api/src/lib.rs +++ b/pallets/salp/rpc/runtime-api/src/lib.rs @@ -31,5 +31,10 @@ decl_runtime_apis! { index: ParaId, who: AccountId ) -> (Balance,RpcContributionStatus); + + fn get_lite_contribution( + index: ParaId, + who: AccountId + ) -> (Balance,RpcContributionStatus); } } diff --git a/pallets/salp/rpc/src/lib.rs b/pallets/salp/rpc/src/lib.rs index b9d441f906..8810e5d3dc 100644 --- a/pallets/salp/rpc/src/lib.rs +++ b/pallets/salp/rpc/src/lib.rs @@ -22,11 +22,11 @@ pub use bifrost_salp_rpc_runtime_api::{self as runtime_api, SalpRuntimeApi}; use codec::Codec; use jsonrpc_core::{Error as RpcError, ErrorCode, Result as JsonRpcResult}; use jsonrpc_derive::rpc; -use node_primitives::RpcContributionStatus; +use node_primitives::{Balance, RpcContributionStatus}; use sp_api::ProvideRuntimeApi; use sp_blockchain::HeaderBackend; use sp_rpc::number::NumberOrHex; -use sp_runtime::{generic::BlockId, traits::Block as BlockT}; +use sp_runtime::{generic::BlockId, sp_std::convert::TryInto, traits::Block as BlockT}; pub use self::gen_client::Client as SalpClient; @@ -52,6 +52,16 @@ pub trait SalpRpcApi { who: AccountId, at: Option, ) -> JsonRpcResult<(NumberOrHex, RpcContributionStatus)>; + + #[rpc(name = "salp_getLiteContribution")] + fn get_lite_contribution( + &self, + index: ParaId, + who: AccountId, + at: Option, + ) -> JsonRpcResult<(NumberOrHex, RpcContributionStatus)>; + + fn convert_rpc_params(val: Balance) -> Result; } impl SalpRpcApi<::Hash, ParaId, AccountId> @@ -63,6 +73,13 @@ where ParaId: Codec, AccountId: Codec, { + fn convert_rpc_params(value: Balance) -> Result { + value.try_into().map_err(|_| RpcError { + code: ErrorCode::InvalidParams, + message: format!("{} doesn't fit in NumberOrHex representation", value), + data: None, + }) + } fn get_contribution( &self, index: ParaId, @@ -75,7 +92,34 @@ where let rs = salp_rpc_api.get_contribution(&at, index, account); match rs { - Ok((val, status)) => Ok((NumberOrHex::Hex(val.into()), status)), + Ok((val, status)) => match Self::convert_rpc_params(val) { + Ok(value) => Ok((value, status)), + Err(e) => Err(e), + }, + Err(e) => Err(RpcError { + code: ErrorCode::InternalError, + message: "Failed to get salp contribution.".to_owned(), + data: Some(format!("{:?}", e).into()), + }), + } + } + + fn get_lite_contribution( + &self, + index: ParaId, + account: AccountId, + at: Option<::Hash>, + ) -> JsonRpcResult<(NumberOrHex, RpcContributionStatus)> { + let salp_rpc_api = self.client.runtime_api(); + let at = BlockId::::hash(at.unwrap_or_else(|| self.client.info().best_hash)); + + let rs = salp_rpc_api.get_lite_contribution(&at, index, account); + + match rs { + Ok((val, status)) => match Self::convert_rpc_params(val) { + Ok(value) => Ok((value, status)), + Err(e) => Err(e), + }, Err(e) => Err(RpcError { code: ErrorCode::InternalError, message: "Failed to get salp contribution.".to_owned(), diff --git a/runtime/asgard/Cargo.toml b/runtime/asgard/Cargo.toml index 6bef22fb73..89eff95a14 100644 --- a/runtime/asgard/Cargo.toml +++ b/runtime/asgard/Cargo.toml @@ -94,7 +94,6 @@ bifrost-runtime-common = { package = "bifrost-runtime-common", path = "../common bifrost-salp = { path = "../../pallets/salp", default-features = false } bifrost-salp-rpc-runtime-api = { path = "../../pallets/salp/rpc/runtime-api", default-features = false } bifrost-salp-lite = { path = "../../pallets/salp-lite", default-features = false } -bifrost-salp-lite-rpc-runtime-api = { path = "../../pallets/salp-lite/rpc/runtime-api", default-features = false } bifrost-liquidity-mining-rpc-runtime-api = { path = "../../pallets/liquidity-mining/rpc/runtime-api", default-features = false } bifrost-vsbond-auction = { path = "../../pallets/vsbond-auction", default-features = false } bifrost-vtoken-mint = { path = "../../pallets/vtoken-mint", default-features = false } @@ -191,7 +190,6 @@ std = [ "bifrost-salp/std", "bifrost-salp-rpc-runtime-api/std", "bifrost-salp-lite/std", - "bifrost-salp-lite-rpc-runtime-api/std", "bifrost-vsbond-auction/std", "bifrost-vtoken-mint/std", "bifrost-liquidity-mining/std", diff --git a/runtime/asgard/src/lib.rs b/runtime/asgard/src/lib.rs index 305eb40590..9e76efe41e 100644 --- a/runtime/asgard/src/lib.rs +++ b/runtime/asgard/src/lib.rs @@ -1903,10 +1903,8 @@ impl_runtime_apis! { _ => (Zero::zero(),RpcContributionStatus::Idle), } } - } - impl bifrost_salp_lite_rpc_runtime_api::SalpLiteRuntimeApi for Runtime { - fn get_contribution(index: ParaId, who: AccountId) -> (Balance,RpcContributionStatus) { + fn get_lite_contribution(index: ParaId, who: AccountId) -> (Balance,RpcContributionStatus) { let rs = SalpLite::contribution_by_fund(index, &who); match rs { Ok((val,status)) => (val,status.to_rpc()), diff --git a/runtime/asgard/src/weights/bifrost_salp_lite.rs b/runtime/asgard/src/weights/bifrost_salp_lite.rs index 9a1db00d87..7414b44019 100644 --- a/runtime/asgard/src/weights/bifrost_salp_lite.rs +++ b/runtime/asgard/src/weights/bifrost_salp_lite.rs @@ -60,18 +60,7 @@ impl bifrost_salp_lite::WeightInfo for WeightInfo { .saturating_add(T::DbWeight::get().reads(10 as Weight)) .saturating_add(T::DbWeight::get().writes(7 as Weight)) } - // Storage: SalpLite Funds (r:1 w:0) - // Storage: Tokens Accounts (r:2 w:2) - // Storage: System Number (r:1 w:0) - // Storage: System ExecutionPhase (r:1 w:0) - // Storage: System EventCount (r:1 w:1) - // Storage: System Events (r:1 w:1) - // Storage: unknown [0xd861ea1ebf4800d4b89f4ff787ad79ee96d9a708c85b57da7eb8f9ddeda61291] (r:1 w:1) - fn unlock() -> Weight { - (128_872_000 as Weight) - .saturating_add(T::DbWeight::get().reads(8 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) - } + // Storage: SalpLite Funds (r:1 w:0) // Storage: Tokens Accounts (r:2 w:2) // Storage: System Account (r:1 w:1) @@ -576,7 +565,7 @@ impl bifrost_salp_lite::WeightInfo for WeightInfo { // Storage: unknown [0xd35ed52d5edd31264c21a0c30d3994d5600b3e19ebb66d6f8099661d6dcc57c0] (r:1 w:1) // Storage: unknown [0xf5b993b187b5029b7a30de61f1bce1be780f8790b3daf85742ec63b66f79cc80] (r:1 w:1) // Storage: unknown [0xf98428e38450dcc80131bed1b84059f80938df6d2941d17917c968e553afa753] (r:1 w:1) - fn batch_unlock(k: u32, ) -> Weight { + fn batch_migrate(k: u32, ) -> Weight { (0 as Weight) // Standard Error: 53_000 .saturating_add((107_557_000 as Weight).saturating_mul(k as Weight)) diff --git a/runtime/bifrost/Cargo.toml b/runtime/bifrost/Cargo.toml index 2b1727fa3d..2ca603b3b9 100644 --- a/runtime/bifrost/Cargo.toml +++ b/runtime/bifrost/Cargo.toml @@ -89,7 +89,6 @@ bifrost-runtime-common = { package = "bifrost-runtime-common", path = "../common bifrost-salp = { path = "../../pallets/salp", default-features = false } bifrost-salp-rpc-runtime-api = { path = "../../pallets/salp/rpc/runtime-api", default-features = false } bifrost-salp-lite = { path = "../../pallets/salp-lite", default-features = false } -bifrost-salp-lite-rpc-runtime-api = { path = "../../pallets/salp-lite/rpc/runtime-api", default-features = false } pallet-vesting = { package = "bifrost-vesting", path = "../../pallets/vesting", default-features = false } bifrost-liquidity-mining = { path = "../../pallets/liquidity-mining", default-features = false } bifrost-liquidity-mining-rpc-runtime-api = { path = "../../pallets/liquidity-mining/rpc/runtime-api", default-features = false } @@ -180,7 +179,6 @@ std = [ "bifrost-salp/std", "bifrost-salp-rpc-runtime-api/std", "bifrost-salp-lite/std", - "bifrost-salp-lite-rpc-runtime-api/std", "bifrost-liquidity-mining/std", "bifrost-liquidity-mining-rpc-runtime-api/std", "bifrost-token-issuer/std", diff --git a/runtime/bifrost/src/lib.rs b/runtime/bifrost/src/lib.rs index 3ffc837083..5b1fce9b40 100644 --- a/runtime/bifrost/src/lib.rs +++ b/runtime/bifrost/src/lib.rs @@ -1838,10 +1838,8 @@ impl_runtime_apis! { _ => (Zero::zero(),RpcContributionStatus::Idle), } } - } - impl bifrost_salp_lite_rpc_runtime_api::SalpLiteRuntimeApi for Runtime { - fn get_contribution(index: ParaId, who: AccountId) -> (Balance,RpcContributionStatus) { + fn get_lite_contribution(index: ParaId, who: AccountId) -> (Balance,RpcContributionStatus) { let rs = SalpLite::contribution_by_fund(index, &who); match rs { Ok((val,status)) => (val,status.to_rpc()), diff --git a/runtime/bifrost/src/weights/bifrost_salp_lite.rs b/runtime/bifrost/src/weights/bifrost_salp_lite.rs index 5756e80c5b..6a51f65e30 100644 --- a/runtime/bifrost/src/weights/bifrost_salp_lite.rs +++ b/runtime/bifrost/src/weights/bifrost_salp_lite.rs @@ -62,18 +62,6 @@ impl bifrost_salp_lite::WeightInfo for WeightInfo { } // Storage: SalpLite Funds (r:1 w:0) // Storage: Tokens Accounts (r:2 w:2) - // Storage: System Number (r:1 w:0) - // Storage: System ExecutionPhase (r:1 w:0) - // Storage: System EventCount (r:1 w:1) - // Storage: System Events (r:1 w:1) - // Storage: unknown [0xd861ea1ebf4800d4b89f4ff787ad79ee96d9a708c85b57da7eb8f9ddeda61291] (r:1 w:1) - fn unlock() -> Weight { - (128_872_000 as Weight) - .saturating_add(T::DbWeight::get().reads(8 as Weight)) - .saturating_add(T::DbWeight::get().writes(5 as Weight)) - } - // Storage: SalpLite Funds (r:1 w:0) - // Storage: Tokens Accounts (r:2 w:2) // Storage: System Account (r:1 w:1) // Storage: System Number (r:1 w:0) // Storage: System ExecutionPhase (r:1 w:0) @@ -576,7 +564,7 @@ impl bifrost_salp_lite::WeightInfo for WeightInfo { // Storage: unknown [0xd35ed52d5edd31264c21a0c30d3994d5600b3e19ebb66d6f8099661d6dcc57c0] (r:1 w:1) // Storage: unknown [0xf5b993b187b5029b7a30de61f1bce1be780f8790b3daf85742ec63b66f79cc80] (r:1 w:1) // Storage: unknown [0xf98428e38450dcc80131bed1b84059f80938df6d2941d17917c968e553afa753] (r:1 w:1) - fn batch_unlock(k: u32, ) -> Weight { + fn batch_migrate(k: u32, ) -> Weight { (0 as Weight) // Standard Error: 53_000 .saturating_add((107_557_000 as Weight).saturating_mul(k as Weight))