From f6962255f94e23f71cf5da699714036cd1676e27 Mon Sep 17 00:00:00 2001 From: SunTiebing <87381708+SunTiebing@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:37:28 +0800 Subject: [PATCH] Feat/vtoken voting add vbnc (#1510) * Fix the bug related to the missing Ledger type. * Remove the BNC restriction from the DerivativeAccountTokenFilter. * Change the active logic of Ledger to total minus lesstotal. --- pallets/slp/src/lib.rs | 2 ++ runtime/bifrost-polkadot/src/lib.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pallets/slp/src/lib.rs b/pallets/slp/src/lib.rs index f6c62046a..443002b58 100644 --- a/pallets/slp/src/lib.rs +++ b/pallets/slp/src/lib.rs @@ -2286,6 +2286,8 @@ impl>> Self::get_multilocation(token, derivative_index).and_then(|location| { DelegatorLedgers::::get(token, location).and_then(|ledger| match ledger { Ledger::Substrate(l) if F::contains(&token) => Some((l.total, l.active)), + Ledger::ParachainStaking(l) if F::contains(&token) => + Some((l.total, l.total.checked_sub(&l.less_total).unwrap_or_default())), _ => None, }) }) diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index dbe2121f4..9a046b485 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -38,7 +38,7 @@ use bifrost_primitives::{ IncentivePalletId, IncentivePoolAccount, LendMarketPalletId, LiquidityAccount, LocalBncLocation, MerkleDirtributorPalletId, OraclePalletId, ParachainStakingPalletId, SlpEntrancePalletId, SlpExitPalletId, SystemMakerPalletId, SystemStakingPalletId, - TreasuryPalletId, + TreasuryPalletId, BNC, }; use cumulus_pallet_parachain_system::{RelayNumberMonotonicallyIncreases, RelaychainDataProvider}; pub use frame_support::{ @@ -1313,7 +1313,7 @@ parameter_types! { pub struct DerivativeAccountTokenFilter; impl Contains for DerivativeAccountTokenFilter { fn contains(token: &CurrencyId) -> bool { - *token == RelayCurrencyId::get() + *token == RelayCurrencyId::get() || *token == BNC } }