From fcc61009d567f294dd80046ee5fc37848bda16e1 Mon Sep 17 00:00:00 2001 From: yooml Date: Wed, 5 Jun 2024 09:42:26 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20benchmark?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 18 +- Cargo.toml | 16 +- pallets/buy-back/Cargo.toml | 2 + pallets/buy-back/src/benchmarking.rs | 63 +++---- pallets/buy-back/src/lib.rs | 24 ++- pallets/buy-back/src/mock.rs | 38 +++- pallets/buy-back/src/tests.rs | 56 +++++- pallets/buy-back/src/weights.rs | 176 +++++++++--------- pallets/ve-minting/src/traits.rs | 21 +++ pallets/vtoken-minting/src/mock.rs | 7 + runtime/bifrost-polkadot/Cargo.toml | 1 + runtime/bifrost-polkadot/src/lib.rs | 8 +- .../src/weights/bifrost_buy_back.rs | 130 +++++++++++++ runtime/bifrost-polkadot/src/weights/mod.rs | 1 + 14 files changed, 403 insertions(+), 158 deletions(-) create mode 100644 runtime/bifrost-polkadot/src/weights/bifrost_buy_back.rs diff --git a/Cargo.lock b/Cargo.lock index ca18cbbd3..bf7cbaaba 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -709,8 +709,10 @@ dependencies = [ "bifrost-currencies", "bifrost-primitives", "bifrost-slp", + "bifrost-ve-minting", "bifrost-vtoken-minting", "cumulus-primitives-core", + "env_logger", "frame-benchmarking", "frame-support", "frame-system", @@ -6672,7 +6674,7 @@ dependencies = [ [[package]] name = "merkle-distributor" version = "0.1.0" -source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=add-new-fee-receiver#1d027999704dde515f13e6147a24450bc0ba29ae" +source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=release-polkadot-v1.6.0#af308c7f73ab244000201be3619056b2c62eff6a" dependencies = [ "frame-support", "frame-system", @@ -16087,7 +16089,7 @@ dependencies = [ [[package]] name = "zenlink-protocol" version = "0.4.4" -source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=add-new-fee-receiver#1d027999704dde515f13e6147a24450bc0ba29ae" +source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=release-polkadot-v1.6.0#af308c7f73ab244000201be3619056b2c62eff6a" dependencies = [ "cumulus-primitives-core", "frame-benchmarking", @@ -16109,7 +16111,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-rpc" version = "0.4.4" -source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=add-new-fee-receiver#1d027999704dde515f13e6147a24450bc0ba29ae" +source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=release-polkadot-v1.6.0#af308c7f73ab244000201be3619056b2c62eff6a" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -16125,7 +16127,7 @@ dependencies = [ [[package]] name = "zenlink-protocol-runtime-api" version = "0.4.4" -source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=add-new-fee-receiver#1d027999704dde515f13e6147a24450bc0ba29ae" +source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=release-polkadot-v1.6.0#af308c7f73ab244000201be3619056b2c62eff6a" dependencies = [ "parity-scale-codec", "sp-api", @@ -16136,7 +16138,7 @@ dependencies = [ [[package]] name = "zenlink-stable-amm" version = "0.1.0" -source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=add-new-fee-receiver#1d027999704dde515f13e6147a24450bc0ba29ae" +source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=release-polkadot-v1.6.0#af308c7f73ab244000201be3619056b2c62eff6a" dependencies = [ "frame-support", "frame-system", @@ -16153,7 +16155,7 @@ dependencies = [ [[package]] name = "zenlink-stable-amm-rpc" version = "0.1.0" -source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=add-new-fee-receiver#1d027999704dde515f13e6147a24450bc0ba29ae" +source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=release-polkadot-v1.6.0#af308c7f73ab244000201be3619056b2c62eff6a" dependencies = [ "jsonrpsee", "parity-scale-codec", @@ -16167,7 +16169,7 @@ dependencies = [ [[package]] name = "zenlink-stable-amm-runtime-api" version = "0.1.0" -source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=add-new-fee-receiver#1d027999704dde515f13e6147a24450bc0ba29ae" +source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=release-polkadot-v1.6.0#af308c7f73ab244000201be3619056b2c62eff6a" dependencies = [ "parity-scale-codec", "sp-api", @@ -16178,7 +16180,7 @@ dependencies = [ [[package]] name = "zenlink-swap-router" version = "0.1.0" -source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=add-new-fee-receiver#1d027999704dde515f13e6147a24450bc0ba29ae" +source = "git+https://github.com/bifrost-finance/Zenlink-DEX-Module?branch=release-polkadot-v1.6.0#af308c7f73ab244000201be3619056b2c62eff6a" dependencies = [ "frame-support", "frame-system", diff --git a/Cargo.toml b/Cargo.toml index 41cb7b174..980b2bd2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -97,14 +97,14 @@ bifrost-channel-commission = { path = "pallets/channel-commission", default-f bifrost-clouds-convert = { path = "pallets/clouds-convert", default-features = false } # Zenlink -merkle-distributor = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "add-new-fee-receiver", default-features = false } -zenlink-protocol = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "add-new-fee-receiver", default-features = false } -zenlink-protocol-rpc = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "add-new-fee-receiver" } -zenlink-protocol-runtime-api = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "add-new-fee-receiver", default-features = false } -zenlink-stable-amm = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "add-new-fee-receiver", default-features = false } -zenlink-stable-amm-rpc = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "add-new-fee-receiver" } -zenlink-stable-amm-runtime-api = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "add-new-fee-receiver", default-features = false } -zenlink-swap-router = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "add-new-fee-receiver", default-features = false } +merkle-distributor = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "release-polkadot-v1.6.0", default-features = false } +zenlink-protocol = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "release-polkadot-v1.6.0", default-features = false } +zenlink-protocol-rpc = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "release-polkadot-v1.6.0" } +zenlink-protocol-runtime-api = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "release-polkadot-v1.6.0", default-features = false } +zenlink-stable-amm = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "release-polkadot-v1.6.0", default-features = false } +zenlink-stable-amm-rpc = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "release-polkadot-v1.6.0" } +zenlink-stable-amm-runtime-api = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "release-polkadot-v1.6.0", default-features = false } +zenlink-swap-router = { git = "https://github.com/bifrost-finance/Zenlink-DEX-Module", branch = "release-polkadot-v1.6.0", default-features = false } # Orml orml-tokens = { version = "0.7.0", default-features = false } diff --git a/pallets/buy-back/Cargo.toml b/pallets/buy-back/Cargo.toml index 5f03f296e..38a9f9ba5 100644 --- a/pallets/buy-back/Cargo.toml +++ b/pallets/buy-back/Cargo.toml @@ -27,6 +27,7 @@ sp-runtime = { workspace = true } sp-std = { workspace = true } xcm = { workspace = true } zenlink-protocol = { workspace = true } +bifrost-ve-minting = { workspace = true } [dev-dependencies] bifrost-asset-registry = { workspace = true } @@ -39,6 +40,7 @@ sp-core = { workspace = true } sp-io = { workspace = true } xcm-builder = { workspace = true } xcm-executor = { workspace = true } +env_logger = { workspace = true } [features] default = ["std"] diff --git a/pallets/buy-back/src/benchmarking.rs b/pallets/buy-back/src/benchmarking.rs index 27049526b..1b2ee3f10 100644 --- a/pallets/buy-back/src/benchmarking.rs +++ b/pallets/buy-back/src/benchmarking.rs @@ -20,8 +20,8 @@ #![cfg(feature = "runtime-benchmarks")] -use crate::{BalanceOf, Call, Config, Info, Pallet as SystemMaker, Pallet, *}; -use bifrost_primitives::{CurrencyId, TokenSymbol}; +use crate::{BalanceOf, Call, Config, Pallet, Pallet as BuyBack, *}; +use bifrost_primitives::{CurrencyId, TokenSymbol, DOT}; use frame_benchmarking::v1::{account, benchmarks, BenchmarkError}; use frame_support::{ assert_ok, @@ -29,62 +29,47 @@ use frame_support::{ }; use frame_system::RawOrigin; use orml_traits::MultiCurrency; -use sp_core::Get; -use sp_runtime::traits::{AccountIdConversion, UniqueSaturatedFrom}; -// use crate::{Pallet as SystemMaker, *}; +use sp_runtime::traits::UniqueSaturatedFrom; benchmarks! { - set_config { + set_vtoken { let origin = T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; - let info = Info { - vcurrency_id: CurrencyId::VToken(TokenSymbol::KSM), - annualization: 600_000u32, - granularity: 1000u32.into(), - minimum_redeem: 20000u32.into() - }; - }: _(origin,CurrencyId::Token(TokenSymbol::KSM),info) + }: _(origin,CurrencyId::VToken(TokenSymbol::KSM),1_000_000u32.into(),Permill::from_percent(2),1000u32.into(),1000u32.into(),true) charge { let test_account: T::AccountId = account("seed",1,1); - T::MultiCurrency::deposit(CurrencyId::Token(TokenSymbol::DOT), &test_account, BalanceOf::::unique_saturated_from(100000000000u128))?; - }: _(RawOrigin::Signed(test_account),CurrencyId::Token(TokenSymbol::DOT),BalanceOf::::unique_saturated_from(10000000000u128)) + T::MultiCurrency::deposit(DOT, &test_account, BalanceOf::::unique_saturated_from(1_000_000_000_000_000u128))?; + }: _(RawOrigin::Signed(test_account),DOT,BalanceOf::::unique_saturated_from(9_000_000_000_000u128)) - close { + remove_vtoken { let origin = T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; - assert_ok!(SystemMaker::::set_config( + assert_ok!(BuyBack::::set_vtoken( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - CurrencyId::Token(TokenSymbol::KSM), - Info { - vcurrency_id: CurrencyId::VToken(TokenSymbol::KSM), - annualization: 600_000u32, - granularity: 1000u32.into(), - minimum_redeem: 20000u32.into() - }, + CurrencyId::VToken(TokenSymbol::KSM), + 1_000_000u32.into(), + Permill::from_percent(2), + 1000u32.into(), + 1000u32.into(), + true )); }: _(origin,CurrencyId::Token(TokenSymbol::KSM)) - payout { - let origin = T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; - let pallet_account: T::AccountId = T::SystemMakerPalletId::get().into_account_truncating(); - T::MultiCurrency::deposit(CurrencyId::Token(TokenSymbol::DOT), &pallet_account, BalanceOf::::unique_saturated_from(100000000000u128))?; - }: _(origin,CurrencyId::Token(TokenSymbol::DOT),BalanceOf::::unique_saturated_from(10000000000u128)) on_idle { let origin = T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?; - assert_ok!(SystemMaker::::set_config( + assert_ok!(BuyBack::::set_vtoken( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, - CurrencyId::Token(TokenSymbol::KSM), - Info { - vcurrency_id: CurrencyId::VToken(TokenSymbol::KSM), - annualization: 600_000u32, - granularity: 1000u32.into(), - minimum_redeem: 20000u32.into() - }, + CurrencyId::VToken(TokenSymbol::KSM), + 1_000_000u32.into(), + Permill::from_percent(2), + 1000u32.into(), + 1000u32.into(), + true )); }: { - SystemMaker::::on_idle(BlockNumberFor::::from(0u32),Weight::from_parts(0, u64::MAX)); + BuyBack::::on_idle(BlockNumberFor::::from(0u32),Weight::from_parts(0, u64::MAX)); } - impl_benchmark_test_suite!(SystemMaker,crate::mock::ExtBuilder::default().build(),crate::mock::Runtime); + impl_benchmark_test_suite!(BuyBack,crate::mock::ExtBuilder::default().build(),crate::mock::Runtime); } diff --git a/pallets/buy-back/src/lib.rs b/pallets/buy-back/src/lib.rs index 764dbdc5e..0545f2dff 100644 --- a/pallets/buy-back/src/lib.rs +++ b/pallets/buy-back/src/lib.rs @@ -33,6 +33,7 @@ pub mod weights; use bifrost_primitives::{ currency::BNC, CurrencyId, CurrencyIdConversion, CurrencyIdRegister, TryConvertFrom, }; +use bifrost_ve_minting::VeMintingInterface; use cumulus_primitives_core::ParaId; use frame_support::{ pallet_prelude::*, @@ -94,6 +95,13 @@ pub mod pallet { type ParachainId: Get; type CurrencyIdRegister: CurrencyIdRegister; + + type VeMinting: VeMintingInterface< + AccountIdOf, + CurrencyIdOf, + BalanceOf, + BlockNumberFor, + >; } #[pallet::event] @@ -133,7 +141,7 @@ pub mod pallet { let buyback_address = T::BuyBackAccount::get().into_account_truncating(); let liquidity_address = T::LiquidityAccount::get().into_account_truncating(); for (asset_id, mut info) in Infos::::iter() { - if info.if_auto == false { + if !info.if_auto { continue; } @@ -172,7 +180,7 @@ pub mod pallet { #[pallet::call] impl Pallet { #[pallet::call_index(0)] - #[pallet::weight(T::WeightInfo::set_config())] + #[pallet::weight(T::WeightInfo::set_vtoken())] pub fn set_vtoken( origin: OriginFor, asset_id: CurrencyIdOf, @@ -235,7 +243,7 @@ pub mod pallet { } #[pallet::call_index(2)] - #[pallet::weight(T::WeightInfo::close())] + #[pallet::weight(T::WeightInfo::remove_vtoken())] pub fn remove_vtoken(origin: OriginFor, asset_id: CurrencyIdOf) -> DispatchResult { T::ControlOrigin::ensure_origin(origin)?; @@ -249,7 +257,10 @@ pub mod pallet { impl Pallet { #[transactional] - fn buy_back(buyback_address: &AccountIdOf, currency_id: CurrencyId) -> DispatchResult { + pub fn buy_back( + buyback_address: &AccountIdOf, + currency_id: CurrencyId, + ) -> DispatchResult { let asset_id: AssetId = AssetId::try_convert_from(currency_id, T::ParachainId::get().into()) .map_err(|_| DispatchError::Other("Conversion Error."))?; @@ -266,7 +277,10 @@ pub mod pallet { 0, &path, &buyback_address, - ) + )?; + + let bnc_balance = T::MultiCurrency::free_balance(BNC, &buyback_address); + T::VeMinting::notify_reward(0, &Some(buyback_address.clone()), vec![(BNC, bnc_balance)]) } #[transactional] diff --git a/pallets/buy-back/src/mock.rs b/pallets/buy-back/src/mock.rs index dda51147b..83c145e95 100644 --- a/pallets/buy-back/src/mock.rs +++ b/pallets/buy-back/src/mock.rs @@ -29,7 +29,7 @@ use frame_support::{ derive_impl, ord_parameter_types, pallet_prelude::Get, parameter_types, - sp_runtime::{DispatchError, DispatchResult}, + sp_runtime::{traits::ConvertInto, DispatchError, DispatchResult}, traits::{Everything, Nothing}, PalletId, }; @@ -77,6 +77,7 @@ frame_support::construct_runtime!( ZenlinkProtocol: zenlink_protocol, AssetRegistry: bifrost_asset_registry, PolkadotXcm: pallet_xcm, + VeMinting: bifrost_ve_minting, } ); @@ -105,7 +106,7 @@ impl frame_system::Config for Runtime { } parameter_types! { - pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::ASG); + pub const GetNativeCurrencyId: CurrencyId = CurrencyId::Native(TokenSymbol::BNC); } pub type AdaptedBasicCurrency = @@ -184,6 +185,7 @@ impl bifrost_buy_back::Config for Runtime { type LiquidityAccount = LiquidityAccount; type ParachainId = ParaInfo; type CurrencyIdRegister = AssetIdMaps; + type VeMinting = VeMinting; } pub struct ParaInfo; @@ -509,6 +511,35 @@ impl pallet_xcm::Config for Runtime { type RemoteLockConsumerIdentifier = (); } +parameter_types! { + pub const VeMintingTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); + pub VeMintingPalletId: PalletId = PalletId(*b"bf/vemnt"); + pub IncentivePalletId: PalletId = PalletId(*b"bf/veict"); + pub const Week: BlockNumber = 50400; // a week + pub const MaxBlock: BlockNumber = 10512000; // four years + pub const Multiplier: Balance = 10_u128.pow(12); + pub const VoteWeightMultiplier: Balance = 1; + pub const MaxPositions: u32 = 10; + pub const MarkupRefreshLimit: u32 = 100; +} + +impl bifrost_ve_minting::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type MultiCurrency = Currencies; + type ControlOrigin = EnsureSignedBy; + type TokenType = VeMintingTokenType; + type VeMintingPalletId = VeMintingPalletId; + type IncentivePalletId = IncentivePalletId; + type WeightInfo = (); + type BlockNumberToBalance = ConvertInto; + type Week = Week; + type MaxBlock = MaxBlock; + type Multiplier = Multiplier; + type VoteWeightMultiplier = VoteWeightMultiplier; + type MaxPositions = MaxPositions; + type MarkupRefreshLimit = MarkupRefreshLimit; +} + pub struct ExtBuilder { endowed_accounts: Vec<(AccountId, CurrencyId, Balance)>, } @@ -533,13 +564,14 @@ impl ExtBuilder { // (ALICE, RelayCurrencyId::get(), 10000), (ALICE, VKSM, 10000), (BOB, KSM, 100), - (BuyBackAccount::get().into_account_truncating(), VKSM, 10000), + (BuyBackAccount::get().into_account_truncating(), VKSM, 9000), (BuyBackAccount::get().into_account_truncating(), KSM, 10000), ]) } pub fn build(self) -> sp_io::TestExternalities { let mut t = frame_system::GenesisConfig::::default().build_storage().unwrap(); + env_logger::try_init().unwrap_or(()); pallet_balances::GenesisConfig:: { balances: self diff --git a/pallets/buy-back/src/tests.rs b/pallets/buy-back/src/tests.rs index 746e1b739..d623f79ce 100644 --- a/pallets/buy-back/src/tests.rs +++ b/pallets/buy-back/src/tests.rs @@ -21,7 +21,6 @@ #![cfg(test)] use crate::{mock::*, *}; -use bifrost_primitives::{TimeUnit, VtokenMintingOperator}; use frame_support::assert_ok; use sp_arithmetic::per_things::Permill; @@ -41,19 +40,58 @@ fn buy_back_should_work() { true )); let buyback_account = ::BuyBackAccount::get().into_account_truncating(); - assert_eq!(Tokens::free_balance(VKSM, &buyback_account), 10000); - assert_eq!(Tokens::free_balance(VKSM, &zenlink_pair_account_id), 2200); - assert_eq!(Balances::free_balance(&zenlink_pair_account_id), 2000); - assert_eq!(Balances::free_balance(&buyback_account), 0); + let incentive_account = IncentivePalletId::get().into_account_truncating(); + assert_eq!(Currencies::free_balance(VKSM, &buyback_account), 9000); + assert_eq!(Currencies::free_balance(VKSM, &zenlink_pair_account_id), 2200); + assert_eq!(Currencies::free_balance(BNC, &zenlink_pair_account_id), 2000); + assert_eq!(Currencies::free_balance(BNC, &buyback_account), 0); + assert_eq!(Currencies::free_balance(BNC, &incentive_account), 0); + VeMinting::set_incentive(0, Some(7 * 86400 / 12), Some(buyback_account.clone())); + assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000)); + assert_ok!(BuyBack::buy_back(&buyback_account, VKSM)); + System::set_block_number(System::block_number() + 1); + assert_eq!(Currencies::free_balance(VKSM, &buyback_account), 0); + assert_eq!(Currencies::free_balance(VKSM, &zenlink_pair_account_id), 12200); + assert_eq!(Currencies::free_balance(BNC, &zenlink_pair_account_id), 362); + assert_eq!(Currencies::free_balance(BNC, &buyback_account), 0); + assert_eq!(Currencies::free_balance(BNC, &incentive_account), 1638); + }); +} + +#[test] +fn on_idle_should_work() { + ExtBuilder::default().one_hundred_for_alice_n_bob().build().execute_with(|| { + let para_id = 2001u32; + let zenlink_pair_account_id = init_zenlink(para_id); + + assert_ok!(BuyBack::set_vtoken( + RuntimeOrigin::signed(ALICE), + VKSM, + 1_000_000u128, + Permill::from_percent(2), + 1000, + 1000, + true + )); + let buyback_account = ::BuyBackAccount::get().into_account_truncating(); + let incentive_account = IncentivePalletId::get().into_account_truncating(); + assert_eq!(Currencies::free_balance(VKSM, &buyback_account), 9000); + assert_eq!(Currencies::free_balance(VKSM, &zenlink_pair_account_id), 2200); + assert_eq!(Currencies::free_balance(BNC, &zenlink_pair_account_id), 2000); + assert_eq!(Currencies::free_balance(BNC, &buyback_account), 0); + assert_eq!(Currencies::free_balance(BNC, &incentive_account), 0); + VeMinting::set_incentive(0, Some(7 * 86400 / 12), Some(buyback_account.clone())); + assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000)); BuyBack::on_idle( >::block_number(), Weight::from_parts(100000000, 0), ); System::set_block_number(System::block_number() + 1); - assert_eq!(Tokens::free_balance(VKSM, &buyback_account), 0); - assert_eq!(Tokens::free_balance(VKSM, &zenlink_pair_account_id), 12200); - assert_eq!(Balances::free_balance(&zenlink_pair_account_id), 362); - assert_eq!(Balances::free_balance(&buyback_account), 1638); + assert_eq!(Currencies::free_balance(VKSM, &buyback_account), 0); + assert_eq!(Currencies::free_balance(VKSM, &zenlink_pair_account_id), 12200); + assert_eq!(Currencies::free_balance(BNC, &zenlink_pair_account_id), 362); + assert_eq!(Currencies::free_balance(BNC, &buyback_account), 0); + assert_eq!(Currencies::free_balance(BNC, &incentive_account), 1638); }); } diff --git a/pallets/buy-back/src/weights.rs b/pallets/buy-back/src/weights.rs index f84810dcf..2776509fd 100644 --- a/pallets/buy-back/src/weights.rs +++ b/pallets/buy-back/src/weights.rs @@ -15,116 +15,124 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -//! Autogenerated weights for bifrost_system_maker +//! Autogenerated weights for `bifrost_buy_back` //! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-09-14, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `bifrost-jenkins`, CPU: `Intel(R) Xeon(R) CPU E5-26xx v4` -//! WASM-EXECUTION: Compiled, CHAIN: Some("bifrost-kusama-local"), DB CACHE: 1024 +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-06-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `yml`, CPU: `AMD Ryzen 9 3950X 16-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("bifrost-polkadot-local")`, DB CACHE: 1024 // Executed Command: -// target/release/bifrost +// ./target/release/bifrost // benchmark // pallet -// --chain=bifrost-kusama-local +// --chain=bifrost-polkadot-local +// --pallet=bifrost-buy-back +// --extrinsic=* // --steps=50 // --repeat=20 -// --pallet=bifrost_system_maker -// --extrinsic=* -// --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=./pallets/system-maker/src/weights.rs -// --template=./weight-template/pallet-weight-template.hbs +// --header=./HEADER-GPL3 +// --output=./bifrost-buy-back.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] #![allow(unused_imports)] +#![allow(missing_docs)] -use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; -use sp_std::marker::PhantomData; - -/// Weight functions needed for bifrost_system_maker. -pub trait WeightInfo { - fn set_config() -> Weight; - fn charge() -> Weight; - fn close() -> Weight; - fn payout() -> Weight; - fn on_idle() -> Weight; -} +use frame_support::{traits::Get, weights::{constants::RocksDbWeight, Weight}}; +use core::marker::PhantomData; -// For backwards compatibility and tests +/// Weight functions for `bifrost_buy_back`. impl WeightInfo for () { - /// Storage: SystemMaker Infos (r:1 w:1) - /// Proof Skipped: SystemMaker Infos (max_values: None, max_size: None, mode: Measured) - fn set_config() -> Weight { + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BuyBack::Infos` (r:0 w:1) + /// Proof: `BuyBack::Infos` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn set_vtoken() -> Weight { // Proof Size summary in bytes: - // Measured: `109` - // Estimated: `3574` - // Minimum execution time: 32_767_000 picoseconds. - Weight::from_parts(33_874_000, 3574) - .saturating_add(RocksDbWeight::get().reads(1_u64)) - .saturating_add(RocksDbWeight::get().writes(1_u64)) + // Measured: `25` + // Estimated: `1510` + // Minimum execution time: 11_582_000 picoseconds. + Weight::from_parts(11_753_000, 0) + .saturating_add(Weight::from_parts(0, 1510)) + .saturating_add(RocksDbWeight::get().reads(4)) + .saturating_add(RocksDbWeight::get().writes(3)) } - /// Storage: Tokens Accounts (r:2 w:2) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - /// Storage: AssetRegistry CurrencyMetadatas (r:1 w:0) - /// Proof Skipped: AssetRegistry CurrencyMetadatas (max_values: None, max_size: None, mode: Measured) - /// Storage: System Account (r:2 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) + /// Storage: `Tokens::Accounts` (r:2 w:2) + /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(118), added: 2593, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn charge() -> Weight { // Proof Size summary in bytes: - // Measured: `1402` + // Measured: `508` // Estimated: `6196` - // Minimum execution time: 119_870_000 picoseconds. - Weight::from_parts(121_960_000, 6196) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) - } - /// Storage: SystemMaker Infos (r:0 w:1) - /// Proof Skipped: SystemMaker Infos (max_values: None, max_size: None, mode: Measured) - fn close() -> Weight { - // Proof Size summary in bytes: - // Measured: `0` - // Estimated: `0` - // Minimum execution time: 22_064_000 picoseconds. - Weight::from_parts(22_538_000, 0) - .saturating_add(RocksDbWeight::get().writes(1_u64)) + // Minimum execution time: 43_842_000 picoseconds. + Weight::from_parts(44_144_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(RocksDbWeight::get().reads(8)) + .saturating_add(RocksDbWeight::get().writes(5)) } - /// Storage: Tokens Accounts (r:2 w:2) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) - /// Storage: AssetRegistry CurrencyMetadatas (r:1 w:0) - /// Proof Skipped: AssetRegistry CurrencyMetadatas (max_values: None, max_size: None, mode: Measured) - /// Storage: System Account (r:2 w:1) - /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) - fn payout() -> Weight { + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BuyBack::Infos` (r:0 w:1) + /// Proof: `BuyBack::Infos` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn remove_vtoken() -> Weight { // Proof Size summary in bytes: - // Measured: `1461` - // Estimated: `6196` - // Minimum execution time: 111_864_000 picoseconds. - Weight::from_parts(113_839_000, 6196) - .saturating_add(RocksDbWeight::get().reads(5_u64)) - .saturating_add(RocksDbWeight::get().writes(3_u64)) + // Measured: `25` + // Estimated: `1510` + // Minimum execution time: 10_931_000 picoseconds. + Weight::from_parts(11_161_000, 0) + .saturating_add(Weight::from_parts(0, 1510)) + .saturating_add(RocksDbWeight::get().reads(4)) + .saturating_add(RocksDbWeight::get().writes(3)) } - /// Storage: SystemMaker Infos (r:2 w:0) - /// Proof Skipped: SystemMaker Infos (max_values: None, max_size: None, mode: Measured) - /// Storage: ParachainInfo ParachainId (r:1 w:0) - /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: Tokens Accounts (r:2 w:0) - /// Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) + /// Storage: `BuyBack::Infos` (r:2 w:1) + /// Proof: `BuyBack::Infos` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) + /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Tokens::Accounts` (r:2 w:0) + /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(118), added: 2593, mode: `MaxEncodedLen`) fn on_idle() -> Weight { // Proof Size summary in bytes: - // Measured: `894` - // Estimated: `6834` - // Minimum execution time: 54_117_000 picoseconds. - Weight::from_parts(56_635_000, 6834) - .saturating_add(RocksDbWeight::get().reads(5_u64)) + // Measured: `502` + // Estimated: `6442` + // Minimum execution time: 32_792_000 picoseconds. + Weight::from_parts(33_293_000, 0) + .saturating_add(Weight::from_parts(0, 6442)) + .saturating_add(RocksDbWeight::get().reads(5)) + .saturating_add(RocksDbWeight::get().writes(1)) } } + + +/// Weight functions needed for bifrost_buy_back. +pub trait WeightInfo { + fn set_vtoken() -> Weight; + fn charge() -> Weight; + fn remove_vtoken() -> Weight; + fn on_idle() -> Weight; +} diff --git a/pallets/ve-minting/src/traits.rs b/pallets/ve-minting/src/traits.rs index 9bdf2b94b..32e7deb27 100644 --- a/pallets/ve-minting/src/traits.rs +++ b/pallets/ve-minting/src/traits.rs @@ -68,6 +68,11 @@ pub trait VeMintingInterface { rewards: &Vec<(CurrencyId, Balance)>, remaining: Balance, ) -> DispatchResult; + fn notify_reward( + pool_id: PoolId, + addr: &Option, + rewards: Vec<(CurrencyId, Balance)>, + ) -> DispatchResult; } impl VeMintingInterface, CurrencyIdOf, BalanceOf, BlockNumberFor> @@ -318,6 +323,7 @@ impl VeMintingInterface, CurrencyIdOf, BalanceOf IncentiveConfigs::::set(pool_id, incentive_config.clone()); Self::deposit_event(Event::IncentiveSet { incentive_config }); } + fn add_reward( addr: &AccountIdOf, conf: &mut IncentiveConfig< @@ -367,6 +373,14 @@ impl VeMintingInterface, CurrencyIdOf, BalanceOf ) }) } + + fn notify_reward( + pool_id: PoolId, + addr: &Option>, + rewards: Vec<(CurrencyIdOf, BalanceOf)>, + ) -> DispatchResult { + Self::notify_reward_amount(pool_id, addr, rewards) + } } impl @@ -459,6 +473,13 @@ where ) -> DispatchResult { Ok(()) } + fn notify_reward( + _pool_id: PoolId, + _addr: &Option, + _rewards: Vec<(CurrencyId, Balance)>, + ) -> DispatchResult { + Ok(()) + } } #[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, Default)] diff --git a/pallets/vtoken-minting/src/mock.rs b/pallets/vtoken-minting/src/mock.rs index 9fcdf2d50..75e8da003 100644 --- a/pallets/vtoken-minting/src/mock.rs +++ b/pallets/vtoken-minting/src/mock.rs @@ -595,4 +595,11 @@ impl VeMintingInterface for VeMinti ) -> DispatchResult { Ok(()) } + fn notify_reward( + _pool_id: u32, + _addr: &Option, + _rewards: Vec<(CurrencyId, Balance)>, + ) -> DispatchResult { + Ok(()) + } } diff --git a/runtime/bifrost-polkadot/Cargo.toml b/runtime/bifrost-polkadot/Cargo.toml index 522682b8a..9f1ca9e1e 100644 --- a/runtime/bifrost-polkadot/Cargo.toml +++ b/runtime/bifrost-polkadot/Cargo.toml @@ -295,6 +295,7 @@ runtime-benchmarks = [ "lend-market/runtime-benchmarks", "bifrost-channel-commission/runtime-benchmarks", "bifrost-clouds-convert/runtime-benchmarks", + "bifrost-buy-back/runtime-benchmarks", ] try-runtime = [ diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 507d843c6..f102ed071 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -1638,7 +1638,7 @@ impl bifrost_buy_back::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; type ControlOrigin = EitherOfDiverse; - type WeightInfo = (); //weights::bifrost_system_maker::BifrostWeight; + type WeightInfo = weights::bifrost_buy_back::BifrostWeight; type DexOperator = ZenlinkProtocol; type CurrencyIdConversion = AssetIdMaps; type TreasuryAccount = BifrostTreasuryAccount; @@ -1647,6 +1647,7 @@ impl bifrost_buy_back::Config for Runtime { type LiquidityAccount = LiquidityAccount; type ParachainId = ParachainInfo; type CurrencyIdRegister = AssetIdMaps; + type VeMinting = VeMinting; } // Below is the implementation of tokens manipulation functions other than native token. @@ -1939,7 +1940,10 @@ extern crate frame_benchmarking; #[cfg(feature = "runtime-benchmarks")] mod benches { - define_benchmarks!([bifrost_ve_minting, VeMinting]); + define_benchmarks!( + [bifrost_ve_minting, VeMinting] + [bifrost_buy_back, BuyBack] + ); } impl_runtime_apis! { diff --git a/runtime/bifrost-polkadot/src/weights/bifrost_buy_back.rs b/runtime/bifrost-polkadot/src/weights/bifrost_buy_back.rs new file mode 100644 index 000000000..2efdc3a79 --- /dev/null +++ b/runtime/bifrost-polkadot/src/weights/bifrost_buy_back.rs @@ -0,0 +1,130 @@ +// This file is part of Bifrost. + +// Copyright (C) Liebi Technologies PTE. 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_buy_back` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0 +//! DATE: 2024-06-05, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! WORST CASE MAP SIZE: `1000000` +//! HOSTNAME: `yml`, CPU: `AMD Ryzen 9 3950X 16-Core Processor` +//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("bifrost-polkadot-local")`, DB CACHE: 1024 + +// Executed Command: +// ./target/release/bifrost +// benchmark +// pallet +// --chain=bifrost-polkadot-local +// --pallet=bifrost-buy-back +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --wasm-execution=compiled +// --heap-pages=4096 +// --header=./HEADER-GPL3 +// --output=./bifrost-buy-back.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(missing_docs)] + +use frame_support::{traits::Get, weights::Weight}; +use core::marker::PhantomData; + +/// Weight functions for `bifrost_buy_back`. +pub struct BifrostWeight(PhantomData); +impl bifrost_buy_back::WeightInfo for BifrostWeight { + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BuyBack::Infos` (r:0 w:1) + /// Proof: `BuyBack::Infos` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn set_vtoken() -> Weight { + // Proof Size summary in bytes: + // Measured: `25` + // Estimated: `1510` + // Minimum execution time: 11_582_000 picoseconds. + Weight::from_parts(11_753_000, 0) + .saturating_add(Weight::from_parts(0, 1510)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `Tokens::Accounts` (r:2 w:2) + /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(118), added: 2593, mode: `MaxEncodedLen`) + /// Storage: `System::Account` (r:2 w:1) + /// Proof: `System::Account` (`max_values`: None, `max_size`: Some(128), added: 2603, mode: `MaxEncodedLen`) + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn charge() -> Weight { + // Proof Size summary in bytes: + // Measured: `508` + // Estimated: `6196` + // Minimum execution time: 43_842_000 picoseconds. + Weight::from_parts(44_144_000, 0) + .saturating_add(Weight::from_parts(0, 6196)) + .saturating_add(T::DbWeight::get().reads(8)) + .saturating_add(T::DbWeight::get().writes(5)) + } + /// Storage: `System::Number` (r:1 w:0) + /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::ExecutionPhase` (r:1 w:0) + /// Proof: `System::ExecutionPhase` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`) + /// Storage: `System::EventCount` (r:1 w:1) + /// Proof: `System::EventCount` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `System::Events` (r:1 w:1) + /// Proof: `System::Events` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BuyBack::Infos` (r:0 w:1) + /// Proof: `BuyBack::Infos` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn remove_vtoken() -> Weight { + // Proof Size summary in bytes: + // Measured: `25` + // Estimated: `1510` + // Minimum execution time: 10_931_000 picoseconds. + Weight::from_parts(11_161_000, 0) + .saturating_add(Weight::from_parts(0, 1510)) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + /// Storage: `BuyBack::Infos` (r:2 w:1) + /// Proof: `BuyBack::Infos` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `ParachainInfo::ParachainId` (r:1 w:0) + /// Proof: `ParachainInfo::ParachainId` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) + /// Storage: `Tokens::Accounts` (r:2 w:0) + /// Proof: `Tokens::Accounts` (`max_values`: None, `max_size`: Some(118), added: 2593, mode: `MaxEncodedLen`) + fn on_idle() -> Weight { + // Proof Size summary in bytes: + // Measured: `502` + // Estimated: `6442` + // Minimum execution time: 32_792_000 picoseconds. + Weight::from_parts(33_293_000, 0) + .saturating_add(Weight::from_parts(0, 6442)) + .saturating_add(T::DbWeight::get().reads(5)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/runtime/bifrost-polkadot/src/weights/mod.rs b/runtime/bifrost-polkadot/src/weights/mod.rs index d6f4e9070..6ea6b29d5 100644 --- a/runtime/bifrost-polkadot/src/weights/mod.rs +++ b/runtime/bifrost-polkadot/src/weights/mod.rs @@ -21,6 +21,7 @@ //! A list of the different weight modules for our runtime. pub mod bifrost_asset_registry; +pub mod bifrost_buy_back; pub mod bifrost_call_switchgear; pub mod bifrost_channel_commission; pub mod bifrost_clouds_convert;