From b26c6bc434f5c131d7080b24eba7ccc74f9300ec Mon Sep 17 00:00:00 2001 From: yooml Date: Wed, 11 Sep 2024 14:21:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20redefine=20system=20pool?= =?UTF-8?q?=20id=20(#1421)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 🐛 redefine system pool id * fix: 🐛 auto_notify_reward * refactor: 💡 rename to bb-bnc * style: 💄 clippy * fix: 🐛 rename error * refactor: 💡 rm BbBNCPalletId * fix: 🐛 UserFarmingPool bound limit --- Cargo.lock | 140 +++--- Cargo.toml | 8 +- node/rpc/Cargo.toml | 4 +- node/rpc/src/lib.rs | 8 +- node/service/Cargo.toml | 2 +- pallets/{ve-minting => bb-bnc}/Cargo.toml | 2 +- pallets/{ve-minting => bb-bnc}/rpc/Cargo.toml | 4 +- .../rpc/runtime-api/Cargo.toml | 2 +- .../rpc/runtime-api/src/lib.rs | 2 +- pallets/{ve-minting => bb-bnc}/rpc/src/lib.rs | 20 +- .../src/benchmarking.rs | 74 +-- .../{ve-minting => bb-bnc}/src/incentive.rs | 23 +- pallets/{ve-minting => bb-bnc}/src/lib.rs | 33 +- pallets/{ve-minting => bb-bnc}/src/mock.rs | 16 +- pallets/{ve-minting => bb-bnc}/src/tests.rs | 314 ++++++------ pallets/{ve-minting => bb-bnc}/src/traits.rs | 8 +- pallets/{ve-minting => bb-bnc}/src/weights.rs | 460 ++++++++--------- pallets/buy-back/Cargo.toml | 2 +- pallets/buy-back/src/lib.rs | 6 +- pallets/buy-back/src/mock.rs | 16 +- pallets/buy-back/src/tests.rs | 12 +- pallets/clouds-convert/Cargo.toml | 4 +- pallets/clouds-convert/src/lib.rs | 8 +- pallets/clouds-convert/src/mock.rs | 14 +- pallets/clouds-convert/src/tests.rs | 4 +- pallets/farming/Cargo.toml | 4 +- pallets/farming/src/boost.rs | 6 +- pallets/farming/src/gauge.rs | 10 +- pallets/farming/src/lib.rs | 10 +- pallets/farming/src/mock.rs | 14 +- pallets/farming/src/rewards.rs | 2 +- pallets/farming/src/tests.rs | 17 +- pallets/fee-share/src/mock.rs | 2 +- pallets/leverage-staking/src/mock.rs | 2 +- pallets/salp/src/mock.rs | 2 +- pallets/slp-v2/src/mock.rs | 2 +- pallets/slp/src/mocks/mock.rs | 2 +- pallets/slp/src/mocks/mock_kusama.rs | 2 +- pallets/slpx/src/mock.rs | 2 +- pallets/stable-pool/src/mock.rs | 2 +- pallets/system-maker/src/mock.rs | 2 +- pallets/system-staking/src/mock.rs | 4 +- pallets/vtoken-minting/Cargo.toml | 2 +- pallets/vtoken-minting/src/lib.rs | 16 +- pallets/vtoken-minting/src/mock.rs | 12 +- runtime/bifrost-kusama/src/lib.rs | 4 +- runtime/bifrost-polkadot/Cargo.toml | 12 +- runtime/bifrost-polkadot/src/lib.rs | 34 +- .../{bifrost_ve_minting.rs => bb_bnc.rs} | 462 +++++++++--------- runtime/bifrost-polkadot/src/weights/mod.rs | 2 +- runtime/bifrost-polkadot/src/xcm_config.rs | 10 +- 51 files changed, 905 insertions(+), 920 deletions(-) rename pallets/{ve-minting => bb-bnc}/Cargo.toml (98%) rename pallets/{ve-minting => bb-bnc}/rpc/Cargo.toml (84%) rename pallets/{ve-minting => bb-bnc}/rpc/runtime-api/Cargo.toml (90%) rename pallets/{ve-minting => bb-bnc}/rpc/runtime-api/src/lib.rs (96%) rename pallets/{ve-minting => bb-bnc}/rpc/src/lib.rs (90%) rename pallets/{ve-minting => bb-bnc}/src/benchmarking.rs (84%) rename pallets/{ve-minting => bb-bnc}/src/incentive.rs (93%) rename pallets/{ve-minting => bb-bnc}/src/lib.rs (98%) rename pallets/{ve-minting => bb-bnc}/src/mock.rs (97%) rename pallets/{ve-minting => bb-bnc}/src/tests.rs (65%) rename pallets/{ve-minting => bb-bnc}/src/traits.rs (98%) rename pallets/{ve-minting => bb-bnc}/src/weights.rs (52%) rename runtime/bifrost-polkadot/src/weights/{bifrost_ve_minting.rs => bb_bnc.rs} (51%) diff --git a/Cargo.lock b/Cargo.lock index 7ef1c4de3..564db9f5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -861,6 +861,67 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +[[package]] +name = "bb-bnc" +version = "0.8.0" +dependencies = [ + "bifrost-asset-registry", + "bifrost-currencies", + "bifrost-primitives", + "bifrost-runtime-common", + "bifrost-slp", + "bifrost-vtoken-minting", + "cumulus-primitives-core", + "env_logger", + "frame-benchmarking", + "frame-support", + "frame-system", + "hex-literal 0.4.1", + "log", + "orml-tokens", + "orml-traits", + "orml-xtokens", + "pallet-balances", + "pallet-collective", + "pallet-xcm", + "parity-scale-codec", + "scale-info", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)", + "staging-xcm", + "staging-xcm-builder", + "staging-xcm-executor", +] + +[[package]] +name = "bb-bnc-rpc" +version = "0.8.0" +dependencies = [ + "bb-bnc-rpc-runtime-api", + "bifrost-primitives", + "jsonrpsee", + "parity-scale-codec", + "serde", + "sp-api", + "sp-blockchain", + "sp-core", + "sp-rpc", + "sp-runtime", +] + +[[package]] +name = "bb-bnc-rpc-runtime-api" +version = "0.8.0" +dependencies = [ + "bifrost-primitives", + "parity-scale-codec", + "sp-api", + "sp-core", + "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)", +] + [[package]] name = "beef" version = "0.5.2" @@ -895,12 +956,12 @@ dependencies = [ name = "bifrost-buy-back" version = "0.8.0" dependencies = [ + "bb-bnc", "bifrost-asset-registry", "bifrost-currencies", "bifrost-primitives", "bifrost-runtime-common", "bifrost-slp", - "bifrost-ve-minting", "bifrost-vtoken-minting", "cumulus-primitives-core", "env_logger", @@ -984,10 +1045,10 @@ dependencies = [ name = "bifrost-clouds-convert" version = "0.8.0" dependencies = [ + "bb-bnc", "bifrost-asset-registry", "bifrost-currencies", "bifrost-primitives", - "bifrost-ve-minting", "frame-benchmarking", "frame-support", "frame-system", @@ -1047,11 +1108,11 @@ dependencies = [ name = "bifrost-farming" version = "0.8.0" dependencies = [ + "bb-bnc", "bifrost-asset-registry", "bifrost-currencies", "bifrost-primitives", "bifrost-runtime-common", - "bifrost-ve-minting", "env_logger", "frame-benchmarking", "frame-support", @@ -1405,6 +1466,8 @@ dependencies = [ name = "bifrost-polkadot-runtime" version = "0.8.0" dependencies = [ + "bb-bnc", + "bb-bnc-rpc-runtime-api", "bifrost-asset-registry", "bifrost-buy-back", "bifrost-channel-commission", @@ -1428,8 +1491,6 @@ dependencies = [ "bifrost-stable-pool-rpc-runtime-api", "bifrost-system-maker", "bifrost-system-staking", - "bifrost-ve-minting", - "bifrost-ve-minting-rpc-runtime-api", "bifrost-vesting", "bifrost-vstoken-conversion", "bifrost-vtoken-minting", @@ -1578,6 +1639,8 @@ dependencies = [ name = "bifrost-rpc" version = "0.8.0" dependencies = [ + "bb-bnc-rpc", + "bb-bnc-rpc-runtime-api", "bifrost-farming-rpc", "bifrost-farming-rpc-runtime-api", "bifrost-flexible-fee-rpc", @@ -1589,8 +1652,6 @@ dependencies = [ "bifrost-salp-rpc-runtime-api", "bifrost-stable-pool-rpc", "bifrost-stable-pool-rpc-runtime-api", - "bifrost-ve-minting-rpc", - "bifrost-ve-minting-rpc-runtime-api", "bifrost-vtoken-minting-rpc", "bifrost-vtoken-minting-rpc-runtime-api", "cumulus-primitives-core", @@ -1759,6 +1820,7 @@ name = "bifrost-service" version = "0.8.0" dependencies = [ "async-trait", + "bb-bnc-rpc-runtime-api", "bifrost-farming-rpc-runtime-api", "bifrost-flexible-fee-rpc-runtime-api", "bifrost-kusama-runtime", @@ -1768,7 +1830,6 @@ dependencies = [ "bifrost-rpc", "bifrost-runtime-common", "bifrost-salp-rpc-runtime-api", - "bifrost-ve-minting-rpc-runtime-api", "clap", "cumulus-client-cli", "cumulus-client-collator", @@ -2160,67 +2221,6 @@ dependencies = [ "staging-xcm-builder", ] -[[package]] -name = "bifrost-ve-minting" -version = "0.8.0" -dependencies = [ - "bifrost-asset-registry", - "bifrost-currencies", - "bifrost-primitives", - "bifrost-runtime-common", - "bifrost-slp", - "bifrost-vtoken-minting", - "cumulus-primitives-core", - "env_logger", - "frame-benchmarking", - "frame-support", - "frame-system", - "hex-literal 0.4.1", - "log", - "orml-tokens", - "orml-traits", - "orml-xtokens", - "pallet-balances", - "pallet-collective", - "pallet-xcm", - "parity-scale-codec", - "scale-info", - "sp-core", - "sp-io", - "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)", - "staging-xcm", - "staging-xcm-builder", - "staging-xcm-executor", -] - -[[package]] -name = "bifrost-ve-minting-rpc" -version = "0.8.0" -dependencies = [ - "bifrost-primitives", - "bifrost-ve-minting-rpc-runtime-api", - "jsonrpsee", - "parity-scale-codec", - "serde", - "sp-api", - "sp-blockchain", - "sp-core", - "sp-rpc", - "sp-runtime", -] - -[[package]] -name = "bifrost-ve-minting-rpc-runtime-api" -version = "0.8.0" -dependencies = [ - "bifrost-primitives", - "parity-scale-codec", - "sp-api", - "sp-core", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.13.0)", -] - [[package]] name = "bifrost-vesting" version = "0.8.0" @@ -2286,12 +2286,12 @@ dependencies = [ name = "bifrost-vtoken-minting" version = "0.8.0" dependencies = [ + "bb-bnc", "bifrost-asset-registry", "bifrost-currencies", "bifrost-primitives", "bifrost-runtime-common", "bifrost-slp", - "bifrost-ve-minting", "cumulus-primitives-core", "env_logger", "frame-benchmarking", diff --git a/Cargo.toml b/Cargo.toml index 056618f82..e2b412274 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ members = [ "pallets/system-maker", "pallets/fee-share", "pallets/parachain-staking", - "pallets/ve-minting", + "pallets/bb-bnc", "pallets/stable-pool", "pallets/lend-market", "pallets/prices", @@ -53,7 +53,7 @@ bifrost-flexible-fee-rpc = { path = "pallets/flexible-fee/rpc" } bifrost-rpc = { path = "node/rpc" } bifrost-salp-rpc = { path = "pallets/salp/rpc" } bifrost-stable-pool-rpc = { path = "pallets/stable-pool/rpc" } -bifrost-ve-minting-rpc = { path = "pallets/ve-minting/rpc" } +bb-bnc-rpc = { path = "pallets/bb-bnc/rpc" } lend-market-rpc = { path = "pallets/lend-market/rpc" } bifrost-vtoken-minting-rpc = { path = "pallets/vtoken-minting/rpc" } @@ -89,8 +89,8 @@ bifrost-system-maker = { path = "pallets/system-maker", defaul bifrost-system-staking = { path = "pallets/system-staking", default-features = false } bifrost-token-issuer = { path = "pallets/token-issuer", default-features = false } bifrost-vbnc-convert = { path = "pallets/vbnc-convert", default-features = false } -bifrost-ve-minting = { path = "pallets/ve-minting", default-features = false } -bifrost-ve-minting-rpc-runtime-api = { path = "pallets/ve-minting/rpc/runtime-api", default-features = false } +bb-bnc = { path = "pallets/bb-bnc", default-features = false } +bb-bnc-rpc-runtime-api = { path = "pallets/bb-bnc/rpc/runtime-api", default-features = false } bifrost-vesting = { path = "pallets/vesting", default-features = false } bifrost-vsbond-auction = { path = "pallets/vsbond-auction", default-features = false } bifrost-vstoken-conversion = { path = "pallets/vstoken-conversion", default-features = false } diff --git a/node/rpc/Cargo.toml b/node/rpc/Cargo.toml index 1254c4fdd..8ada17b5b 100644 --- a/node/rpc/Cargo.toml +++ b/node/rpc/Cargo.toml @@ -44,8 +44,8 @@ bifrost-salp-rpc = { workspace = true } bifrost-salp-rpc-runtime-api = { workspace = true } bifrost-farming-rpc = { workspace = true } bifrost-farming-rpc-runtime-api = { workspace = true } -bifrost-ve-minting-rpc = { workspace = true } -bifrost-ve-minting-rpc-runtime-api = { workspace = true } +bb-bnc-rpc = { workspace = true } +bb-bnc-rpc-runtime-api = { workspace = true } bifrost-stable-pool-rpc = { workspace = true } bifrost-stable-pool-rpc-runtime-api = { workspace = true } lend-market-rpc = { workspace = true } diff --git a/node/rpc/src/lib.rs b/node/rpc/src/lib.rs index 41dc9059b..1bfb4d3cd 100644 --- a/node/rpc/src/lib.rs +++ b/node/rpc/src/lib.rs @@ -33,6 +33,8 @@ use std::sync::Arc; +use bb_bnc_rpc::{BbBNCRpc, BbBNCRpcApiServer}; +use bb_bnc_rpc_runtime_api::BbBNCRuntimeApi; use bifrost_farming_rpc::{FarmingRpc, FarmingRpcApiServer}; use bifrost_farming_rpc_runtime_api::FarmingRuntimeApi; use bifrost_flexible_fee_rpc::{FeeRpcApiServer, FlexibleFeeRpc}; @@ -43,8 +45,6 @@ use bifrost_salp_rpc::{SalpRpc, SalpRpcApiServer}; use bifrost_salp_rpc_runtime_api::SalpRuntimeApi; use bifrost_stable_pool_rpc::{StablePoolRpc, StablePoolRpcApiServer}; use bifrost_stable_pool_rpc_runtime_api::StablePoolRuntimeApi; -use bifrost_ve_minting_rpc::{VeMintingRpc, VeMintingRpcApiServer}; -use bifrost_ve_minting_rpc_runtime_api::VeMintingRuntimeApi; use bifrost_vtoken_minting_rpc::{VtokenMintingRpc, VtokenMintingRpcApiServer}; use bifrost_vtoken_minting_rpc_runtime_api::VtokenMintingRuntimeApi; use futures::channel::mpsc; @@ -152,7 +152,7 @@ where C::Api: FarmingRuntimeApi, C::Api: FeeRuntimeApi, C::Api: SalpRuntimeApi, - C::Api: VeMintingRuntimeApi, + C::Api: BbBNCRuntimeApi, C::Api: LendMarketApi, C::Api: VtokenMintingRuntimeApi, C::Api: ZenlinkProtocolRuntimeApi, @@ -169,7 +169,7 @@ where module.merge(FarmingRpc::new(client.clone()).into_rpc())?; module.merge(FlexibleFeeRpc::new(client.clone()).into_rpc())?; module.merge(SalpRpc::new(client.clone()).into_rpc())?; - module.merge(VeMintingRpc::new(client.clone()).into_rpc())?; + module.merge(BbBNCRpc::new(client.clone()).into_rpc())?; module.merge(ZenlinkProtocol::new(client.clone()).into_rpc())?; module.merge(StablePoolRpc::new(client.clone()).into_rpc())?; module.merge(LendMarket::new(client.clone()).into_rpc())?; diff --git a/node/service/Cargo.toml b/node/service/Cargo.toml index 74e8f9ac3..64b512682 100644 --- a/node/service/Cargo.toml +++ b/node/service/Cargo.toml @@ -124,7 +124,7 @@ fp-rpc = { workspace = true, features = ["default"] } bifrost-flexible-fee-rpc-runtime-api = { workspace = true } bifrost-salp-rpc-runtime-api = { workspace = true } bifrost-farming-rpc-runtime-api = { workspace = true } -bifrost-ve-minting-rpc-runtime-api = { workspace = true } +bb-bnc-rpc-runtime-api = { workspace = true } [features] default = [ "std" ] diff --git a/pallets/ve-minting/Cargo.toml b/pallets/bb-bnc/Cargo.toml similarity index 98% rename from pallets/ve-minting/Cargo.toml rename to pallets/bb-bnc/Cargo.toml index 122c7a7fa..2b9f27443 100644 --- a/pallets/ve-minting/Cargo.toml +++ b/pallets/bb-bnc/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "bifrost-ve-minting" +name = "bb-bnc" version = "0.8.0" authors = ["Kadokura "] edition = "2021" diff --git a/pallets/ve-minting/rpc/Cargo.toml b/pallets/bb-bnc/rpc/Cargo.toml similarity index 84% rename from pallets/ve-minting/rpc/Cargo.toml rename to pallets/bb-bnc/rpc/Cargo.toml index aa9fcb7ba..578fd700f 100644 --- a/pallets/ve-minting/rpc/Cargo.toml +++ b/pallets/bb-bnc/rpc/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "bifrost-ve-minting-rpc" +name = "bb-bnc-rpc" version = "0.8.0" authors = ["Kadokura "] edition = "2021" @@ -14,4 +14,4 @@ sp-blockchain = { workspace = true } sp-core = { workspace = true } sp-rpc = { workspace = true } bifrost-primitives = { workspace = true } -bifrost-ve-minting-rpc-runtime-api = { workspace = true } +bb-bnc-rpc-runtime-api = { workspace = true } diff --git a/pallets/ve-minting/rpc/runtime-api/Cargo.toml b/pallets/bb-bnc/rpc/runtime-api/Cargo.toml similarity index 90% rename from pallets/ve-minting/rpc/runtime-api/Cargo.toml rename to pallets/bb-bnc/rpc/runtime-api/Cargo.toml index afd1c5015..4ec16fe07 100644 --- a/pallets/ve-minting/rpc/runtime-api/Cargo.toml +++ b/pallets/bb-bnc/rpc/runtime-api/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "bifrost-ve-minting-rpc-runtime-api" +name = "bb-bnc-rpc-runtime-api" version = "0.8.0" authors = ["Kadokura "] edition = "2021" diff --git a/pallets/ve-minting/rpc/runtime-api/src/lib.rs b/pallets/bb-bnc/rpc/runtime-api/src/lib.rs similarity index 96% rename from pallets/ve-minting/rpc/runtime-api/src/lib.rs rename to pallets/bb-bnc/rpc/runtime-api/src/lib.rs index 153b3543b..b1309f318 100644 --- a/pallets/ve-minting/rpc/runtime-api/src/lib.rs +++ b/pallets/bb-bnc/rpc/runtime-api/src/lib.rs @@ -24,7 +24,7 @@ use sp_api::decl_runtime_apis; use sp_core::U256; decl_runtime_apis! { - pub trait VeMintingRuntimeApi where + pub trait BbBNCRuntimeApi where AccountId: Codec, BlockNumber: Codec, { diff --git a/pallets/ve-minting/rpc/src/lib.rs b/pallets/bb-bnc/rpc/src/lib.rs similarity index 90% rename from pallets/ve-minting/rpc/src/lib.rs rename to pallets/bb-bnc/rpc/src/lib.rs index 944d53838..f1483120d 100644 --- a/pallets/ve-minting/rpc/src/lib.rs +++ b/pallets/bb-bnc/rpc/src/lib.rs @@ -18,8 +18,8 @@ use std::{marker::PhantomData, sync::Arc}; +pub use bb_bnc_rpc_runtime_api::{self as runtime_api, BbBNCRuntimeApi}; use bifrost_primitives::Balance; -pub use bifrost_ve_minting_rpc_runtime_api::{self as runtime_api, VeMintingRuntimeApi}; use jsonrpsee::{ core::{async_trait, RpcResult}, proc_macros::rpc, @@ -37,27 +37,27 @@ use sp_runtime::{ }; #[rpc(client, server)] -pub trait VeMintingRpcApi { +pub trait BbBNCRpcApi { /// rpc method for getting user balance - #[method(name = "ve_minting_balanceOf")] + #[method(name = "bb_bnc_balanceOf")] fn balance_of(&self, who: AccountId, at: Option) -> RpcResult; /// RPC method to get total supply - #[method(name = "ve_minting_totalSupply")] + #[method(name = "bb_bnc_totalSupply")] fn total_supply(&self, at: Option) -> RpcResult; /// RPC method to find block epoch - #[method(name = "ve_minting_findBlockEpoch")] + #[method(name = "bb_bnc_findBlockEpoch")] fn find_block_epoch(&self, max_epoch: U256, at: Option) -> RpcResult; } #[derive(Clone, Debug)] -pub struct VeMintingRpc { +pub struct BbBNCRpc { client: Arc, _marker: PhantomData, } -impl VeMintingRpc +impl BbBNCRpc where Block: BlockT, C: BlockIdTo, @@ -68,12 +68,12 @@ where } #[async_trait] -impl VeMintingRpcApiServer<::Hash, AccountId> - for VeMintingRpc +impl BbBNCRpcApiServer<::Hash, AccountId> + for BbBNCRpc where Block: BlockT, C: Send + Sync + 'static + ProvideRuntimeApi + HeaderBackend + BlockIdTo, - C::Api: VeMintingRuntimeApi, + C::Api: BbBNCRuntimeApi, AccountId: Codec, // CallError: From<>::Error>, { diff --git a/pallets/ve-minting/src/benchmarking.rs b/pallets/bb-bnc/src/benchmarking.rs similarity index 84% rename from pallets/ve-minting/src/benchmarking.rs rename to pallets/bb-bnc/src/benchmarking.rs index 93822ced8..26dcebcfe 100644 --- a/pallets/ve-minting/src/benchmarking.rs +++ b/pallets/bb-bnc/src/benchmarking.rs @@ -27,7 +27,7 @@ use frame_system::RawOrigin; use sp_runtime::traits::UniqueSaturatedFrom; use sp_std::vec; -use crate::{BalanceOf, Call, Config, Pallet as VeMinting, Pallet}; +use crate::{BalanceOf, Call, Config, Pallet as BbBNC, Pallet}; use orml_traits::MultiCurrency; benchmarks! { @@ -38,7 +38,7 @@ benchmarks! { create_lock { let test_account: T::AccountId = account("seed",1,1); - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -46,7 +46,7 @@ benchmarks! { T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - assert_ok!(VeMinting::::notify_rewards( + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, account("seed",1,1), Some((7 * 86400 / 12u32).into()),rewards @@ -56,7 +56,7 @@ benchmarks! { increase_amount { let test_account: T::AccountId = account("seed",1,1); - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -64,13 +64,13 @@ benchmarks! { T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - assert_ok!(VeMinting::::notify_rewards( + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, account("seed",1,1), Some((7 * 86400 / 12u32).into()),rewards )); - assert_ok!(VeMinting::::create_lock( + assert_ok!(BbBNC::::create_lock( RawOrigin::Signed(test_account.clone()).into(), BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() @@ -80,7 +80,7 @@ benchmarks! { increase_unlock_time { let test_account: T::AccountId = account("seed",1,1); - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -88,13 +88,13 @@ benchmarks! { T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - assert_ok!(VeMinting::::notify_rewards( + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, account("seed",1,1), Some((7 * 86400 / 12u32).into()),rewards )); - assert_ok!(VeMinting::::create_lock( + assert_ok!(BbBNC::::create_lock( RawOrigin::Signed(test_account.clone()).into(), BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() @@ -104,7 +104,7 @@ benchmarks! { withdraw { let test_account: T::AccountId = account("seed",1,1); - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -112,13 +112,13 @@ benchmarks! { T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - assert_ok!(VeMinting::::notify_rewards( + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, account("seed",1,1), Some((7 * 86400 / 12u32).into()),rewards )); - assert_ok!(VeMinting::::create_lock( + assert_ok!(BbBNC::::create_lock( RawOrigin::Signed(test_account.clone()).into(), BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() @@ -130,7 +130,7 @@ benchmarks! { get_rewards { let test_account: T::AccountId = account("seed",1,1); - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -138,13 +138,13 @@ benchmarks! { T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - assert_ok!(VeMinting::::notify_rewards( + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, account("seed",1,1), Some((7 * 86400 / 12u32).into()),rewards )); - assert_ok!(VeMinting::::create_lock( + assert_ok!(BbBNC::::create_lock( RawOrigin::Signed(test_account.clone()).into(), BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() @@ -155,7 +155,7 @@ benchmarks! { }: _(RawOrigin::Signed(test_account)) notify_rewards { - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -165,7 +165,7 @@ benchmarks! { }: _(RawOrigin::Root,account("seed",1,1),Some((7 * 86400 / 12u32).into()),rewards) set_markup_coefficient { - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -175,7 +175,7 @@ benchmarks! { deposit_markup { let test_account: T::AccountId = account("seed",1,1); - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -183,18 +183,18 @@ benchmarks! { T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - assert_ok!(VeMinting::::notify_rewards( + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, account("seed",1,1), Some((7 * 86400 / 12u32).into()),rewards )); - assert_ok!(VeMinting::::create_lock( + assert_ok!(BbBNC::::create_lock( RawOrigin::Signed(test_account.clone()).into(), BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() )); - assert_ok!(VeMinting::::set_markup_coefficient( + assert_ok!(BbBNC::::set_markup_coefficient( RawOrigin::Root.into(), CurrencyId::VToken(TokenSymbol::BNC), 1_000.into(), @@ -206,7 +206,7 @@ benchmarks! { withdraw_markup { let test_account: T::AccountId = account("seed",1,1); - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -214,31 +214,31 @@ benchmarks! { T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - assert_ok!(VeMinting::::notify_rewards( + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, account("seed",1,1), Some((7 * 86400 / 12u32).into()),rewards )); - assert_ok!(VeMinting::::create_lock( + assert_ok!(BbBNC::::create_lock( RawOrigin::Signed(test_account.clone()).into(), BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() )); - assert_ok!(VeMinting::::set_markup_coefficient( + assert_ok!(BbBNC::::set_markup_coefficient( RawOrigin::Root.into(), CurrencyId::VToken(TokenSymbol::BNC), 1_000.into(), 10_000_000_000_000.into() )); - assert_ok!(VeMinting::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))); + assert_ok!(BbBNC::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))); >::set_block_number((2 * 365 * 86400 / 12u32).into()); }: _(RawOrigin::Signed(test_account), CurrencyId::VToken(TokenSymbol::BNC)) redeem_unlock { let test_account: T::AccountId = account("seed",1,1); - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -246,31 +246,31 @@ benchmarks! { T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - assert_ok!(VeMinting::::notify_rewards( + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, account("seed",1,1), Some((7 * 86400 / 12u32).into()),rewards )); - assert_ok!(VeMinting::::create_lock( + assert_ok!(BbBNC::::create_lock( RawOrigin::Signed(test_account.clone()).into(), BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() )); - assert_ok!(VeMinting::::set_markup_coefficient( + assert_ok!(BbBNC::::set_markup_coefficient( RawOrigin::Root.into(), CurrencyId::VToken(TokenSymbol::BNC), 1_000.into(), 10_000_000_000_000.into() )); - assert_ok!(VeMinting::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))); + assert_ok!(BbBNC::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))); >::set_block_number((2 * 86400 / 12u32).into()); }: _(RawOrigin::Signed(test_account), 0) refresh { let test_account: T::AccountId = account("seed",1,1); - assert_ok!(VeMinting::::set_config( + assert_ok!(BbBNC::::set_config( RawOrigin::Root.into(), Some((4 * 365 * 86400 / 12u32).into()), Some((7 * 86400 / 12u32).into()) @@ -278,27 +278,27 @@ benchmarks! { T::MultiCurrency::deposit(CurrencyId::Native(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; T::MultiCurrency::deposit(CurrencyId::VToken(TokenSymbol::BNC), &test_account, BalanceOf::::unique_saturated_from(100_000_000_000_000u128))?; let rewards = vec![(CurrencyId::Native(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))]; - assert_ok!(VeMinting::::notify_rewards( + assert_ok!(BbBNC::::notify_rewards( T::ControlOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?, account("seed",1,1), Some((7 * 86400 / 12u32).into()),rewards )); - assert_ok!(VeMinting::::create_lock( + assert_ok!(BbBNC::::create_lock( RawOrigin::Signed(test_account.clone()).into(), BalanceOf::::unique_saturated_from(10_000_000_000_000u128), (365 * 86400 / 12u32).into() )); - assert_ok!(VeMinting::::set_markup_coefficient( + assert_ok!(BbBNC::::set_markup_coefficient( RawOrigin::Root.into(), CurrencyId::VToken(TokenSymbol::BNC), 1_000.into(), 10_000_000_000_000.into() )); - assert_ok!(VeMinting::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))); + assert_ok!(BbBNC::::deposit_markup(RawOrigin::Signed(test_account.clone()).into(), CurrencyId::VToken(TokenSymbol::BNC), BalanceOf::::unique_saturated_from(10_000_000_000_000u128))); >::set_block_number((2 * 86400 / 12u32).into()); }: _(RawOrigin::Signed(test_account), CurrencyId::VToken(TokenSymbol::BNC)) - impl_benchmark_test_suite!(VeMinting,crate::mock::ExtBuilder::default().build(),crate::mock::Runtime); + impl_benchmark_test_suite!(BbBNC,crate::mock::ExtBuilder::default().build(),crate::mock::Runtime); } diff --git a/pallets/ve-minting/src/incentive.rs b/pallets/bb-bnc/src/incentive.rs similarity index 93% rename from pallets/ve-minting/src/incentive.rs rename to pallets/bb-bnc/src/incentive.rs index 8f2e5355f..4edfcb1eb 100644 --- a/pallets/ve-minting/src/incentive.rs +++ b/pallets/bb-bnc/src/incentive.rs @@ -16,7 +16,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use crate::{traits::VeMintingInterface, *}; +use crate::{traits::BbBNCInterface, *}; use bifrost_primitives::PoolId; pub use pallet::*; use sp_std::collections::btree_map::BTreeMap; @@ -136,6 +136,15 @@ impl Pallet { // and total share. match share_info { Some((share, total_share)) => { + let mut pools = UserFarmingPool::::get(addr); + if share.is_zero() { + if let Some(pos) = pools.iter().position(|&x| x == pool_id) { + pools.remove(pos); + } + } else { + pools.try_push(pool_id).map_err(|_| Error::::UserFarmingPoolOverflow)?; + } + UserFarmingPool::::insert(addr, pools); let reward = increment .checked_mul(U256::from(share.saturated_into::())) .ok_or(ArithmeticError::Overflow)? @@ -195,9 +204,13 @@ impl Pallet { } /// Update reward for all pools - pub fn update_reward_all(addr: Option<&AccountIdOf>) -> DispatchResult { - // TODO: pool_id - Self::update_reward(0, addr, None)?; + pub fn update_reward_all(addr: &AccountIdOf) -> DispatchResult { + UserFarmingPool::::get(addr) + .iter() + .try_for_each(|&pool_id| -> DispatchResult { + Self::update_reward(pool_id, Some(addr), None) + })?; + Self::update_reward(VE_MINTING_SYSTEM_POOL_ID, Some(addr), None)?; Ok(()) } @@ -225,8 +238,6 @@ impl Pallet { addr: addr.to_owned(), rewards: rewards.into_iter().collect(), }); - } else { - return Err(Error::::NoRewards.into()); } Ok(()) } diff --git a/pallets/ve-minting/src/lib.rs b/pallets/bb-bnc/src/lib.rs similarity index 98% rename from pallets/ve-minting/src/lib.rs rename to pallets/bb-bnc/src/lib.rs index 420ce9d0d..3e0728af3 100644 --- a/pallets/ve-minting/src/lib.rs +++ b/pallets/bb-bnc/src/lib.rs @@ -49,9 +49,7 @@ pub use incentive::*; use orml_traits::{LockIdentifier, MultiCurrency, MultiLockableCurrency}; use sp_core::{U256, U512}; use sp_std::{borrow::ToOwned, cmp::Ordering, collections::btree_map::BTreeMap, vec, vec::Vec}; -pub use traits::{ - LockedToken, MarkupCoefficientInfo, MarkupInfo, UserMarkupInfo, VeMintingInterface, -}; +pub use traits::{BbBNCInterface, LockedToken, MarkupCoefficientInfo, MarkupInfo, UserMarkupInfo}; pub use weights::WeightInfo; type BalanceOf = <::MultiCurrency as MultiCurrency>>::Balance; @@ -64,7 +62,7 @@ pub type CurrencyIdOf = <::MultiCurrency as MultiCurrency< const VE_LOCK_ID: LockIdentifier = *b"vebnclck"; const MARKUP_LOCK_ID: LockIdentifier = *b"vebncmkp"; -const VE_MINTING_SYSTEM_POOL_ID: PoolId = 0; +const VE_MINTING_SYSTEM_POOL_ID: PoolId = u32::MAX; #[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, Default)] pub struct VeConfig { amount: Balance, @@ -108,9 +106,6 @@ pub mod pallet { #[pallet::constant] type TokenType: Get; - #[pallet::constant] - type VeMintingPalletId: Get; - #[pallet::constant] type IncentivePalletId: Get; @@ -203,10 +198,10 @@ pub mod pallet { BelowMinimumMint, LockNotExist, LockExist, - NoRewards, ArgumentsError, ExceedsMaxPositions, NoController, + UserFarmingPoolOverflow, } #[pallet::storage] @@ -312,6 +307,16 @@ pub mod pallet { ValueQuery, >; + /// The pool ID of the user participating in the farming pool. + #[pallet::storage] + pub type UserFarmingPool = StorageMap< + _, + Blake2_128Concat, + AccountIdOf, + BoundedVec>, + ValueQuery, + >; + #[pallet::hooks] impl Hooks> for Pallet { fn on_initialize(n: BlockNumberFor) -> Weight { @@ -325,7 +330,7 @@ pub mod pallet { .err() { log::error!( - target: "ve-minting::notify_reward_amount", + target: "bb-bnc::notify_reward_amount", "Received invalid justification for {:?}", e, ); @@ -494,7 +499,7 @@ pub mod pallet { old_locked: LockedBalance, BlockNumberFor>, new_locked: LockedBalance, BlockNumberFor>, ) -> DispatchResult { - Self::update_reward_all(Some(who))?; + Self::update_reward_all(who)?; let mut u_old = Point::, BlockNumberFor>::default(); let mut u_new = Point::, BlockNumberFor>::default(); @@ -550,10 +555,6 @@ pub mod pallet { if g_epoch > U256::zero() { last_point = PointHistory::::get(g_epoch); } else { - // last_point.amount = T::MultiCurrency::free_balance( - // T::TokenType::get(), - // &T::VeMintingPalletId::get().into_account_truncating(), - // ); last_point.amount = Supply::::get(); } let mut last_checkpoint = last_point.block; @@ -603,10 +604,6 @@ pub mod pallet { // Fill for the current block, if applicable if t_i == current_block_number { last_point.amount = Supply::::get(); - // last_point.amount = T::MultiCurrency::free_balance( - // T::TokenType::get(), - // &T::VeMintingPalletId::get().into_account_truncating(), - // ); break; } else { PointHistory::::insert(g_epoch, last_point); diff --git a/pallets/ve-minting/src/mock.rs b/pallets/bb-bnc/src/mock.rs similarity index 97% rename from pallets/ve-minting/src/mock.rs rename to pallets/bb-bnc/src/mock.rs index f701c92c2..0f5aff4bd 100644 --- a/pallets/ve-minting/src/mock.rs +++ b/pallets/bb-bnc/src/mock.rs @@ -21,7 +21,7 @@ #![cfg(test)] #![allow(non_upper_case_globals)] -use crate as bifrost_ve_minting; +use crate as bb_bnc; use bifrost_asset_registry::AssetIdMaps; use bifrost_primitives::MoonbeamChainId; pub use bifrost_primitives::{ @@ -68,7 +68,7 @@ frame_support::construct_runtime!( VtokenMinting: bifrost_vtoken_minting, Slp: bifrost_slp, AssetRegistry: bifrost_asset_registry, - VeMinting: bifrost_ve_minting, + BbBNC: bb_bnc, PolkadotXcm: pallet_xcm, } ); @@ -225,7 +225,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } @@ -240,9 +240,8 @@ impl bifrost_asset_registry::Config for Runtime { } 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 BbBNCTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); + pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck"); pub const Week: BlockNumber = 50400; // a week pub const MaxBlock: BlockNumber = 10512000; // four years @@ -252,12 +251,11 @@ parameter_types! { pub const MarkupRefreshLimit: u32 = 100; } -impl bifrost_ve_minting::Config for Runtime { +impl bb_bnc::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; type ControlOrigin = EnsureRoot; - type TokenType = VeMintingTokenType; - type VeMintingPalletId = VeMintingPalletId; + type TokenType = BbBNCTokenType; type IncentivePalletId = IncentivePalletId; type BuyBackAccount = BuyBackAccount; type WeightInfo = (); diff --git a/pallets/ve-minting/src/tests.rs b/pallets/bb-bnc/src/tests.rs similarity index 65% rename from pallets/ve-minting/src/tests.rs rename to pallets/bb-bnc/src/tests.rs index 78247e72e..45a80b53f 100644 --- a/pallets/ve-minting/src/tests.rs +++ b/pallets/bb-bnc/src/tests.rs @@ -20,7 +20,7 @@ #![cfg(test)] -use crate::{mock::*, traits::VeMintingInterface, *}; +use crate::{mock::*, traits::BbBNCInterface, *}; use bifrost_asset_registry::AssetMetadata; use bifrost_primitives::TokenInfo; use bifrost_runtime_common::milli; @@ -28,7 +28,6 @@ use frame_support::{assert_noop, assert_ok}; const POSITIONID0: u128 = 0; const POSITIONID1: u128 = 1; -const POOLID0: PoolId = 0; #[test] fn create_lock_should_work() { @@ -36,8 +35,8 @@ fn create_lock_should_work() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + (4 * 365 * 86400 - 5 * 86400) / 12, @@ -46,8 +45,8 @@ fn create_lock_should_work() { UserPointHistory::::get(POSITIONID0, U256::from(1)), Point { bias: 9972575751740, slope: 951293, block: 20, amount: 10000000000000 } ); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(9972575751740)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(9972575751740)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(9972575751740)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(9972575751740)); }); } @@ -57,8 +56,8 @@ fn create_multi_locks_should_work() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + (4 * 365 * 86400 - 5 * 86400) / 12, @@ -67,9 +66,9 @@ fn create_multi_locks_should_work() { UserPointHistory::::get(POSITIONID0, U256::from(1)), Point { bias: 9972575751740, slope: 951293, block: 20, amount: 10000000000000 } ); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(9972575751740)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(9972575751740)); - assert_ok!(VeMinting::create_lock_inner( + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(9972575751740)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(9972575751740)); + assert_ok!(BbBNC::create_lock_inner( &BOB, 5_000_000_000_000, System::block_number() + (2 * 365 * 86400 - 5 * 86400) / 12, @@ -78,8 +77,8 @@ fn create_multi_locks_should_work() { UserPointHistory::::get(POSITIONID1, U256::from(1)), Point { bias: 2493136560680, slope: 475646, block: 20, amount: 5000000000000 } ); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(12465712312420)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(12465712312420)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(12465712312420)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(12465712312420)); }); } @@ -89,22 +88,22 @@ fn increase_unlock_time_should_work() { asset_registry(); System::set_block_number(System::block_number() + 7 * 86400 / 12); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + (3 * 365 * 86400 - 5 * 86400) / 12, )); assert_eq!(Locked::::get(POSITIONID0).end, 7963200); assert_noop!( - VeMinting::increase_unlock_time( + BbBNC::increase_unlock_time( RuntimeOrigin::signed(BOB), POSITIONID0, System::block_number() + 365 * 86400 / 12 ), Error::::ArgumentsError ); - assert_ok!(VeMinting::increase_unlock_time( + assert_ok!(BbBNC::increase_unlock_time( RuntimeOrigin::signed(BOB), POSITIONID0, (365 * 86400 - 5 * 86400) / 12 @@ -114,8 +113,8 @@ fn increase_unlock_time_should_work() { Point { bias: 7527391250400, slope: 951293, block: 50400, amount: 10000000000000 } ); assert_eq!(Locked::::get(POSITIONID0).end, 10584000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(10020539944800)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(10020539944800)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(10020539944800)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(10020539944800)); }); } @@ -125,22 +124,22 @@ fn increase_unlock_time_should_work2() { asset_registry(); System::set_block_number(System::block_number() + 7 * 86400 / 12); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + (3 * 365 * 86400 - 5 * 86400) / 12, )); assert_eq!(Locked::::get(POSITIONID0).end, 7963200); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(7527391250400)); - assert_ok!(VeMinting::create_lock_inner( + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(7527391250400)); + assert_ok!(BbBNC::create_lock_inner( &BOB, 5_000_000_000_000, System::block_number() + (3 * 365 * 86400 - 5 * 86400) / 12, )); assert_eq!(Locked::::get(POSITIONID1).end, 7963200); assert_noop!( - VeMinting::increase_unlock_time( + BbBNC::increase_unlock_time( RuntimeOrigin::signed(BOB), POSITIONID0, System::block_number() + 365 * 86400 / 12 @@ -148,20 +147,20 @@ fn increase_unlock_time_should_work2() { Error::::ArgumentsError ); assert_noop!( - VeMinting::increase_unlock_time( + BbBNC::increase_unlock_time( RuntimeOrigin::signed(BOB), POSITIONID1, System::block_number() + 365 * 86400 / 12 ), Error::::ArgumentsError ); - assert_ok!(VeMinting::increase_unlock_time( + assert_ok!(BbBNC::increase_unlock_time( RuntimeOrigin::signed(BOB), POSITIONID0, (365 * 86400 - 5 * 86400) / 12 )); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(13784231613600)); - assert_ok!(VeMinting::increase_unlock_time( + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(13784231613600)); + assert_ok!(BbBNC::increase_unlock_time( RuntimeOrigin::signed(BOB), POSITIONID1, (365 * 86400 - 5 * 86400) / 12 @@ -176,8 +175,8 @@ fn increase_unlock_time_should_work2() { Point { bias: 3763691668800, slope: 475646, block: 50400, amount: 5000000000000 } ); assert_eq!(Locked::::get(POSITIONID1).end, 10584000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(15030804650400)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(15030804650400)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(15030804650400)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(15030804650400)); }); } @@ -186,21 +185,21 @@ fn update_reward() { ExtBuilder::default().one_hundred_for_alice_n_bob().build().execute_with(|| { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); System::set_block_number(System::block_number() + 40); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::create_lock_inner( &BOB, 100_000_000_000, System::block_number() + 365 * 86400 / 12, )); - assert_eq!(VeMinting::balance_of(&BOB, None), Ok(25407883680)); - assert_eq!(VeMinting::balance_of_position_current_block(0), Ok(25407883680)); - assert_ok!(VeMinting::deposit_for(&BOB, 0, 100_000_000_000)); - assert_ok!(VeMinting::update_reward(POOLID0, Some(&BOB), None)); // TODO + assert_eq!(BbBNC::balance_of(&BOB, None), Ok(25407883680)); + assert_eq!(BbBNC::balance_of_position_current_block(0), Ok(25407883680)); + assert_ok!(BbBNC::deposit_for(&BOB, 0, 100_000_000_000)); + assert_ok!(BbBNC::update_reward(VE_MINTING_SYSTEM_POOL_ID, Some(&BOB), None)); // TODO - assert_eq!(VeMinting::balance_of(&BOB, None), Ok(50818438500)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(50818438500)); + assert_eq!(BbBNC::balance_of(&BOB, None), Ok(50818438500)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(50818438500)); }); } @@ -226,26 +225,23 @@ fn notify_reward_amount() { ExtBuilder::default().one_hundred_for_alice_n_bob().build().execute_with(|| { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); System::set_block_number(System::block_number() + 40); - assert_ok!(VeMinting::get_rewards(RuntimeOrigin::signed(BOB))); // balance of veBNC is 0 - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::get_rewards(RuntimeOrigin::signed(BOB))); // balance of veBNC is 0 + assert_ok!(BbBNC::create_lock_inner( &BOB, 20_000_000_000, System::block_number() + (4 * 365 * 86400 - 7 * 86400) / 12, )); assert_eq!(Tokens::free_balance(KSM, &BOB), 0); // balance of veBNC is not 0 - assert_noop!( - VeMinting::get_rewards(RuntimeOrigin::signed(BOB)), - Error::::NoRewards - ); - assert_ok!(VeMinting::increase_amount(RuntimeOrigin::signed(BOB), 0, 80_000_000_000)); - assert_eq!(VeMinting::balance_of(&BOB, None), Ok(99715627680)); + assert_ok!(BbBNC::get_rewards(RuntimeOrigin::signed(BOB))); + assert_ok!(BbBNC::increase_amount(RuntimeOrigin::signed(BOB), 0, 80_000_000_000)); + assert_eq!(BbBNC::balance_of(&BOB, None), Ok(99715627680)); let rewards = vec![(KSM, 1_000_000_000)]; - assert_ok!(VeMinting::notify_rewards( + assert_ok!(BbBNC::notify_rewards( RuntimeOrigin::root(), ALICE, Some(7 * 86400 / 12), @@ -254,31 +250,31 @@ fn notify_reward_amount() { assert_eq!(Tokens::free_balance(KSM, &BOB), 0); System::set_block_number(System::block_number() + 20); assert_eq!(Tokens::free_balance(KSM, &BOB), 0); - assert_ok!(VeMinting::get_rewards(RuntimeOrigin::signed(BOB))); + assert_ok!(BbBNC::get_rewards(RuntimeOrigin::signed(BOB))); assert_eq!(Tokens::free_balance(KSM, &BOB), 396819); System::set_block_number(System::block_number() + 7 * 86400 / 12); - assert_ok!(VeMinting::get_rewards_inner(POOLID0, &BOB, None)); + assert_ok!(BbBNC::get_rewards_inner(VE_MINTING_SYSTEM_POOL_ID, &BOB, None)); assert_eq!(Tokens::free_balance(KSM, &BOB), 999986398); - assert_ok!(VeMinting::notify_rewards( + assert_ok!(BbBNC::notify_rewards( RuntimeOrigin::root(), ALICE, Some(7 * 86400 / 12), rewards )); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::create_lock_inner( &CHARLIE, 100_000_000_000, (4 * 365 * 86400 - 7 * 86400) / 12 )); System::set_block_number(System::block_number() + 1 * 86400 / 12); - assert_ok!(VeMinting::get_rewards_inner(POOLID0, &BOB, None)); + assert_ok!(BbBNC::get_rewards_inner(VE_MINTING_SYSTEM_POOL_ID, &BOB, None)); assert_eq!(Tokens::free_balance(KSM, &BOB), 1071241763); - assert_ok!(VeMinting::get_rewards_inner(POOLID0, &CHARLIE, None)); + assert_ok!(BbBNC::get_rewards_inner(VE_MINTING_SYSTEM_POOL_ID, &CHARLIE, None)); assert_eq!(Tokens::free_balance(KSM, &CHARLIE), 71599834); System::set_block_number(System::block_number() + 7 * 86400 / 12); - assert_ok!(VeMinting::get_rewards_inner(POOLID0, &CHARLIE, None)); + assert_ok!(BbBNC::get_rewards_inner(VE_MINTING_SYSTEM_POOL_ID, &CHARLIE, None)); assert_eq!(Tokens::free_balance(KSM, &CHARLIE), 501203849); - assert_ok!(VeMinting::get_rewards_inner(POOLID0, &BOB, None)); + assert_ok!(BbBNC::get_rewards_inner(VE_MINTING_SYSTEM_POOL_ID, &BOB, None)); assert_eq!(Tokens::free_balance(KSM, &BOB), 1498768947); }); } @@ -288,24 +284,24 @@ fn create_lock_to_withdraw() { ExtBuilder::default().one_hundred_for_alice_n_bob().build().execute_with(|| { asset_registry(); System::set_block_number(System::block_number() + 7 * 86400 / 12); // a week - assert_ok!(VeMinting::set_config( + assert_ok!(BbBNC::set_config( RuntimeOrigin::root(), Some(4 * 365 * 86400 / 12), Some(14 * 86400 / 12) )); let rewards = vec![(KSM, 1000)]; - assert_ok!(VeMinting::notify_rewards( + assert_ok!(BbBNC::notify_rewards( RuntimeOrigin::root(), ALICE, Some(7 * 86400 / 12), rewards )); assert_noop!( - VeMinting::increase_amount(RuntimeOrigin::signed(BOB), POSITIONID0, 50_000_000_000_000), + BbBNC::increase_amount(RuntimeOrigin::signed(BOB), POSITIONID0, 50_000_000_000_000), Error::::LockNotExist ); assert_noop!( - VeMinting::increase_unlock_time( + BbBNC::increase_unlock_time( RuntimeOrigin::signed(BOB), POSITIONID0, System::block_number() + 365 * 86400 / 12 @@ -313,7 +309,7 @@ fn create_lock_to_withdraw() { Error::::LockNotExist ); assert_noop!( - VeMinting::create_lock( + BbBNC::create_lock( RuntimeOrigin::signed(BOB), 50_000_000_000_000, System::block_number() + 5 * 365 * 86400 / 12 @@ -321,53 +317,53 @@ fn create_lock_to_withdraw() { Error::::ArgumentsError ); assert_noop!( - VeMinting::create_lock(RuntimeOrigin::signed(BOB), 50_000_000_000_000, 1), + BbBNC::create_lock(RuntimeOrigin::signed(BOB), 50_000_000_000_000, 1), Error::::ArgumentsError ); assert_noop!( - VeMinting::create_lock(RuntimeOrigin::signed(BOB), 50_000, 7 * 86400 / 12), + BbBNC::create_lock(RuntimeOrigin::signed(BOB), 50_000, 7 * 86400 / 12), Error::::BelowMinimumMint ); assert_eq!(Tokens::free_balance(VBNC, &BOB), 1000000000000000); - assert_ok!(VeMinting::create_lock_inner(&BOB, 50_000_000_000_000, 365 * 86400 / 12)); + assert_ok!(BbBNC::create_lock_inner(&BOB, 50_000_000_000_000, 365 * 86400 / 12)); assert_noop!( - VeMinting::increase_unlock_time( + BbBNC::increase_unlock_time( RuntimeOrigin::signed(BOB), POSITIONID0, System::block_number() + 5 * 365 * 86400 / 12 ), Error::::ArgumentsError ); - assert_eq!(VeMinting::balance_of_at(&BOB, System::block_number()), Ok(12705477321600)); - assert_eq!(VeMinting::balance_of_at(&BOB, System::block_number() - 10), Ok(0)); - assert_eq!(VeMinting::balance_of_at(&BOB, 0), Ok(0)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number() - 10)), Ok(0)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(12705477321600)); + assert_eq!(BbBNC::balance_of_at(&BOB, System::block_number()), Ok(12705477321600)); + assert_eq!(BbBNC::balance_of_at(&BOB, System::block_number() - 10), Ok(0)); + assert_eq!(BbBNC::balance_of_at(&BOB, 0), Ok(0)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number() - 10)), Ok(0)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(12705477321600)); assert_noop!( - VeMinting::increase_amount(RuntimeOrigin::signed(BOB), 0, 50_000), + BbBNC::increase_amount(RuntimeOrigin::signed(BOB), 0, 50_000), Error::::BelowMinimumMint ); - assert_ok!(VeMinting::increase_amount(RuntimeOrigin::signed(BOB), 0, 50_000_000_000_000)); - assert_eq!(VeMinting::balance_of(&BOB, None), Ok(25410957314400)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(25410957314400)); + assert_ok!(BbBNC::increase_amount(RuntimeOrigin::signed(BOB), 0, 50_000_000_000_000)); + assert_eq!(BbBNC::balance_of(&BOB, None), Ok(25410957314400)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(25410957314400)); assert_noop!( - VeMinting::withdraw(RuntimeOrigin::signed(ALICE), POSITIONID0), + BbBNC::withdraw(RuntimeOrigin::signed(ALICE), POSITIONID0), Error::::LockNotExist ); assert_noop!( - VeMinting::withdraw(RuntimeOrigin::signed(BOB), POSITIONID0), + BbBNC::withdraw(RuntimeOrigin::signed(BOB), POSITIONID0), Error::::Expired ); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(25410957314400)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(25410957314400)); System::set_block_number(System::block_number() + 2 * 365 * 86400 / 12); - assert_eq!(VeMinting::balance_of(&BOB, None), Ok(0)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(0)); - assert_ok!(VeMinting::withdraw(RuntimeOrigin::signed(BOB), POSITIONID0)); - assert_ok!(VeMinting::withdraw_inner(&BOB, 0)); - assert_ok!(VeMinting::withdraw_inner(&BOB, 1)); - assert_eq!(VeMinting::balance_of(&BOB, None), Ok(0)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(0)); + assert_eq!(BbBNC::balance_of(&BOB, None), Ok(0)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(0)); + assert_ok!(BbBNC::withdraw(RuntimeOrigin::signed(BOB), POSITIONID0)); + assert_ok!(BbBNC::withdraw_inner(&BOB, 0)); + assert_ok!(BbBNC::withdraw_inner(&BOB, 1)); + assert_eq!(BbBNC::balance_of(&BOB, None), Ok(0)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(0)); }); } @@ -375,10 +371,10 @@ fn create_lock_to_withdraw() { fn overflow() { ExtBuilder::default().one_hundred_for_alice_n_bob().build().execute_with(|| { asset_registry(); - assert_ok!(VeMinting::create_lock_inner(&BOB, 100_000_000_000_000, 77000)); + assert_ok!(BbBNC::create_lock_inner(&BOB, 100_000_000_000_000, 77000)); System::set_block_number(77001); - assert_eq!(VeMinting::balance_of(&BOB, Some(77001)), Ok(226398387663)); - assert_eq!(VeMinting::total_supply(System::block_number()), Ok(226398387663)); + assert_eq!(BbBNC::balance_of(&BOB, Some(77001)), Ok(226398387663)); + assert_eq!(BbBNC::total_supply(System::block_number()), Ok(226398387663)); }); } @@ -388,15 +384,15 @@ fn deposit_markup_before_lock_should_work() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VBNC, FixedU128::from_inner(100_000_000_000_000_000), // 0.1 FixedU128::saturating_from_integer(1), )); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, @@ -406,7 +402,7 @@ fn deposit_markup_before_lock_should_work() { Point { bias: 2796030953200, slope: 1046740, block: 20, amount: 11003333333333 } ); assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(2796030953200)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(2796030953200)); }); } @@ -416,20 +412,20 @@ fn deposit_markup_before_lock_should_work2() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VBNC, FixedU128::from_inner(100_000_000_000_000_000), // 0.1 FixedU128::saturating_from_integer(1), )); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, )); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::create_lock_inner( &BOB, 15_000_000_000_000, System::block_number() + 365 * 86400 / 12, @@ -445,11 +441,11 @@ fn deposit_markup_before_lock_should_work2() { assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); assert_eq!(Locked::::get(POSITIONID1).amount, 15_000_000_000_000); assert_eq!( - VeMinting::balance_of(&BOB, Some(System::block_number())), + BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(2796030953200 + 4194046429800) ); assert_eq!( - VeMinting::balance_of(&BOB, Some(System::block_number())), + BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(2796030953200 + 4194046429800) ); }); @@ -461,13 +457,13 @@ fn deposit_markup_after_lock_should_work2() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, )); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), MOVR, FixedU128::from_inner(500_000_000_000_000_000), // 0.5 @@ -484,7 +480,7 @@ fn deposit_markup_after_lock_should_work2() { ); assert_eq!(Tokens::ensure_can_withdraw(MOVR, &BOB, 10_000_000_000_000).is_ok(), true); assert_eq!(UserMarkupInfos::::get(BOB), None); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), MOVR, 9_000_000_000_000)); + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), MOVR, 9_000_000_000_000)); assert_eq!( UserMarkupInfos::::get(BOB), Some(UserMarkupInfo { @@ -492,7 +488,7 @@ fn deposit_markup_after_lock_should_work2() { markup_coefficient: FixedU128::from_inner(950_000_000_000_000_000), }) ); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), MOVR, 1_000_000_000_000)); + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), MOVR, 1_000_000_000_000)); assert_eq!( UserMarkupInfos::::get(BOB), Some(UserMarkupInfo { @@ -509,7 +505,7 @@ fn deposit_markup_after_lock_should_work2() { Point { bias: 5082152342660, slope: 1902587, block: 20, amount: 20000000000000 } ); assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(5082152342660)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(5082152342660)); }); } @@ -519,13 +515,13 @@ fn deposit_markup_after_lock_should_work() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, )); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VBNC, FixedU128::from_inner(100_000_000_000_000_000), // 0.1 @@ -536,13 +532,13 @@ fn deposit_markup_after_lock_should_work() { UserPointHistory::::get(POSITIONID0, U256::from(1)), Point { bias: 2541074835740, slope: 951293, block: 20, amount: 10000000000000 } ); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); assert_eq!( UserPointHistory::::get(POSITIONID0, U256::from(2)), Point { bias: 2796030953200, slope: 1046740, block: 20, amount: 11003333333333 } ); assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(2796030953200)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(2796030953200)); }); } @@ -552,20 +548,20 @@ fn withdraw_markup_after_lock_should_work() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, )); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VBNC, FixedU128::from_inner(100_000_000_000_000_000), // 0.1 FixedU128::saturating_from_integer(1), )); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); - assert_ok!(VeMinting::withdraw_markup(RuntimeOrigin::signed(BOB), VBNC)); + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); + assert_ok!(BbBNC::withdraw_markup(RuntimeOrigin::signed(BOB), VBNC)); assert_eq!( UserPointHistory::::get(POSITIONID0, U256::from(2)), Point { bias: 2796030953200, slope: 1046740, block: 20, amount: 11003333333333 } @@ -575,7 +571,7 @@ fn withdraw_markup_after_lock_should_work() { Point { bias: 2541074835740, slope: 951293, block: 20, amount: 10000000000000 } ); assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(2541074835740)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(2541074835740)); }); } @@ -585,18 +581,18 @@ fn redeem_unlock_should_work() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VKSM, FixedU128::from_inner(FixedU128::DIV / 10), // 0.1 FixedU128::saturating_from_integer(1), )); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), VKSM, 10_000_000_000_000)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(0)); + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), VKSM, 10_000_000_000_000)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(0)); assert_eq!(Tokens::free_balance(VBNC, &BOB), 1000000000000000); assert_eq!(Tokens::ensure_can_withdraw(VBNC, &BOB, 1000000000000000).is_ok(), true); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, @@ -606,11 +602,11 @@ fn redeem_unlock_should_work() { Point { bias: 5082152342660, slope: 1902587, block: 20, amount: 20000000000000 } ); assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(5082152342660)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(5082152342660)); assert_eq!(Tokens::free_balance(VBNC, &BOB), 1_000_000_000_000_000); assert_eq!(Tokens::ensure_can_withdraw(VBNC, &BOB, 1_000_000_000_000_000).is_ok(), false); - assert_ok!(VeMinting::redeem_unlock(RuntimeOrigin::signed(BOB), 0)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(0)); + assert_ok!(BbBNC::redeem_unlock(RuntimeOrigin::signed(BOB), 0)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(0)); assert_eq!(Tokens::free_balance(VBNC, &BOB), 997451711199422); assert_eq!(Tokens::ensure_can_withdraw(VBNC, &BOB, 997451711199422).is_ok(), true); }); @@ -622,25 +618,25 @@ fn withdraw_markup_after_lock_should_work3() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, )); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::create_lock_inner( &BOB, 15_000_000_000_000, System::block_number() + 365 * 86400 / 12, )); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VBNC, FixedU128::from_inner(100_000_000_000_000_000), // 0.1 FixedU128::saturating_from_integer(1), )); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); - assert_ok!(VeMinting::withdraw_markup(RuntimeOrigin::signed(BOB), VBNC)); + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); + assert_ok!(BbBNC::withdraw_markup(RuntimeOrigin::signed(BOB), VBNC)); assert_eq!( UserPointHistory::::get(POSITIONID0, U256::from(2)), Point { bias: 2796030953200, slope: 1046740, block: 20, amount: 11003333333333 } @@ -659,7 +655,7 @@ fn withdraw_markup_after_lock_should_work3() { ); assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); assert_eq!(Locked::::get(POSITIONID1).amount, 15_000_000_000_000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(6352688424940)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(6352688424940)); }); } @@ -669,18 +665,18 @@ fn redeem_unlock_after_360_days_should_work() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VKSM, FixedU128::from_inner(FixedU128::DIV / 10), // 0.1 FixedU128::saturating_from_integer(1), )); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), VKSM, 10_000_000_000_000)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(0)); + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), VKSM, 10_000_000_000_000)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(0)); assert_eq!(Tokens::free_balance(VBNC, &BOB), 1000000000000000); assert_eq!(Tokens::ensure_can_withdraw(VBNC, &BOB, 1000000000000000).is_ok(), true); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, @@ -690,12 +686,12 @@ fn redeem_unlock_after_360_days_should_work() { Point { bias: 5082152342660, slope: 1902587, block: 20, amount: 20000000000000 } ); assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(5082152342660)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(5082152342660)); assert_eq!(Tokens::free_balance(VBNC, &BOB), 1_000_000_000_000_000); assert_eq!(Tokens::ensure_can_withdraw(VBNC, &BOB, 1_000_000_000_000_000).is_ok(), false); System::set_block_number(System::block_number() + 360 * 86400 / 12); - assert_ok!(VeMinting::redeem_unlock(RuntimeOrigin::signed(BOB), 0)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(0)); + assert_ok!(BbBNC::redeem_unlock(RuntimeOrigin::signed(BOB), 0)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(0)); assert_eq!(Tokens::free_balance(VBNC, &BOB), 999336664330082); assert_eq!(Tokens::ensure_can_withdraw(VBNC, &BOB, 999336664330082).is_ok(), true); }); @@ -707,23 +703,23 @@ fn redeem_unlock_after_360_days_should_work2() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VKSM, FixedU128::from_inner(FixedU128::DIV / 10), // 0.1 FixedU128::saturating_from_integer(1), )); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), VKSM, 10_000_000_000_000)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(0)); + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), VKSM, 10_000_000_000_000)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(0)); assert_eq!(Tokens::free_balance(VBNC, &BOB), 1000000000000000); assert_eq!(Tokens::ensure_can_withdraw(VBNC, &BOB, 1000000000000000).is_ok(), true); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, )); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::create_lock_inner( &BOB, 15_000_000_000_000, System::block_number() + 365 * 86400 / 12, @@ -738,13 +734,13 @@ fn redeem_unlock_after_360_days_should_work2() { ); assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); assert_eq!(Locked::::get(POSITIONID1).amount, 15_000_000_000_000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(12705382192240)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(12705382192240)); assert_eq!(Tokens::free_balance(VBNC, &BOB), 1_000_000_000_000_000); assert_eq!(Tokens::ensure_can_withdraw(VBNC, &BOB, 1_000_000_000_000_000).is_ok(), false); System::set_block_number(System::block_number() + 360 * 86400 / 12); - assert_ok!(VeMinting::redeem_unlock(RuntimeOrigin::signed(BOB), POSITIONID0)); - assert_ok!(VeMinting::redeem_unlock(RuntimeOrigin::signed(BOB), POSITIONID1)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(0)); + assert_ok!(BbBNC::redeem_unlock(RuntimeOrigin::signed(BOB), POSITIONID0)); + assert_ok!(BbBNC::redeem_unlock(RuntimeOrigin::signed(BOB), POSITIONID1)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(0)); assert_eq!(Tokens::free_balance(VBNC, &BOB), 998341660825205); assert_eq!(Tokens::ensure_can_withdraw(VBNC, &BOB, 998341660825205).is_ok(), true); }); @@ -756,21 +752,21 @@ fn refresh_should_work() { asset_registry(); System::set_block_number(System::block_number() + 20); - assert_ok!(VeMinting::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_config(RuntimeOrigin::root(), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VBNC, FixedU128::from_inner(100_000_000_000_000_000), // 0.1 FixedU128::saturating_from_integer(1), )); - assert_ok!(VeMinting::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(0)); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::deposit_markup(RuntimeOrigin::signed(BOB), VBNC, 10_000_000_000_000)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(0)); + assert_ok!(BbBNC::create_lock_inner( &BOB, 10_000_000_000_000, System::block_number() + 365 * 86400 / 12, )); - assert_ok!(VeMinting::set_markup_coefficient( + assert_ok!(BbBNC::set_markup_coefficient( RuntimeOrigin::root(), VBNC, FixedU128::from_inner(200_000_000_000_000_000), // 0.2 @@ -784,7 +780,7 @@ fn refresh_should_work() { UserPointHistory::::get(POSITIONID0, U256::from(2)), Point { bias: 0, slope: 0, block: 0, amount: 0 } ); - assert_ok!(VeMinting::refresh_inner(RuntimeOrigin::signed(BOB), VBNC)); + assert_ok!(BbBNC::refresh_inner(RuntimeOrigin::signed(BOB), VBNC)); assert_eq!( UserPointHistory::::get(POSITIONID0, U256::one()), Point { bias: 2796030953200, slope: 1046740, block: 20, amount: 11003333333333 } @@ -794,8 +790,8 @@ fn refresh_should_work() { Point { bias: 3050984399480, slope: 1142186, block: 20, amount: 12006666666666 } ); assert_eq!(Locked::::get(POSITIONID0).amount, 10_000_000_000_000); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(3050984399480)); - assert_ok!(VeMinting::redeem_unlock(RuntimeOrigin::signed(BOB), 0)); - assert_eq!(VeMinting::balance_of(&BOB, Some(System::block_number())), Ok(0)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(3050984399480)); + assert_ok!(BbBNC::redeem_unlock(RuntimeOrigin::signed(BOB), 0)); + assert_eq!(BbBNC::balance_of(&BOB, Some(System::block_number())), Ok(0)); }); } diff --git a/pallets/ve-minting/src/traits.rs b/pallets/bb-bnc/src/traits.rs similarity index 98% rename from pallets/ve-minting/src/traits.rs rename to pallets/bb-bnc/src/traits.rs index 370a50010..3c705aa0e 100644 --- a/pallets/ve-minting/src/traits.rs +++ b/pallets/bb-bnc/src/traits.rs @@ -21,7 +21,7 @@ use bifrost_primitives::PoolId; // Ensure we're `no_std` when compiling for Wasm. use crate::*; -pub trait VeMintingInterface { +pub trait BbBNCInterface { fn deposit_for(_who: &AccountId, position: u128, value: Balance) -> DispatchResult; fn withdraw_inner(who: &AccountId, position: u128) -> DispatchResult; fn balance_of(addr: &AccountId, time: Option) -> Result; @@ -75,7 +75,7 @@ pub trait VeMintingInterface { ) -> DispatchResult; } -impl VeMintingInterface, CurrencyIdOf, BalanceOf, BlockNumberFor> +impl BbBNCInterface, CurrencyIdOf, BalanceOf, BlockNumberFor> for Pallet { fn create_lock_inner( @@ -286,7 +286,7 @@ impl VeMintingInterface, CurrencyIdOf, BalanceOf rewards: Vec<(CurrencyIdOf, BalanceOf)>, ) -> DispatchResult { let conf = IncentiveConfigs::::get(pool_id); - if n == conf.last_update_time + conf.rewards_duration { + if n == conf.period_finish { Self::notify_reward_amount(pool_id, &conf.incentive_controller, rewards)?; } Ok(()) @@ -385,7 +385,7 @@ impl VeMintingInterface, CurrencyIdOf, BalanceOf } impl - VeMintingInterface for () + BbBNCInterface for () where Balance: orml_traits::arithmetic::Zero, { diff --git a/pallets/ve-minting/src/weights.rs b/pallets/bb-bnc/src/weights.rs similarity index 52% rename from pallets/ve-minting/src/weights.rs rename to pallets/bb-bnc/src/weights.rs index 9181daf02..aca971f2c 100644 --- a/pallets/ve-minting/src/weights.rs +++ b/pallets/bb-bnc/src/weights.rs @@ -22,7 +22,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Autogenerated weights for bifrost_ve_minting +//! Autogenerated weights for bb_bnc //! //! 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: `[]` @@ -36,12 +36,12 @@ // --chain=bifrost-polkadot-local // --steps=50 // --repeat=20 -// --pallet=bifrost_ve_minting +// --pallet=bb_bnc // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=./pallets/ve-minting/src/weights.rs +// --output=./pallets/bb-bnc/src/weights.rs // --template=./weight-template/pallet-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -51,7 +51,7 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; -/// Weight functions needed for bifrost_ve_minting. +/// Weight functions needed for bb_bnc. pub trait WeightInfo { fn set_config() -> Weight; fn create_lock() -> Weight; @@ -69,8 +69,8 @@ pub trait WeightInfo { // For backwards compatibility and tests impl WeightInfo for () { - /// Storage: VeMinting VeConfigs (r:1 w:1) - /// Proof Skipped: VeMinting VeConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC VeConfigs (r:1 w:1) + /// Proof Skipped: BbBNC VeConfigs (max_values: Some(1), max_size: None, mode: Measured) /// 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) @@ -88,14 +88,14 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(5_u64)) .saturating_add(RocksDbWeight::get().writes(3_u64)) } - /// Storage: VeMinting VeConfigs (r:1 w:0) - /// Proof Skipped: VeMinting VeConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting Locked (r:1 w:1) - /// Proof Skipped: VeMinting Locked (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC VeConfigs (r:1 w:0) + /// Proof Skipped: BbBNC VeConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Locked (r:1 w:1) + /// Proof Skipped: BbBNC Locked (max_values: None, max_size: None, mode: Measured) /// Storage: System Number (r:1 w:0) /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: VeMinting Supply (r:1 w:1) - /// Proof Skipped: VeMinting Supply (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Supply (r:1 w:1) + /// Proof Skipped: BbBNC Supply (max_values: Some(1), max_size: None, mode: Measured) /// 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) @@ -108,22 +108,22 @@ impl WeightInfo for () { /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: System Events (r:1 w:1) /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting IncentiveConfigs (r:1 w:1) - /// Proof Skipped: VeMinting IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting Epoch (r:1 w:1) - /// Proof Skipped: VeMinting Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting PointHistory (r:1 w:1) - /// Proof Skipped: VeMinting PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointEpoch (r:1 w:1) - /// Proof Skipped: VeMinting UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting Rewards (r:1 w:0) - /// Proof Skipped: VeMinting Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting SlopeChanges (r:2 w:1) - /// Proof Skipped: VeMinting SlopeChanges (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointHistory (r:0 w:1) - /// Proof Skipped: VeMinting UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserRewardPerTokenPaid (r:0 w:1) - /// Proof Skipped: VeMinting UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC IncentiveConfigs (r:1 w:1) + /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Epoch (r:1 w:1) + /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC PointHistory (r:1 w:1) + /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointEpoch (r:1 w:1) + /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC Rewards (r:1 w:0) + /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC SlopeChanges (r:2 w:1) + /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointHistory (r:0 w:1) + /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserRewardPerTokenPaid (r:0 w:1) + /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) fn create_lock() -> Weight { // Proof Size summary in bytes: // Measured: `1439` @@ -133,14 +133,14 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(19_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } - /// Storage: VeMinting VeConfigs (r:1 w:0) - /// Proof Skipped: VeMinting VeConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting Locked (r:1 w:1) - /// Proof Skipped: VeMinting Locked (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC VeConfigs (r:1 w:0) + /// Proof Skipped: BbBNC VeConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Locked (r:1 w:1) + /// Proof Skipped: BbBNC Locked (max_values: None, max_size: None, mode: Measured) /// Storage: System Number (r:1 w:0) /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: VeMinting Supply (r:1 w:1) - /// Proof Skipped: VeMinting Supply (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Supply (r:1 w:1) + /// Proof Skipped: BbBNC Supply (max_values: Some(1), max_size: None, mode: Measured) /// 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) @@ -153,22 +153,22 @@ impl WeightInfo for () { /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: System Events (r:1 w:1) /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting IncentiveConfigs (r:1 w:1) - /// Proof Skipped: VeMinting IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting Epoch (r:1 w:1) - /// Proof Skipped: VeMinting Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting PointHistory (r:1 w:1) - /// Proof Skipped: VeMinting PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointEpoch (r:1 w:1) - /// Proof Skipped: VeMinting UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointHistory (r:1 w:1) - /// Proof Skipped: VeMinting UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting Rewards (r:1 w:1) - /// Proof Skipped: VeMinting Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserRewardPerTokenPaid (r:1 w:1) - /// Proof Skipped: VeMinting UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting SlopeChanges (r:1 w:1) - /// Proof Skipped: VeMinting SlopeChanges (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC IncentiveConfigs (r:1 w:1) + /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Epoch (r:1 w:1) + /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC PointHistory (r:1 w:1) + /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointEpoch (r:1 w:1) + /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointHistory (r:1 w:1) + /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC Rewards (r:1 w:1) + /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserRewardPerTokenPaid (r:1 w:1) + /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC SlopeChanges (r:1 w:1) + /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) fn increase_amount() -> Weight { // Proof Size summary in bytes: // Measured: `2083` @@ -178,30 +178,30 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(19_u64)) .saturating_add(RocksDbWeight::get().writes(14_u64)) } - /// Storage: VeMinting VeConfigs (r:1 w:0) - /// Proof Skipped: VeMinting VeConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting Locked (r:1 w:1) - /// Proof Skipped: VeMinting Locked (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC VeConfigs (r:1 w:0) + /// Proof Skipped: BbBNC VeConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Locked (r:1 w:1) + /// Proof Skipped: BbBNC Locked (max_values: None, max_size: None, mode: Measured) /// Storage: System Number (r:1 w:0) /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: VeMinting Supply (r:1 w:1) - /// Proof Skipped: VeMinting Supply (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting IncentiveConfigs (r:1 w:1) - /// Proof Skipped: VeMinting IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting Epoch (r:1 w:1) - /// Proof Skipped: VeMinting Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting PointHistory (r:1 w:1) - /// Proof Skipped: VeMinting PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointEpoch (r:1 w:1) - /// Proof Skipped: VeMinting UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointHistory (r:1 w:1) - /// Proof Skipped: VeMinting UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting Rewards (r:1 w:1) - /// Proof Skipped: VeMinting Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserRewardPerTokenPaid (r:1 w:1) - /// Proof Skipped: VeMinting UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting SlopeChanges (r:2 w:2) - /// Proof Skipped: VeMinting SlopeChanges (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC Supply (r:1 w:1) + /// Proof Skipped: BbBNC Supply (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC IncentiveConfigs (r:1 w:1) + /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Epoch (r:1 w:1) + /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC PointHistory (r:1 w:1) + /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointEpoch (r:1 w:1) + /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointHistory (r:1 w:1) + /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC Rewards (r:1 w:1) + /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserRewardPerTokenPaid (r:1 w:1) + /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC SlopeChanges (r:2 w:2) + /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) /// Storage: Tokens Accounts (r:1 w:0) /// Proof: Tokens Accounts (max_values: None, max_size: Some(118), added: 2593, mode: MaxEncodedLen) /// Storage: System ExecutionPhase (r:1 w:0) @@ -219,12 +219,12 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(17_u64)) .saturating_add(RocksDbWeight::get().writes(13_u64)) } - /// Storage: VeMinting Locked (r:1 w:1) - /// Proof Skipped: VeMinting Locked (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC Locked (r:1 w:1) + /// Proof Skipped: BbBNC Locked (max_values: None, max_size: None, mode: Measured) /// Storage: System Number (r:1 w:0) /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: VeMinting Supply (r:1 w:1) - /// Proof Skipped: VeMinting Supply (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Supply (r:1 w:1) + /// Proof Skipped: BbBNC Supply (max_values: Some(1), max_size: None, mode: Measured) /// 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) @@ -237,22 +237,22 @@ impl WeightInfo for () { /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: System Events (r:1 w:1) /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting IncentiveConfigs (r:1 w:1) - /// Proof Skipped: VeMinting IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting Epoch (r:1 w:1) - /// Proof Skipped: VeMinting Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting PointHistory (r:1 w:105) - /// Proof Skipped: VeMinting PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting SlopeChanges (r:104 w:0) - /// Proof Skipped: VeMinting SlopeChanges (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointEpoch (r:1 w:1) - /// Proof Skipped: VeMinting UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointHistory (r:1 w:1) - /// Proof Skipped: VeMinting UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting Rewards (r:1 w:1) - /// Proof Skipped: VeMinting Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserRewardPerTokenPaid (r:1 w:1) - /// Proof Skipped: VeMinting UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC IncentiveConfigs (r:1 w:1) + /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC Epoch (r:1 w:1) + /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC PointHistory (r:1 w:105) + /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC SlopeChanges (r:104 w:0) + /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointEpoch (r:1 w:1) + /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointHistory (r:1 w:1) + /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC Rewards (r:1 w:1) + /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserRewardPerTokenPaid (r:1 w:1) + /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) fn withdraw() -> Weight { // Proof Size summary in bytes: // Measured: `2059` @@ -262,24 +262,24 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(121_u64)) .saturating_add(RocksDbWeight::get().writes(118_u64)) } - /// Storage: VeMinting IncentiveConfigs (r:1 w:1) - /// Proof Skipped: VeMinting IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC IncentiveConfigs (r:1 w:1) + /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) /// Storage: System Number (r:1 w:0) /// Proof: System Number (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) - /// Storage: VeMinting Epoch (r:1 w:0) - /// Proof Skipped: VeMinting Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting PointHistory (r:1 w:0) - /// Proof Skipped: VeMinting PointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting SlopeChanges (r:104 w:0) - /// Proof Skipped: VeMinting SlopeChanges (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointEpoch (r:1 w:0) - /// Proof Skipped: VeMinting UserPointEpoch (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserPointHistory (r:1 w:0) - /// Proof Skipped: VeMinting UserPointHistory (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting Rewards (r:1 w:1) - /// Proof Skipped: VeMinting Rewards (max_values: None, max_size: None, mode: Measured) - /// Storage: VeMinting UserRewardPerTokenPaid (r:1 w:1) - /// Proof Skipped: VeMinting UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC Epoch (r:1 w:0) + /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC PointHistory (r:1 w:0) + /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC SlopeChanges (r:104 w:0) + /// Proof Skipped: BbBNC SlopeChanges (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointEpoch (r:1 w:0) + /// Proof Skipped: BbBNC UserPointEpoch (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserPointHistory (r:1 w:0) + /// Proof Skipped: BbBNC UserPointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC Rewards (r:1 w:1) + /// Proof Skipped: BbBNC Rewards (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC UserRewardPerTokenPaid (r:1 w:1) + /// Proof Skipped: BbBNC UserRewardPerTokenPaid (max_values: None, max_size: None, mode: Measured) /// Storage: Balances TotalIssuance (r:1 w:1) /// Proof: Balances TotalIssuance (max_values: Some(1), max_size: Some(16), added: 511, mode: MaxEncodedLen) /// Storage: System Account (r:3 w:3) @@ -299,8 +299,8 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(119_u64)) .saturating_add(RocksDbWeight::get().writes(9_u64)) } - /// Storage: VeMinting IncentiveConfigs (r:1 w:1) - /// Proof Skipped: VeMinting IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC IncentiveConfigs (r:1 w:1) + /// Proof Skipped: BbBNC IncentiveConfigs (max_values: Some(1), max_size: None, mode: Measured) /// 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) @@ -309,10 +309,10 @@ impl WeightInfo for () { /// Proof: System EventCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen) /// Storage: System Events (r:1 w:1) /// Proof Skipped: System Events (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting Epoch (r:1 w:0) - /// Proof Skipped: VeMinting Epoch (max_values: Some(1), max_size: None, mode: Measured) - /// Storage: VeMinting PointHistory (r:1 w:0) - /// Proof Skipped: VeMinting PointHistory (max_values: None, max_size: None, mode: Measured) + /// Storage: BbBNC Epoch (r:1 w:0) + /// Proof Skipped: BbBNC Epoch (max_values: Some(1), max_size: None, mode: Measured) + /// Storage: BbBNC PointHistory (r:1 w:0) + /// Proof Skipped: BbBNC PointHistory (max_values: None, max_size: None, mode: Measured) /// Storage: System Account (r:2 w:2) /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen) /// Storage: Balances TotalIssuance (r:1 w:0) @@ -326,12 +326,12 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(10_u64)) .saturating_add(RocksDbWeight::get().writes(5_u64)) } - /// Storage: `VeMinting::TotalLock` (r:1 w:1) - /// Proof: `VeMinting::TotalLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::TotalLock` (r:1 w:1) + /// Proof: `BbBNC::TotalLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Number` (r:1 w:0) /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `VeMinting::MarkupCoefficient` (r:0 w:1) - /// Proof: `VeMinting::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::MarkupCoefficient` (r:0 w:1) + /// Proof: `BbBNC::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) fn set_markup_coefficient() -> Weight { // Proof Size summary in bytes: // Measured: `213` @@ -342,16 +342,16 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(2)) .saturating_add(RocksDbWeight::get().writes(2)) } - /// Storage: `VeMinting::MarkupCoefficient` (r:1 w:0) - /// Proof: `VeMinting::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::TotalLock` (r:1 w:1) - /// Proof: `VeMinting::TotalLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::MarkupCoefficient` (r:1 w:0) + /// Proof: `BbBNC::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::TotalLock` (r:1 w:1) + /// Proof: `BbBNC::TotalLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Number` (r:1 w:0) /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `VeMinting::UserMarkupInfos` (r:1 w:1) - /// Proof: `VeMinting::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::LockedTokens` (r:1 w:1) - /// Proof: `VeMinting::LockedTokens` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserMarkupInfos` (r:1 w:1) + /// Proof: `BbBNC::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::LockedTokens` (r:1 w:1) + /// Proof: `BbBNC::LockedTokens` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Tokens::Locks` (r:1 w:1) /// Proof: `Tokens::Locks` (`max_values`: None, `max_size`: Some(1271), added: 3746, mode: `MaxEncodedLen`) /// Storage: `Tokens::Accounts` (r:1 w:1) @@ -364,28 +364,28 @@ impl WeightInfo for () { /// 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: `VeMinting::UserPositions` (r:1 w:0) - /// Proof: `VeMinting::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Locked` (r:1 w:0) - /// Proof: `VeMinting::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::IncentiveConfigs` (r:1 w:1) - /// Proof: `VeMinting::IncentiveConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Epoch` (r:1 w:1) - /// Proof: `VeMinting::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::PointHistory` (r:1 w:105) - /// Proof: `VeMinting::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::SlopeChanges` (r:104 w:0) - /// Proof: `VeMinting::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPointEpoch` (r:1 w:1) - /// Proof: `VeMinting::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPointHistory` (r:1 w:1) - /// Proof: `VeMinting::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Rewards` (r:1 w:1) - /// Proof: `VeMinting::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserRewardPerTokenPaid` (r:1 w:1) - /// Proof: `VeMinting::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Supply` (r:1 w:0) - /// Proof: `VeMinting::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPositions` (r:1 w:0) + /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Locked` (r:1 w:0) + /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Epoch` (r:1 w:1) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:105) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:104 w:0) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointEpoch` (r:1 w:1) + /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointHistory` (r:1 w:1) + /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Rewards` (r:1 w:1) + /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:1 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Supply` (r:1 w:0) + /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn deposit_markup() -> Weight { // Proof Size summary in bytes: // Measured: `2260` @@ -396,14 +396,14 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(125)) .saturating_add(RocksDbWeight::get().writes(118)) } - /// Storage: `VeMinting::MarkupCoefficient` (r:1 w:0) - /// Proof: `VeMinting::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserMarkupInfos` (r:1 w:1) - /// Proof: `VeMinting::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::LockedTokens` (r:1 w:1) - /// Proof: `VeMinting::LockedTokens` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::TotalLock` (r:1 w:1) - /// Proof: `VeMinting::TotalLock` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::MarkupCoefficient` (r:1 w:0) + /// Proof: `BbBNC::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserMarkupInfos` (r:1 w:1) + /// Proof: `BbBNC::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::LockedTokens` (r:1 w:1) + /// Proof: `BbBNC::LockedTokens` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::TotalLock` (r:1 w:1) + /// Proof: `BbBNC::TotalLock` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `Tokens::Locks` (r:1 w:1) /// Proof: `Tokens::Locks` (`max_values`: None, `max_size`: Some(1271), added: 3746, mode: `MaxEncodedLen`) /// Storage: `Tokens::Accounts` (r:1 w:1) @@ -418,28 +418,28 @@ impl WeightInfo for () { /// 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: `VeMinting::UserPositions` (r:1 w:0) - /// Proof: `VeMinting::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Locked` (r:1 w:0) - /// Proof: `VeMinting::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::IncentiveConfigs` (r:1 w:1) - /// Proof: `VeMinting::IncentiveConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Epoch` (r:1 w:1) - /// Proof: `VeMinting::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::PointHistory` (r:1 w:105) - /// Proof: `VeMinting::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::SlopeChanges` (r:104 w:0) - /// Proof: `VeMinting::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPointEpoch` (r:1 w:1) - /// Proof: `VeMinting::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPointHistory` (r:1 w:1) - /// Proof: `VeMinting::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Rewards` (r:1 w:1) - /// Proof: `VeMinting::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserRewardPerTokenPaid` (r:1 w:1) - /// Proof: `VeMinting::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Supply` (r:1 w:0) - /// Proof: `VeMinting::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPositions` (r:1 w:0) + /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Locked` (r:1 w:0) + /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Epoch` (r:1 w:1) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:105) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:104 w:0) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointEpoch` (r:1 w:1) + /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointHistory` (r:1 w:1) + /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Rewards` (r:1 w:1) + /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:1 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Supply` (r:1 w:0) + /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn withdraw_markup() -> Weight { // Proof Size summary in bytes: // Measured: `2725` @@ -450,16 +450,16 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(125)) .saturating_add(RocksDbWeight::get().writes(118)) } - /// Storage: `VeMinting::Locked` (r:1 w:1) - /// Proof: `VeMinting::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Locked` (r:1 w:1) + /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Number` (r:1 w:0) /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `VeMinting::Supply` (r:1 w:1) - /// Proof: `VeMinting::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPositions` (r:1 w:1) - /// Proof: `VeMinting::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserLocked` (r:1 w:1) - /// Proof: `VeMinting::UserLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Supply` (r:1 w:1) + /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPositions` (r:1 w:1) + /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserLocked` (r:1 w:1) + /// Proof: `BbBNC::UserLocked` (`max_values`: None, `max_size`: None, mode: `Measured`) /// 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) @@ -472,22 +472,22 @@ impl WeightInfo for () { /// 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: `VeMinting::IncentiveConfigs` (r:1 w:1) - /// Proof: `VeMinting::IncentiveConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Epoch` (r:1 w:1) - /// Proof: `VeMinting::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::PointHistory` (r:1 w:105) - /// Proof: `VeMinting::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::SlopeChanges` (r:104 w:0) - /// Proof: `VeMinting::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Rewards` (r:1 w:1) - /// Proof: `VeMinting::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserRewardPerTokenPaid` (r:1 w:1) - /// Proof: `VeMinting::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPointHistory` (r:0 w:1) - /// Proof: `VeMinting::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPointEpoch` (r:0 w:1) - /// Proof: `VeMinting::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Epoch` (r:1 w:1) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:105) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:104 w:0) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Rewards` (r:1 w:1) + /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:1 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointHistory` (r:0 w:1) + /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointEpoch` (r:0 w:1) + /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) fn redeem_unlock() -> Weight { // Proof Size summary in bytes: // Measured: `2525` @@ -498,36 +498,36 @@ impl WeightInfo for () { .saturating_add(RocksDbWeight::get().reads(122)) .saturating_add(RocksDbWeight::get().writes(120)) } - /// Storage: `VeMinting::MarkupCoefficient` (r:1 w:0) - /// Proof: `VeMinting::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::MarkupCoefficient` (r:1 w:0) + /// Proof: `BbBNC::MarkupCoefficient` (`max_values`: None, `max_size`: None, mode: `Measured`) /// Storage: `System::Number` (r:1 w:0) /// Proof: `System::Number` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`) - /// Storage: `VeMinting::LockedTokens` (r:2 w:1) - /// Proof: `VeMinting::LockedTokens` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserMarkupInfos` (r:1 w:1) - /// Proof: `VeMinting::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPositions` (r:1 w:0) - /// Proof: `VeMinting::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Locked` (r:1 w:0) - /// Proof: `VeMinting::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::IncentiveConfigs` (r:1 w:1) - /// Proof: `VeMinting::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Epoch` (r:1 w:1) - /// Proof: `VeMinting::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::PointHistory` (r:1 w:1) - /// Proof: `VeMinting::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPointEpoch` (r:1 w:1) - /// Proof: `VeMinting::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserPointHistory` (r:1 w:1) - /// Proof: `VeMinting::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Rewards` (r:1 w:1) - /// Proof: `VeMinting::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::UserRewardPerTokenPaid` (r:1 w:1) - /// Proof: `VeMinting::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::SlopeChanges` (r:1 w:1) - /// Proof: `VeMinting::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) - /// Storage: `VeMinting::Supply` (r:1 w:0) - /// Proof: `VeMinting::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::LockedTokens` (r:2 w:1) + /// Proof: `BbBNC::LockedTokens` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserMarkupInfos` (r:1 w:1) + /// Proof: `BbBNC::UserMarkupInfos` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPositions` (r:1 w:0) + /// Proof: `BbBNC::UserPositions` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Locked` (r:1 w:0) + /// Proof: `BbBNC::Locked` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::IncentiveConfigs` (r:1 w:1) + /// Proof: `BbBNC::IncentiveConfigs` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Epoch` (r:1 w:1) + /// Proof: `BbBNC::Epoch` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::PointHistory` (r:1 w:1) + /// Proof: `BbBNC::PointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointEpoch` (r:1 w:1) + /// Proof: `BbBNC::UserPointEpoch` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserPointHistory` (r:1 w:1) + /// Proof: `BbBNC::UserPointHistory` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Rewards` (r:1 w:1) + /// Proof: `BbBNC::Rewards` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::UserRewardPerTokenPaid` (r:1 w:1) + /// Proof: `BbBNC::UserRewardPerTokenPaid` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::SlopeChanges` (r:1 w:1) + /// Proof: `BbBNC::SlopeChanges` (`max_values`: None, `max_size`: None, mode: `Measured`) + /// Storage: `BbBNC::Supply` (r:1 w:0) + /// Proof: `BbBNC::Supply` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) fn refresh() -> Weight { // Proof Size summary in bytes: // Measured: `1687` diff --git a/pallets/buy-back/Cargo.toml b/pallets/buy-back/Cargo.toml index edbae9c15..1279d6a9f 100644 --- a/pallets/buy-back/Cargo.toml +++ b/pallets/buy-back/Cargo.toml @@ -10,7 +10,7 @@ targets = ["x86_64-unknown-linux-gnu"] [dependencies] bifrost-primitives = { workspace = true } bifrost-slp = { workspace = true } -bifrost-ve-minting = { workspace = true } +bb-bnc = { workspace = true } bifrost-vtoken-minting = { workspace = true } cumulus-primitives-core = { workspace = true } frame-benchmarking = { workspace = true, optional = true } diff --git a/pallets/buy-back/src/lib.rs b/pallets/buy-back/src/lib.rs index 802169eca..b3ea80623 100644 --- a/pallets/buy-back/src/lib.rs +++ b/pallets/buy-back/src/lib.rs @@ -30,8 +30,8 @@ mod benchmarking; pub mod weights; +use bb_bnc::BbBNCInterface; use bifrost_primitives::{currency::BNC, CurrencyId, CurrencyIdRegister, TryConvertFrom}; -use bifrost_ve_minting::VeMintingInterface; use cumulus_primitives_core::ParaId; use frame_support::{ pallet_prelude::*, @@ -89,7 +89,7 @@ pub mod pallet { type CurrencyIdRegister: CurrencyIdRegister; - type VeMinting: VeMintingInterface< + type BbBNC: BbBNCInterface< AccountIdOf, CurrencyIdOf, BalanceOf, @@ -413,7 +413,7 @@ pub mod pallet { } let bnc_balance = T::MultiCurrency::free_balance(BNC, &buyback_address); let pool_id = 0; - T::VeMinting::notify_reward( + T::BbBNC::notify_reward( pool_id, &Some(buyback_address.clone()), vec![(BNC, bnc_balance)], diff --git a/pallets/buy-back/src/mock.rs b/pallets/buy-back/src/mock.rs index 99b00ce3b..ae4b9787a 100644 --- a/pallets/buy-back/src/mock.rs +++ b/pallets/buy-back/src/mock.rs @@ -75,7 +75,7 @@ frame_support::construct_runtime!( ZenlinkProtocol: zenlink_protocol, AssetRegistry: bifrost_asset_registry, PolkadotXcm: pallet_xcm, - VeMinting: bifrost_ve_minting, + BbBNC: bb_bnc, } ); @@ -179,7 +179,7 @@ impl bifrost_buy_back::Config for Runtime { type LiquidityAccount = LiquidityAccount; type ParachainId = ParaInfo; type CurrencyIdRegister = AssetIdMaps; - type VeMinting = VeMinting; + type BbBNC = BbBNC; } pub struct ParaInfo; @@ -311,7 +311,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } @@ -465,9 +465,8 @@ impl pallet_xcm::Config for Runtime { } 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 BbBNCTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); + pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); pub const Week: BlockNumber = 50400; // a week pub const MaxBlock: BlockNumber = 10512000; // four years pub const Multiplier: Balance = 10_u128.pow(12); @@ -476,12 +475,11 @@ parameter_types! { pub const MarkupRefreshLimit: u32 = 100; } -impl bifrost_ve_minting::Config for Runtime { +impl bb_bnc::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; type ControlOrigin = EnsureSignedBy; - type TokenType = VeMintingTokenType; - type VeMintingPalletId = VeMintingPalletId; + type TokenType = BbBNCTokenType; type IncentivePalletId = IncentivePalletId; type BuyBackAccount = BuyBackAccount; type WeightInfo = (); diff --git a/pallets/buy-back/src/tests.rs b/pallets/buy-back/src/tests.rs index 0f1f23e3f..485d80d52 100644 --- a/pallets/buy-back/src/tests.rs +++ b/pallets/buy-back/src/tests.rs @@ -107,7 +107,7 @@ fn buy_back_with_burn_should_work() { 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())); + BbBNC::set_incentive(0, Some(7 * 86400 / 12), Some(buyback_account.clone())); assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000)); let infos = Infos::::get(VKSM).unwrap(); assert_ok!(BuyBack::buy_back(&buyback_account, VKSM, &infos, 0)); @@ -145,7 +145,7 @@ fn buy_back_no_burn_should_work() { 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())); + BbBNC::set_incentive(0, Some(7 * 86400 / 12), Some(buyback_account.clone())); assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000)); let infos = Infos::::get(VKSM).unwrap(); assert_ok!(BuyBack::buy_back(&buyback_account, VKSM, &infos, 0)); @@ -183,7 +183,7 @@ fn on_initialize_no_burn_should_work() { 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())); + BbBNC::set_incentive(0, Some(7 * 86400 / 12), Some(buyback_account.clone())); assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000)); BuyBack::on_initialize(1); BuyBack::on_initialize(2); @@ -221,7 +221,7 @@ fn on_initialize_with_burn_should_work() { 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())); + BbBNC::set_incentive(0, Some(7 * 86400 / 12), Some(buyback_account.clone())); assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000)); BuyBack::on_initialize(>::block_number() + 1); System::set_block_number(System::block_number() + 1); @@ -260,7 +260,7 @@ fn on_initialize_with_bias_should_work() { 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())); + BbBNC::set_incentive(0, Some(7 * 86400 / 12), Some(buyback_account.clone())); assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000)); BuyBack::on_initialize(1); let path = vec![ @@ -310,7 +310,7 @@ fn on_initialize_with_bias_should_not_work() { 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())); + BbBNC::set_incentive(0, Some(7 * 86400 / 12), Some(buyback_account.clone())); assert_ok!(BuyBack::charge(RuntimeOrigin::signed(ALICE), VKSM, 1000)); BuyBack::on_initialize(1); let path = vec![ diff --git a/pallets/clouds-convert/Cargo.toml b/pallets/clouds-convert/Cargo.toml index 088e75647..8a843fb44 100644 --- a/pallets/clouds-convert/Cargo.toml +++ b/pallets/clouds-convert/Cargo.toml @@ -14,7 +14,7 @@ sp-runtime = { workspace = true } frame-benchmarking = { workspace = true, optional = true } bifrost-primitives = { workspace = true } orml-traits = { workspace = true } -bifrost-ve-minting = { workspace = true } +bb-bnc = { workspace = true } sp-core = { workspace = true } pallet-balances = { workspace = true } @@ -37,7 +37,7 @@ std = [ "frame-system/std", "frame-benchmarking?/std", "orml-traits/std", - "bifrost-ve-minting/std", + "bb-bnc/std", "orml-tokens/std", "bifrost-currencies/std", "sp-io/std", diff --git a/pallets/clouds-convert/src/lib.rs b/pallets/clouds-convert/src/lib.rs index 194782e00..100d27baf 100644 --- a/pallets/clouds-convert/src/lib.rs +++ b/pallets/clouds-convert/src/lib.rs @@ -22,11 +22,11 @@ extern crate alloc; use alloc::vec; +use bb_bnc::BbBNCInterface; use bifrost_primitives::{ currency::{CLOUD, VBNC}, CurrencyId, }; -use bifrost_ve_minting::VeMintingInterface; use frame_support::{ ensure, pallet_prelude::*, @@ -70,8 +70,8 @@ pub mod pallet { /// Clouds Pallet Id type CloudsPalletId: Get; - // veMinting interface - type VeMinting: VeMintingInterface< + // bbBNC interface + type BbBNC: BbBNCInterface< AccountIdOf, CurrencyIdOf, BalanceOf, @@ -138,7 +138,7 @@ pub mod pallet { T::MultiCurrency::transfer(VBNC, &vbnc_pool_account, &who, can_get_vbnc)?; // mint veBNC for user - T::VeMinting::create_lock_inner(&who, can_get_vbnc, T::LockedBlocks::get())?; + T::BbBNC::create_lock_inner(&who, can_get_vbnc, T::LockedBlocks::get())?; // deposit event Self::deposit_event(Event::CloudsConverted { clouds: value, vebnc: can_get_vbnc }); diff --git a/pallets/clouds-convert/src/mock.rs b/pallets/clouds-convert/src/mock.rs index 01c58d106..72a89989b 100644 --- a/pallets/clouds-convert/src/mock.rs +++ b/pallets/clouds-convert/src/mock.rs @@ -53,7 +53,7 @@ frame_support::construct_runtime!( Currencies: bifrost_currencies, AssetRegistry: bifrost_asset_registry, CloudsConvert: bifrost_clouds_convert, - VeMinting: bifrost_ve_minting, + BbBNC: bb_bnc, } ); @@ -174,15 +174,14 @@ impl bifrost_clouds_convert::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; type CloudsPalletId = CloudsPalletId; - type VeMinting = VeMinting; + type BbBNC = BbBNC; type WeightInfo = (); type LockedBlocks = MaxBlock; } 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 BbBNCTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); + pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck"); pub const Week: BlockNumber = 50400; // a week pub const MaxBlock: BlockNumber = 10512000; // four years @@ -192,12 +191,11 @@ parameter_types! { pub const MarkupRefreshLimit: u32 = 100; } -impl bifrost_ve_minting::Config for Runtime { +impl bb_bnc::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; type ControlOrigin = EnsureSignedBy; - type TokenType = VeMintingTokenType; - type VeMintingPalletId = VeMintingPalletId; + type TokenType = BbBNCTokenType; type IncentivePalletId = IncentivePalletId; type BuyBackAccount = BuyBackAccount; type WeightInfo = (); diff --git a/pallets/clouds-convert/src/tests.rs b/pallets/clouds-convert/src/tests.rs index 3b8cfdcf3..c325395bf 100644 --- a/pallets/clouds-convert/src/tests.rs +++ b/pallets/clouds-convert/src/tests.rs @@ -57,7 +57,7 @@ fn clouds_to_vebnc_should_work() { // check the veBNC balance of Bob let bob_old_vebnc_balance = - ::VeMinting::balance_of(&BOB, None).unwrap(); + ::BbBNC::balance_of(&BOB, None).unwrap(); // check the old pool balance let old_pool_balance = ::MultiCurrency::free_balance( @@ -70,7 +70,7 @@ fn clouds_to_vebnc_should_work() { // check the veBNC balance of Bob assert_eq!( - ::VeMinting::balance_of(&BOB, None).unwrap(), + ::BbBNC::balance_of(&BOB, None).unwrap(), bob_old_vebnc_balance + 20034907200 ); diff --git a/pallets/farming/Cargo.toml b/pallets/farming/Cargo.toml index 352fd71ef..50853b064 100644 --- a/pallets/farming/Cargo.toml +++ b/pallets/farming/Cargo.toml @@ -21,7 +21,7 @@ sp-runtime = { workspace = true } hex-literal = { workspace = true } pallet-balances = { workspace = true } sp-arithmetic = { workspace = true } -bifrost-ve-minting = { workspace = true } +bb-bnc = { workspace = true } log = { workspace = true } [dev-dependencies] @@ -30,7 +30,7 @@ bifrost-currencies = { workspace = true } sp-io = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -bifrost-ve-minting = { workspace = true } +bb-bnc = { workspace = true } bifrost-asset-registry = { workspace = true } bifrost-runtime-common = { workspace = true } env_logger = { workspace = true } diff --git a/pallets/farming/src/boost.rs b/pallets/farming/src/boost.rs index 6601caf2c..a31e28966 100644 --- a/pallets/farming/src/boost.rs +++ b/pallets/farming/src/boost.rs @@ -17,7 +17,7 @@ // along with this program. If not, see . use crate::*; -use bifrost_ve_minting::VeMintingInterface; +use bb_bnc::BbBNCInterface; #[derive(Clone, Encode, Decode, PartialEq, Eq, RuntimeDebug, TypeInfo, Default)] pub struct BoostPoolInfo { @@ -44,7 +44,7 @@ impl BoostInterface, CurrencyIdOf, BalanceOf, Bl { fn refresh_vebnc_farming(who: &AccountIdOf) -> DispatchResult { let mut boost_pool_info = Self::boost_pool_infos(); - let new_vote_amount = T::VeMinting::balance_of(who, None)?; + let new_vote_amount = T::BbBNC::balance_of(who, None)?; if let Some(mut user_boost_info) = Self::user_boost_infos(who) { // If the user's last voting block height is greater than or equal to the block height @@ -227,7 +227,7 @@ impl Pallet { } } - let new_vote_amount = T::VeMinting::balance_of(who, None)?; + let new_vote_amount = T::BbBNC::balance_of(who, None)?; let mut percent_check = Percent::from_percent(0); vote_list.iter().try_for_each(|(pid, proportion)| -> DispatchResult { ensure!(Self::boost_whitelist(pid) != None, Error::::NotInWhitelist); diff --git a/pallets/farming/src/gauge.rs b/pallets/farming/src/gauge.rs index f5c7d3311..4827eed16 100644 --- a/pallets/farming/src/gauge.rs +++ b/pallets/farming/src/gauge.rs @@ -123,7 +123,7 @@ where })?; let controller = T::GaugeRewardIssuer::get().into_sub_account_truncating(pid); - T::VeMinting::set_incentive(pid, Some(max_block), Some(controller)); + T::BbBNC::set_incentive(pid, Some(max_block), Some(controller)); Ok(()) } @@ -248,14 +248,10 @@ where let pool_info = PoolInfos::::get(pid).ok_or(Error::::PoolDoesNotExist)?; let share_info = SharesAndWithdrawnRewards::::get(pid, who).ok_or(Error::::ShareInfoNotExists)?; - if T::VeMinting::balance_of(who, None)? == BalanceOf::::zero() { + if T::BbBNC::balance_of(who, None)? == BalanceOf::::zero() { return Ok(()); } - T::VeMinting::update_reward( - pid, - Some(who), - Some((share_info.share, pool_info.total_shares)), - )?; + T::BbBNC::update_reward(pid, Some(who), Some((share_info.share, pool_info.total_shares)))?; Ok(()) } } diff --git a/pallets/farming/src/lib.rs b/pallets/farming/src/lib.rs index f518fe5e9..16d71fa2b 100644 --- a/pallets/farming/src/lib.rs +++ b/pallets/farming/src/lib.rs @@ -62,7 +62,7 @@ pub type CurrencyIdOf = <::MultiCurrency as MultiCurrency< type BalanceOf = <::MultiCurrency as MultiCurrency>>::Balance; -use bifrost_ve_minting::VeMintingInterface; +use bb_bnc::BbBNCInterface; use parity_scale_codec::FullCodec; use sp_std::fmt::Debug; @@ -109,7 +109,7 @@ pub mod pallet { #[pallet::constant] type FarmingBoost: Get; - type VeMinting: bifrost_ve_minting::VeMintingInterface< + type BbBNC: bb_bnc::BbBNCInterface< AccountIdOf, CurrencyIdOf, BalanceOf, @@ -363,7 +363,7 @@ pub mod pallet { match gauge_pool_info.gauge_state { GaugeState::Bonded => { let rewards = gauge_pool_info.gauge_basic_rewards.into_iter().collect(); - T::VeMinting::auto_notify_reward(gid, n, rewards).unwrap_or_default(); + T::BbBNC::auto_notify_reward(gid, n, rewards).unwrap_or_default(); }, _ => (), } @@ -804,7 +804,7 @@ pub mod pallet { let pool_info = PoolInfos::::get(gid).ok_or(Error::::PoolDoesNotExist)?; let share_info = SharesAndWithdrawnRewards::::get(gid, &who) .ok_or(Error::::ShareInfoNotExists)?; - T::VeMinting::get_rewards(gid, &who, Some((share_info.share, pool_info.total_shares)))?; + T::BbBNC::get_rewards(gid, &who, Some((share_info.share, pool_info.total_shares)))?; Self::deposit_event(Event::GaugeWithdrawn { who, gid }); Ok(()) @@ -827,7 +827,7 @@ pub mod pallet { let pool_info = PoolInfos::::get(gid).ok_or(Error::::PoolDoesNotExist)?; let share_info = SharesAndWithdrawnRewards::::get(gid, &gauge_info.who) .ok_or(Error::::ShareInfoNotExists)?; - T::VeMinting::get_rewards( + T::BbBNC::get_rewards( gid, &gauge_info.who, Some((share_info.share, pool_info.total_shares)), diff --git a/pallets/farming/src/mock.rs b/pallets/farming/src/mock.rs index 67ee96347..fe91ffb78 100644 --- a/pallets/farming/src/mock.rs +++ b/pallets/farming/src/mock.rs @@ -49,7 +49,7 @@ frame_support::construct_runtime!( Balances: pallet_balances, Currencies: bifrost_currencies, Farming: bifrost_farming, - VeMinting: bifrost_ve_minting, + BbBNC: bb_bnc, AssetRegistry: bifrost_asset_registry, } ); @@ -145,16 +145,15 @@ impl bifrost_farming::Config for Runtime { type RewardIssuer = FarmingRewardIssuerPalletId; type FarmingBoost = FarmingBoostPalletId; type WeightInfo = (); - type VeMinting = VeMinting; + type BbBNC = BbBNC; type BlockNumberToBalance = ConvertInto; type WhitelistMaximumLimit = WhitelistMaximumLimit; type GaugeRewardIssuer = FarmingGaugeRewardIssuerPalletId; } 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 BbBNCTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); + pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck"); pub const Week: BlockNumber = 50400; // a week pub const MaxBlock: BlockNumber = 10512000; // four years @@ -164,12 +163,11 @@ parameter_types! { pub const MarkupRefreshLimit: u32 = 100; } -impl bifrost_ve_minting::Config for Runtime { +impl bb_bnc::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; type ControlOrigin = EnsureSignedBy; - type TokenType = VeMintingTokenType; - type VeMintingPalletId = VeMintingPalletId; + type TokenType = BbBNCTokenType; type IncentivePalletId = IncentivePalletId; type BuyBackAccount = BuyBackAccount; type WeightInfo = (); diff --git a/pallets/farming/src/rewards.rs b/pallets/farming/src/rewards.rs index 64f321df8..a284fa85d 100644 --- a/pallets/farming/src/rewards.rs +++ b/pallets/farming/src/rewards.rs @@ -295,7 +295,7 @@ impl Pallet { let pool_info = PoolInfos::::get(pool).ok_or(Error::::PoolDoesNotExist)?; let share_info = SharesAndWithdrawnRewards::::get(pool, who) .ok_or(Error::::ShareInfoNotExists)?; - T::VeMinting::get_rewards(pool, who, Some((share_info.share, pool_info.total_shares)))?; + T::BbBNC::get_rewards(pool, who, Some((share_info.share, pool_info.total_shares)))?; } SharesAndWithdrawnRewards::::mutate_exists( pool, diff --git a/pallets/farming/src/tests.rs b/pallets/farming/src/tests.rs index cb6e1f2ee..a114c4467 100644 --- a/pallets/farming/src/tests.rs +++ b/pallets/farming/src/tests.rs @@ -21,7 +21,7 @@ #![cfg(test)] use crate::{mock::*, *}; -use bifrost_ve_minting::VeMintingInterface; +use bb_bnc::BbBNCInterface; use frame_support::{assert_err, assert_ok}; #[test] @@ -79,7 +79,7 @@ fn deposit() { (BalanceOf, BalanceOf, BalanceOf), >::new(), gauge_basic_rewards, - max_block: 1000, + max_block: 7 * 86400 / 12, gauge_amount: 0, total_time_factor: 0, gauge_last_block: 0, @@ -281,7 +281,7 @@ fn init_gauge() -> (PoolId, BalanceOf) { RuntimeOrigin::signed(ALICE), tokens_proportion.clone(), basic_rewards.clone(), - Some((1000, gauge_basic_rewards.clone())), + Some((7 * 86400 / 12, gauge_basic_rewards.clone())), 0, 0, 0, @@ -293,14 +293,9 @@ fn init_gauge() -> (PoolId, BalanceOf) { let charge_rewards = vec![(KSM, 300000)]; assert_ok!(Farming::charge(RuntimeOrigin::signed(BOB), pid, charge_rewards, false)); assert_ok!(Farming::deposit(RuntimeOrigin::signed(ALICE), pid, tokens, Some((100, 100)))); - assert_ok!(VeMinting::set_config(RuntimeOrigin::signed(ALICE), Some(0), Some(7 * 86400 / 12))); - assert_ok!(VeMinting::notify_rewards( - RuntimeOrigin::signed(ALICE), - CHARLIE, - Some(7 * 86400 / 12), - gauge_basic_rewards.clone() - )); - assert_ok!(VeMinting::create_lock_inner( + assert_ok!(BbBNC::set_config(RuntimeOrigin::signed(ALICE), Some(0), Some(7 * 86400 / 12))); + assert_ok!(BbBNC::notify_reward_amount(pid, &Some(CHARLIE), gauge_basic_rewards.clone())); + assert_ok!(BbBNC::create_lock_inner( &ALICE, 100_000_000_000, System::block_number() + (4 * 365 * 86400 - 7 * 86400) / 12 diff --git a/pallets/fee-share/src/mock.rs b/pallets/fee-share/src/mock.rs index 1478477e8..a885cf11b 100644 --- a/pallets/fee-share/src/mock.rs +++ b/pallets/fee-share/src/mock.rs @@ -409,7 +409,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } diff --git a/pallets/leverage-staking/src/mock.rs b/pallets/leverage-staking/src/mock.rs index ff8690d8f..a4c8fd0d5 100644 --- a/pallets/leverage-staking/src/mock.rs +++ b/pallets/leverage-staking/src/mock.rs @@ -317,7 +317,7 @@ impl bifrost_vtoken_minting::Config for Test { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } diff --git a/pallets/salp/src/mock.rs b/pallets/salp/src/mock.rs index ef471a923..4d1bf1435 100644 --- a/pallets/salp/src/mock.rs +++ b/pallets/salp/src/mock.rs @@ -437,7 +437,7 @@ impl bifrost_vtoken_minting::Config for Test { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } diff --git a/pallets/slp-v2/src/mock.rs b/pallets/slp-v2/src/mock.rs index 46502f16d..8104a81e8 100644 --- a/pallets/slp-v2/src/mock.rs +++ b/pallets/slp-v2/src/mock.rs @@ -258,7 +258,7 @@ impl bifrost_vtoken_minting::Config for Test { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } diff --git a/pallets/slp/src/mocks/mock.rs b/pallets/slp/src/mocks/mock.rs index 17170e3dc..a5f893b27 100644 --- a/pallets/slp/src/mocks/mock.rs +++ b/pallets/slp/src/mocks/mock.rs @@ -213,7 +213,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } diff --git a/pallets/slp/src/mocks/mock_kusama.rs b/pallets/slp/src/mocks/mock_kusama.rs index 95fa204f0..6aeafbf7c 100644 --- a/pallets/slp/src/mocks/mock_kusama.rs +++ b/pallets/slp/src/mocks/mock_kusama.rs @@ -271,7 +271,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } diff --git a/pallets/slpx/src/mock.rs b/pallets/slpx/src/mock.rs index ab80f3baa..ea6eaf1e8 100644 --- a/pallets/slpx/src/mock.rs +++ b/pallets/slpx/src/mock.rs @@ -201,7 +201,7 @@ impl bifrost_vtoken_minting::Config for Test { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } // Below is the implementation of tokens manipulation functions other than native token. diff --git a/pallets/stable-pool/src/mock.rs b/pallets/stable-pool/src/mock.rs index 3da466f73..d63321de7 100644 --- a/pallets/stable-pool/src/mock.rs +++ b/pallets/stable-pool/src/mock.rs @@ -298,7 +298,7 @@ impl bifrost_vtoken_minting::Config for Test { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } diff --git a/pallets/system-maker/src/mock.rs b/pallets/system-maker/src/mock.rs index 7f16adcad..756815e07 100644 --- a/pallets/system-maker/src/mock.rs +++ b/pallets/system-maker/src/mock.rs @@ -310,7 +310,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } diff --git a/pallets/system-staking/src/mock.rs b/pallets/system-staking/src/mock.rs index dc8cc5889..a450972d1 100644 --- a/pallets/system-staking/src/mock.rs +++ b/pallets/system-staking/src/mock.rs @@ -202,7 +202,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type ChannelCommission = (); type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } @@ -298,7 +298,7 @@ impl bifrost_farming::Config for Runtime { type RewardIssuer = FarmingRewardIssuerPalletId; type FarmingBoost = FarmingBoostPalletId; type WeightInfo = (); - type VeMinting = (); + type BbBNC = (); type BlockNumberToBalance = ConvertInto; type WhitelistMaximumLimit = WhitelistMaximumLimit; type GaugeRewardIssuer = FarmingGaugeRewardIssuerPalletId; diff --git a/pallets/vtoken-minting/Cargo.toml b/pallets/vtoken-minting/Cargo.toml index ade306b6e..248ac8e8d 100644 --- a/pallets/vtoken-minting/Cargo.toml +++ b/pallets/vtoken-minting/Cargo.toml @@ -23,7 +23,7 @@ xcm = { workspace = true } cumulus-primitives-core = { workspace = true } sp-core = { workspace = true } sp-runtime = { workspace = true } -bifrost-ve-minting = { workspace = true } +bb-bnc = { workspace = true } bifrost-asset-registry = { workspace = true } [dev-dependencies] diff --git a/pallets/vtoken-minting/src/lib.rs b/pallets/vtoken-minting/src/lib.rs index a0bfb97c3..687ee5475 100644 --- a/pallets/vtoken-minting/src/lib.rs +++ b/pallets/vtoken-minting/src/lib.rs @@ -33,13 +33,13 @@ pub mod traits; pub mod weights; pub use weights::WeightInfo; +use bb_bnc::traits::BbBNCInterface; use bifrost_asset_registry::AssetMetadata; use bifrost_primitives::{ CurrencyId, CurrencyIdConversion, CurrencyIdExt, CurrencyIdMapping, CurrencyIdRegister, RedeemType, SlpOperator, SlpxOperator, TimeUnit, VTokenMintRedeemProvider, VTokenSupplyProvider, VtokenMintingInterface, VtokenMintingOperator, }; -use bifrost_ve_minting::traits::VeMintingInterface; use frame_support::{ pallet_prelude::*, sp_runtime::{ @@ -143,8 +143,8 @@ pub mod pallet { type BifrostSlpx: SlpxOperator>; - // veMinting interface - type VeMinting: VeMintingInterface< + // bbBNC interface + type BbBNC: BbBNCInterface< AccountIdOf, CurrencyIdOf, BalanceOf, @@ -906,8 +906,8 @@ pub mod pallet { ensure!(MinimumMint::::contains_key(token_id), Error::::NotSupportTokenType); // check whether the user has veBNC - let vebnc_balance = T::VeMinting::balance_of(&minter, None) - .map_err(|_| Error::::VeBNCCheckingError)?; + let vebnc_balance = + T::BbBNC::balance_of(&minter, None).map_err(|_| Error::::VeBNCCheckingError)?; ensure!(vebnc_balance > BalanceOf::::zero(), Error::::NotEnoughBalance); // check whether the vtoken coefficient is set @@ -1858,13 +1858,13 @@ pub mod pallet { // get current block number let current_block_number: BlockNumberFor = frame_system::Pallet::::block_number(); // get the veBNC total amount - let vebnc_total_issuance = T::VeMinting::total_supply(current_block_number) + let vebnc_total_issuance = T::BbBNC::total_supply(current_block_number) .map_err(|_| Error::::VeBNCCheckingError)?; ensure!(vebnc_total_issuance > BalanceOf::::zero(), Error::::BalanceZero); // get the veBNC balance of the minter - let minter_vebnc_balance = T::VeMinting::balance_of(minter, None) - .map_err(|_| Error::::VeBNCCheckingError)?; + let minter_vebnc_balance = + T::BbBNC::balance_of(minter, None).map_err(|_| Error::::VeBNCCheckingError)?; ensure!(minter_vebnc_balance > BalanceOf::::zero(), Error::::NotEnoughBalance); // get the percentage of the veBNC balance of the minter to the total veBNC amount and diff --git a/pallets/vtoken-minting/src/mock.rs b/pallets/vtoken-minting/src/mock.rs index ee70f4965..f04aa0e80 100644 --- a/pallets/vtoken-minting/src/mock.rs +++ b/pallets/vtoken-minting/src/mock.rs @@ -21,6 +21,7 @@ #![cfg(test)] #![allow(non_upper_case_globals)] +use bb_bnc::{BbBNCInterface, Point}; use bifrost_asset_registry::AssetIdMaps; use bifrost_primitives::{ currency::{BNC, DOT, FIL, KSM, MOVR, VBNC, VFIL, VKSM, VMOVR}, @@ -28,7 +29,6 @@ use bifrost_primitives::{ }; use bifrost_runtime_common::{micro, milli}; use bifrost_slp::{QueryId, QueryResponseManager}; -use bifrost_ve_minting::{Point, VeMintingInterface}; pub use cumulus_primitives_core::ParaId; use frame_support::{ derive_impl, ord_parameter_types, @@ -222,7 +222,7 @@ impl vtoken_minting::Config for Runtime { type IncentivePoolAccount = IncentivePoolAccount; type BifrostSlp = Slp; type BifrostSlpx = SlpxInterface; - type VeMinting = VeMinting; + type BbBNC = BbBNC; type RelayChainToken = RelayCurrencyId; type CurrencyIdConversion = AssetIdMaps; type CurrencyIdRegister = AssetIdMaps; @@ -463,11 +463,11 @@ pub fn run_to_block(n: BlockNumber) { } } +use bb_bnc::IncentiveConfig; use bifrost_primitives::PoolId; -use bifrost_ve_minting::IncentiveConfig; -// Mock VeMinting Struct -pub struct VeMinting; -impl VeMintingInterface for VeMinting { +// Mock BbBNC Struct +pub struct BbBNC; +impl BbBNCInterface for BbBNC { fn balance_of(_addr: &AccountId, _time: Option) -> Result { Ok(100) } diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs index ba7c1b0f3..ee116c46a 100644 --- a/runtime/bifrost-kusama/src/lib.rs +++ b/runtime/bifrost-kusama/src/lib.rs @@ -1332,7 +1332,7 @@ impl bifrost_farming::Config for Runtime { type RewardIssuer = FarmingRewardIssuerPalletId; type WeightInfo = weights::bifrost_farming::BifrostWeight; type FarmingBoost = FarmingBoostPalletId; - type VeMinting = (); + type BbBNC = (); type BlockNumberToBalance = ConvertInto; type WhitelistMaximumLimit = WhitelistMaximumLimit; type GaugeRewardIssuer = FarmingGaugeRewardIssuerPalletId; @@ -1549,7 +1549,7 @@ impl bifrost_vtoken_minting::Config for Runtime { type ChannelCommission = ChannelCommission; type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = (); + type BbBNC = (); type AssetIdMaps = AssetIdMaps; } diff --git a/runtime/bifrost-polkadot/Cargo.toml b/runtime/bifrost-polkadot/Cargo.toml index 37c458dda..e79e6fef5 100644 --- a/runtime/bifrost-polkadot/Cargo.toml +++ b/runtime/bifrost-polkadot/Cargo.toml @@ -156,8 +156,8 @@ bifrost-stable-pool = { workspace = true } bifrost-stable-pool-rpc-runtime-api = { workspace = true } bifrost-system-maker = { workspace = true } bifrost-system-staking = { workspace = true } -bifrost-ve-minting = { workspace = true } -bifrost-ve-minting-rpc-runtime-api = { workspace = true } +bb-bnc = { workspace = true } +bb-bnc-rpc-runtime-api = { workspace = true } bifrost-vesting = { workspace = true } bifrost-vstoken-conversion = { workspace = true } bifrost-vtoken-minting = { workspace = true } @@ -274,8 +274,8 @@ std = [ "bifrost-stable-pool/std", "bifrost-system-maker/std", "bifrost-system-staking/std", - "bifrost-ve-minting-rpc-runtime-api/std", - "bifrost-ve-minting/std", + "bb-bnc-rpc-runtime-api/std", + "bb-bnc/std", "bifrost-vesting/std", "bifrost-vtoken-minting/std", "bifrost-vtoken-voting/std", @@ -338,7 +338,7 @@ runtime-benchmarks = [ "bifrost-slp-v2/runtime-benchmarks", "bifrost-salp/runtime-benchmarks", "bifrost-vtoken-minting/runtime-benchmarks", - "bifrost-ve-minting/runtime-benchmarks", + "bb-bnc/runtime-benchmarks", "bifrost-cross-in-out/runtime-benchmarks", "bifrost-slpx/runtime-benchmarks", "bifrost-stable-pool/runtime-benchmarks", @@ -368,7 +368,7 @@ try-runtime = [ "bifrost-stable-pool/try-runtime", "bifrost-system-maker/try-runtime", "bifrost-system-staking/try-runtime", - "bifrost-ve-minting/try-runtime", + "bb-bnc/try-runtime", "bifrost-vesting/try-runtime", "bifrost-vstoken-conversion/try-runtime", "bifrost-vtoken-minting/try-runtime", diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 3df92f5b6..db5bd4b9a 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -69,6 +69,7 @@ pub mod constants; mod evm; mod migration; pub mod weights; +use bb_bnc::traits::BbBNCInterface; use bifrost_asset_registry::{AssetIdMaps, FixedRateOfAsset}; pub use bifrost_primitives::{ traits::{ @@ -86,7 +87,6 @@ use bifrost_runtime_common::{ TechnicalCollective, }; use bifrost_slp::QueryId; -use bifrost_ve_minting::traits::VeMintingInterface; use constants::currency::*; use cumulus_primitives_core::AggregateMessageOrigin; use fp_evm::FeeCalculator; @@ -240,8 +240,7 @@ parameter_types! { pub const SystemMakerPalletId: PalletId = PalletId(*b"bf/sysmk"); pub const FeeSharePalletId: PalletId = PalletId(*b"bf/feesh"); pub CheckingAccount: AccountId = PolkadotXcm::check_account(); - pub const VeMintingPalletId: PalletId = PalletId(*b"bf/vemnt"); - pub const IncentivePalletId: PalletId = PalletId(*b"bf/veict"); + pub const IncentivePalletId: PalletId = PalletId(*b"bf/bbict"); pub const FarmingBoostPalletId: PalletId = PalletId(*b"bf/fmbst"); pub const LendMarketPalletId: PalletId = PalletId(*b"bf/ldmkt"); pub const OraclePalletId: PalletId = PalletId(*b"bf/oracl"); @@ -1201,7 +1200,7 @@ impl bifrost_farming::Config for Runtime { type RewardIssuer = FarmingRewardIssuerPalletId; type WeightInfo = weights::bifrost_farming::BifrostWeight; type FarmingBoost = FarmingBoostPalletId; - type VeMinting = VeMinting; + type BbBNC = BbBNC; type BlockNumberToBalance = ConvertInto; type WhitelistMaximumLimit = WhitelistMaximumLimit; type GaugeRewardIssuer = FarmingGaugeRewardIssuerPalletId; @@ -1421,12 +1420,12 @@ impl bifrost_vtoken_minting::Config for Runtime { type ChannelCommission = ChannelCommission; type MaxLockRecords = ConstU32<100>; type IncentivePoolAccount = IncentivePoolAccount; - type VeMinting = VeMinting; + type BbBNC = BbBNC; type AssetIdMaps = AssetIdMaps; } parameter_types! { - pub const VeMintingTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); + pub const BbBNCTokenType: CurrencyId = CurrencyId::VToken(TokenSymbol::BNC); pub const Week: BlockNumber = prod_or_fast!(WEEKS, 10); pub const MaxBlock: BlockNumber = 4 * 365 * DAYS; pub const Multiplier: Balance = 10_u128.pow(12); @@ -1435,15 +1434,14 @@ parameter_types! { pub const MarkupRefreshLimit: u32 = 100; } -impl bifrost_ve_minting::Config for Runtime { +impl bb_bnc::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; type ControlOrigin = TechAdminOrCouncil; - type TokenType = VeMintingTokenType; - type VeMintingPalletId = VeMintingPalletId; + type TokenType = BbBNCTokenType; type IncentivePalletId = IncentivePalletId; type BuyBackAccount = BuyBackAccount; - type WeightInfo = weights::bifrost_ve_minting::BifrostWeight; + type WeightInfo = weights::bb_bnc::BifrostWeight; type BlockNumberToBalance = ConvertInto; type Week = Week; type MaxBlock = MaxBlock; @@ -1581,7 +1579,7 @@ impl bifrost_clouds_convert::Config for Runtime { type RuntimeEvent = RuntimeEvent; type MultiCurrency = Currencies; type CloudsPalletId = CloudsPalletId; - type VeMinting = VeMinting; + type BbBNC = BbBNC; type WeightInfo = weights::bifrost_clouds_convert::BifrostWeight; type LockedBlocks = MaxBlock; } @@ -1597,7 +1595,7 @@ impl bifrost_buy_back::Config for Runtime { type LiquidityAccount = LiquidityAccount; type ParachainId = ParachainInfo; type CurrencyIdRegister = AssetIdMaps; - type VeMinting = VeMinting; + type BbBNC = BbBNC; } impl bifrost_slp_v2::Config for Runtime { @@ -1801,7 +1799,7 @@ construct_runtime! { SystemMaker: bifrost_system_maker = 121, FeeShare: bifrost_fee_share = 122, CrossInOut: bifrost_cross_in_out = 123, - VeMinting: bifrost_ve_minting = 124, + BbBNC: bb_bnc = 124, Slpx: bifrost_slpx = 125, FellowshipCollective: pallet_ranked_collective:: = 126, FellowshipReferenda: pallet_referenda:: = 127, @@ -1980,7 +1978,7 @@ extern crate frame_benchmarking; #[cfg(feature = "runtime-benchmarks")] mod benches { define_benchmarks!( - [bifrost_ve_minting, VeMinting] + [bb_bnc, BbBNC] [bifrost_buy_back, BuyBack] [bifrost_slp_v2, SlpV2] ); @@ -2470,25 +2468,25 @@ impl fp_rpc::EthereumRuntimeRPCApi for Runtime { } } - impl bifrost_ve_minting_rpc_runtime_api::VeMintingRuntimeApi for Runtime { + impl bb_bnc_rpc_runtime_api::BbBNCRuntimeApi for Runtime { fn balance_of( who: AccountId, t: Option, ) -> Balance{ - VeMinting::balance_of(&who, t).unwrap_or(Zero::zero()) + BbBNC::balance_of(&who, t).unwrap_or(Zero::zero()) } fn total_supply( t: bifrost_primitives::BlockNumber, ) -> Balance{ - VeMinting::total_supply(t).unwrap_or(Zero::zero()) + BbBNC::total_supply(t).unwrap_or(Zero::zero()) } fn find_block_epoch( block: bifrost_primitives::BlockNumber, max_epoch: U256, ) -> U256{ - VeMinting::find_block_epoch(block, max_epoch) + BbBNC::find_block_epoch(block, max_epoch) } } diff --git a/runtime/bifrost-polkadot/src/weights/bifrost_ve_minting.rs b/runtime/bifrost-polkadot/src/weights/bb_bnc.rs similarity index 51% rename from runtime/bifrost-polkadot/src/weights/bifrost_ve_minting.rs rename to runtime/bifrost-polkadot/src/weights/bb_bnc.rs index ae92ae128..a10ad217d 100644 --- a/runtime/bifrost-polkadot/src/weights/bifrost_ve_minting.rs +++ b/runtime/bifrost-polkadot/src/weights/bb_bnc.rs @@ -22,7 +22,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -//! Autogenerated weights for bifrost_ve_minting +//! Autogenerated weights for bb_bnc //! //! 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: `[]` @@ -36,12 +36,12 @@ // --chain=bifrost-polkadot-local // --steps=50 // --repeat=20 -// --pallet=bifrost_ve_minting +// --pallet=bb_bnc // --extrinsic=* // --execution=wasm // --wasm-execution=compiled // --heap-pages=4096 -// --output=./runtime/bifrost-polkadot/src/weights/bifrost_ve_minting.rs +// --output=./runtime/bifrost-polkadot/src/weights/bb_bnc.rs // --template=./weight-template/runtime-weight-template.hbs #![cfg_attr(rustfmt, rustfmt_skip)] @@ -51,11 +51,11 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; -/// Weight functions for bifrost_ve_minting. +/// Weight functions for bb_bnc. pub struct BifrostWeight(PhantomData); -impl bifrost_ve_minting::WeightInfo for BifrostWeight { - // Storage: VeMinting VeConfigs (r:1 w:1) - // Proof Skipped: VeMinting VeConfigs (max_values: Some(1), max_size: None, mode: Measured) +impl bb_bnc::WeightInfo for BifrostWeight { + // Storage: BbBNC VeConfigs (r:1 w:1) + // Proof Skipped: BbBNC VeConfigs (max_values: Some(1), max_size: None, mode: Measured) // 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) @@ -73,14 +73,14 @@ impl bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight Weight { // Proof Size summary in bytes: // Measured: `1439` @@ -118,14 +118,14 @@ impl bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight Weight { // Proof Size summary in bytes: // Measured: `2083` @@ -163,30 +163,30 @@ impl bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight Weight { // Proof Size summary in bytes: // Measured: `2059` @@ -247,24 +247,24 @@ impl bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight Weight { // Proof Size summary in bytes: // Measured: `213` @@ -327,16 +327,16 @@ impl bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight Weight { // Proof Size summary in bytes: // Measured: `2260` @@ -381,14 +381,14 @@ impl bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight Weight { // Proof Size summary in bytes: // Measured: `2725` @@ -435,16 +435,16 @@ impl bifrost_ve_minting::WeightInfo for BifrostWeight bifrost_ve_minting::WeightInfo for BifrostWeight Weight { // Proof Size summary in bytes: // Measured: `2525` @@ -483,36 +483,36 @@ impl bifrost_ve_minting::WeightInfo for BifrostWeight Weight { // Proof Size summary in bytes: // Measured: `1687` diff --git a/runtime/bifrost-polkadot/src/weights/mod.rs b/runtime/bifrost-polkadot/src/weights/mod.rs index 2297c92cc..5ba0dd1b6 100644 --- a/runtime/bifrost-polkadot/src/weights/mod.rs +++ b/runtime/bifrost-polkadot/src/weights/mod.rs @@ -20,6 +20,7 @@ //! A list of the different weight modules for our runtime. +pub mod bb_bnc; pub mod bifrost_asset_registry; pub mod bifrost_buy_back; pub mod bifrost_channel_commission; @@ -36,7 +37,6 @@ pub mod bifrost_slpx; pub mod bifrost_stable_pool; pub mod bifrost_system_maker; pub mod bifrost_system_staking; -pub mod bifrost_ve_minting; pub mod bifrost_vesting; pub mod bifrost_vstoken_conversion; pub mod bifrost_vtoken_minting; diff --git a/runtime/bifrost-polkadot/src/xcm_config.rs b/runtime/bifrost-polkadot/src/xcm_config.rs index ba5860112..9c43feb13 100644 --- a/runtime/bifrost-polkadot/src/xcm_config.rs +++ b/runtime/bifrost-polkadot/src/xcm_config.rs @@ -269,11 +269,11 @@ impl Contains for SafeCallFilter { bifrost_vstoken_conversion::Call::vsbond_convert_to_vstoken { .. } | bifrost_vstoken_conversion::Call::vstoken_convert_to_vsbond { .. } ) | - RuntimeCall::VeMinting( - bifrost_ve_minting::Call::increase_amount { .. } | - bifrost_ve_minting::Call::increase_unlock_time { .. } | - bifrost_ve_minting::Call::withdraw { .. } | - bifrost_ve_minting::Call::get_rewards { .. } + RuntimeCall::BbBNC( + bb_bnc::Call::increase_amount { .. } | + bb_bnc::Call::increase_unlock_time { .. } | + bb_bnc::Call::withdraw { .. } | + bb_bnc::Call::get_rewards { .. } ) | RuntimeCall::VtokenMinting( bifrost_vtoken_minting::Call::mint { .. } |