From c36898d48ae28d25e137c24db02f746b8b419ce4 Mon Sep 17 00:00:00 2001 From: lemunozm Date: Tue, 14 Mar 2023 11:58:43 +0100 Subject: [PATCH 1/2] add loans to centrifuge --- Cargo.lock | 2 +- runtime/centrifuge/Cargo.toml | 2 +- runtime/centrifuge/src/lib.rs | 61 +++++++++---------- runtime/centrifuge/src/weights/mod.rs | 2 +- .../src/weights/pallet_loans_ref.rs | 46 ++++++++++++++ 5 files changed, 78 insertions(+), 35 deletions(-) create mode 100644 runtime/centrifuge/src/weights/pallet_loans_ref.rs diff --git a/Cargo.lock b/Cargo.lock index 1d28fc9e55..3249eada4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1007,7 +1007,7 @@ dependencies = [ "pallet-interest-accrual", "pallet-investments", "pallet-keystore", - "pallet-loans", + "pallet-loans-ref", "pallet-migration-manager", "pallet-multisig", "pallet-nft", diff --git a/runtime/centrifuge/Cargo.toml b/runtime/centrifuge/Cargo.toml index fba8dcc89c..9e2c729944 100644 --- a/runtime/centrifuge/Cargo.toml +++ b/runtime/centrifuge/Cargo.toml @@ -101,7 +101,7 @@ pallet-fees = { path = "../../pallets/fees", default-features = false } pallet-interest-accrual = { path = "../../pallets/interest-accrual", default-features = false } pallet-investments = { path = "../../pallets/investments", default-features = false } pallet-keystore = { path = "../../pallets/keystore", default-features = false } -pallet-loans = { path = "../../pallets/loans", default-features = false } +pallet-loans = { package = "pallet-loans-ref", path = "../../pallets/loans-ref", default-features = false } pallet-migration-manager = { path = "../../pallets/migration", default-features = false } pallet-nft = { path = "../../pallets/nft", default-features = false } pallet-permissions = { path = "../../pallets/permissions", default-features = false } diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 98f04c19fd..32122d73f3 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -20,7 +20,8 @@ pub use cfg_primitives::{constants::*, types::*}; use cfg_traits::{ - OrderManager, Permissions as PermissionsT, PoolUpdateGuard, PreConditions, TrancheCurrency as _, + OrderManager, Permissions as PermissionsT, PoolNAV, PoolUpdateGuard, PreConditions, + TrancheCurrency as _, }; use cfg_types::{ consts::pools::{MaxTrancheNameLengthBytes, MaxTrancheSymbolLengthBytes}, @@ -551,7 +552,6 @@ pub enum ProxyType { _Staking, NonProxy, Borrow, - Price, Invest, ProxyManagement, KeystoreManagement, @@ -630,14 +630,13 @@ impl InstanceFilter for ProxyType { RuntimeCall::Loans(pallet_loans::Call::close{..}) | // Borrowers should be able to close and execute an epoch // in order to get liquidity from repayments in previous epochs. - RuntimeCall::Loans(pallet_loans::Call::update_nav{..}) | + RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch{..}) | RuntimeCall::Utility(pallet_utility::Call::batch_all{..}) | RuntimeCall::Utility(pallet_utility::Call::batch{..}) ), - ProxyType::Price => matches!(c, RuntimeCall::Loans(pallet_loans::Call::price { .. })), ProxyType::Invest => matches!( c, RuntimeCall::Investments(pallet_investments::Call::update_invest_order{..}) | @@ -646,7 +645,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Investments(pallet_investments::Call::collect_redemptions{..}) | // Investors should be able to close and execute an epoch // in order to get their orders fulfilled. - RuntimeCall::Loans(pallet_loans::Call::update_nav{..}) | + RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch{..}) | @@ -1467,26 +1466,25 @@ impl pallet_interest_accrual::Config for Runtime { parameter_types! { pub const LoansPalletId: PalletId = cfg_types::ids::LOANS_PALLET_ID; pub const MaxActiveLoansPerPool: u32 = 1000; - pub const MaxWriteOffGroups: u32 = 100; + pub const MaxWriteOffPolicySize: u32 = 100; } impl pallet_loans::Config for Runtime { type Balance = Balance; - type BlockNumberProvider = System; - type ClassId = CollectionId; + type CollectionId = CollectionId; type CurrencyId = CurrencyId; type InterestAccrual = InterestAccrual; - type LoanId = ItemId; - type LoansPalletId = LoansPalletId; + type ItemId = ItemId; + type LoanId = LoanId; type MaxActiveLoansPerPool = MaxActiveLoansPerPool; - type MaxWriteOffGroups = MaxWriteOffGroups; + type MaxWriteOffPolicySize = MaxWriteOffPolicySize; type NonFungible = Uniques; - type Permission = Permissions; + type Permissions = Permissions; type Pool = PoolSystem; type Rate = Rate; type RuntimeEvent = RuntimeEvent; type Time = Timestamp; - type WeightInfo = weights::pallet_loans::WeightInfo; + type WeightInfo = weights::pallet_loans_ref::WeightInfo; } parameter_types! { @@ -1786,11 +1784,9 @@ impl_runtime_apis! { } fn tranche_token_price(pool_id: PoolId, tranche: TrancheLoc) -> Option{ - let now = as UnixTime>::now().as_secs(); - let mut pool = pallet_pool_system::Pool::::get(pool_id)?; - let nav: Balance = pallet_loans::Pallet::::update_nav_of_pool(pool_id) - .ok() - .map(|(latest, _)| latest.into())?; + let now = ::now().as_secs(); + let mut pool = PoolSystem::pool(pool_id)?; + let nav = Loans::update_nav(pool_id).ok()?; let total_assets = pool.reserve.total.saturating_add(nav); let index: usize = pool.tranches.tranche_index(&tranche)?.try_into().ok()?; let prices = pool @@ -1801,11 +1797,9 @@ impl_runtime_apis! { } fn tranche_token_prices(pool_id: PoolId) -> Option>{ - let now = as UnixTime>::now().as_secs(); - let mut pool = pallet_pool_system::Pool::::get(pool_id)?; - let nav: Balance = pallet_loans::Pallet::::update_nav_of_pool(pool_id) - .ok() - .map(|(latest, _)| latest.into())?; + let now = ::now().as_secs(); + let mut pool = PoolSystem::pool(pool_id)?; + let nav = Loans::update_nav(pool_id).ok()?; let total_assets = pool.reserve.total.saturating_add(nav); pool .tranches @@ -1840,7 +1834,11 @@ impl_runtime_apis! { use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList}; use frame_support::traits::StorageInfoTrait; use frame_system_benchmarking::Pallet as SystemBench; - use pallet_loans::benchmarking::Pallet as LoansPallet; + + // Used to avoid breaking the benchmark script. + // This can be removed once pallet-loans-ref is called pallet-loans + #[allow(unused_imports)] + use pallet_loans as pallet_loans_ref; let mut list = Vec::::new(); @@ -1869,9 +1867,8 @@ impl_runtime_apis! { list_benchmark!(list, extra, pallet_interest_accrual, InterestAccrual); list_benchmark!(list, extra, pallet_uniques, Uniques); list_benchmark!(list, extra, pallet_keystore, Keystore); - list_benchmark!(list, extra, pallet_loans, LoansPallet::); list_benchmark!(list, extra, pallet_restricted_tokens, Tokens); - + list_benchmark!(list, extra, pallet_loans_ref, Loans); let storage_info = AllPalletsWithSystem::storage_info(); @@ -1903,14 +1900,14 @@ impl_runtime_apis! { let mut batches = Vec::::new(); let params = (&config, &whitelist); - use pallet_loans::benchmarking::Pallet as LoansPallet; - impl pallet_loans::benchmarking::Config for Runtime { - type IM = Investments; - } - // It should be called Anchors to make the runtime_benchmarks.sh script works type Anchors = Anchor; + // Used to avoid breaking the benchmark script. + // This can be removed once pallet-loans-ref is called pallet-loans + #[allow(unused_imports)] + use pallet_loans as pallet_loans_ref; + add_benchmark!(params, batches, frame_system, SystemBench::); add_benchmark!(params, batches, pallet_timestamp, Timestamp); add_benchmark!(params, batches, pallet_balances, Balances); @@ -1936,8 +1933,8 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_interest_accrual, InterestAccrual); add_benchmark!(params, batches, pallet_uniques, Uniques); add_benchmark!(params, batches, pallet_keystore, Keystore); - add_benchmark!(params, batches, pallet_loans, LoansPallet::); add_benchmark!(params, batches, pallet_restricted_tokens, Tokens); + add_benchmark!(params, batches, pallet_loans_ref, Loans); if batches.is_empty() { return Err("Benchmark not found for this pallet.".into()) } Ok(batches) diff --git a/runtime/centrifuge/src/weights/mod.rs b/runtime/centrifuge/src/weights/mod.rs index 08f0d6a480..e6b17318d3 100644 --- a/runtime/centrifuge/src/weights/mod.rs +++ b/runtime/centrifuge/src/weights/mod.rs @@ -21,7 +21,7 @@ pub mod pallet_fees; pub mod pallet_identity; pub mod pallet_interest_accrual; pub mod pallet_keystore; -pub mod pallet_loans; +pub mod pallet_loans_ref; pub mod pallet_migration_manager; pub mod pallet_multisig; pub mod pallet_permissions; diff --git a/runtime/centrifuge/src/weights/pallet_loans_ref.rs b/runtime/centrifuge/src/weights/pallet_loans_ref.rs new file mode 100644 index 0000000000..dba0528083 --- /dev/null +++ b/runtime/centrifuge/src/weights/pallet_loans_ref.rs @@ -0,0 +1,46 @@ + +//! Autogenerated weights for `pallet_loans` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-03-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `MBP-de-Luis.home`, CPU: `` +//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: Some("development"), DB CACHE: 1024 + +// Executed Command: +// target/release/centrifuge-chain +// benchmark +// pallet +// --pallet=pallet-loans +// --chain +// development +// --extrinsic=* +// --output=runtime/development/src/weights/pallet_loans.rs + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_loans`. +pub struct WeightInfo(PhantomData); +impl pallet_loans::WeightInfo for WeightInfo { + // Storage: PoolSystem Pool (r:1 w:0) + // Storage: InterestAccrual Rates (r:1 w:0) + // Storage: LoansRef ActiveLoans (r:1 w:0) + // Storage: Timestamp Now (r:1 w:0) + // Storage: LoansRef PortfolioValuation (r:0 w:1) + /// The range of component `n` is `[1, 50]`. + /// The range of component `m` is `[1, 50]`. + fn update_portfolio_valuation(n: u32, m: u32, ) -> Weight { + // Minimum execution time: 33_000 nanoseconds. + Weight::from_ref_time(33_000_000 as u64) + // Standard Error: 380_142 + .saturating_add(Weight::from_ref_time(4_619_571 as u64).saturating_mul(n as u64)) + // Standard Error: 380_142 + .saturating_add(Weight::from_ref_time(313_449 as u64).saturating_mul(m as u64)) + .saturating_add(T::DbWeight::get().reads(4 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } +} From 68d61d55b6e9e11a1e0f0edf84b8fb1644ecbbb0 Mon Sep 17 00:00:00 2001 From: lemunozm Date: Fri, 17 Mar 2023 11:55:14 +0100 Subject: [PATCH 2/2] fix loan addition --- runtime/centrifuge/Cargo.toml | 8 +- runtime/centrifuge/src/lib.rs | 28 ++----- .../src/weights/pallet_loans_ref.rs | 76 ++++++++++++----- .../src/weights/pallet_loans_ref.rs | 82 ------------------- 4 files changed, 69 insertions(+), 125 deletions(-) delete mode 100644 runtime/development/src/weights/pallet_loans_ref.rs diff --git a/runtime/centrifuge/Cargo.toml b/runtime/centrifuge/Cargo.toml index 9e2c729944..de49f4b477 100644 --- a/runtime/centrifuge/Cargo.toml +++ b/runtime/centrifuge/Cargo.toml @@ -101,7 +101,7 @@ pallet-fees = { path = "../../pallets/fees", default-features = false } pallet-interest-accrual = { path = "../../pallets/interest-accrual", default-features = false } pallet-investments = { path = "../../pallets/investments", default-features = false } pallet-keystore = { path = "../../pallets/keystore", default-features = false } -pallet-loans = { package = "pallet-loans-ref", path = "../../pallets/loans-ref", default-features = false } +pallet-loans-ref = { path = "../../pallets/loans-ref", default-features = false } pallet-migration-manager = { path = "../../pallets/migration", default-features = false } pallet-nft = { path = "../../pallets/nft", default-features = false } pallet-permissions = { path = "../../pallets/permissions", default-features = false } @@ -162,7 +162,7 @@ std = [ "pallet-identity/std", "pallet-interest-accrual/std", "pallet-investments/std", - "pallet-loans/std", + "pallet-loans-ref/std", "pallet-keystore/std", "pallet-migration-manager/std", "pallet-multisig/std", @@ -236,7 +236,7 @@ runtime-benchmarks = [ "pallet-identity/runtime-benchmarks", "pallet-interest-accrual/runtime-benchmarks", "pallet-investments/runtime-benchmarks", - "pallet-loans/runtime-benchmarks", + "pallet-loans-ref/runtime-benchmarks", "pallet-keystore/runtime-benchmarks", "pallet-migration-manager/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", @@ -297,7 +297,7 @@ try-runtime = [ "pallet-identity/try-runtime", "pallet-interest-accrual/try-runtime", "pallet-investments/try-runtime", - "pallet-loans/try-runtime", + "pallet-loans-ref/try-runtime", "pallet-keystore/try-runtime", "pallet-migration-manager/try-runtime", "pallet-multisig/try-runtime", diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 32122d73f3..5c202ce053 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -623,14 +623,14 @@ impl InstanceFilter for ProxyType { } ProxyType::Borrow => matches!( c, - RuntimeCall::Loans(pallet_loans::Call::create{..}) | - RuntimeCall::Loans(pallet_loans::Call::borrow{..}) | - RuntimeCall::Loans(pallet_loans::Call::repay{..}) | - RuntimeCall::Loans(pallet_loans::Call::write_off{..}) | - RuntimeCall::Loans(pallet_loans::Call::close{..}) | + RuntimeCall::Loans(pallet_loans_ref::Call::create{..}) | + RuntimeCall::Loans(pallet_loans_ref::Call::borrow{..}) | + RuntimeCall::Loans(pallet_loans_ref::Call::repay{..}) | + RuntimeCall::Loans(pallet_loans_ref::Call::write_off{..}) | + RuntimeCall::Loans(pallet_loans_ref::Call::close{..}) | // Borrowers should be able to close and execute an epoch // in order to get liquidity from repayments in previous epochs. - RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation{..}) | + RuntimeCall::Loans(pallet_loans_ref::Call::update_portfolio_valuation{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch{..}) | @@ -645,7 +645,7 @@ impl InstanceFilter for ProxyType { RuntimeCall::Investments(pallet_investments::Call::collect_redemptions{..}) | // Investors should be able to close and execute an epoch // in order to get their orders fulfilled. - RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation{..}) | + RuntimeCall::Loans(pallet_loans_ref::Call::update_portfolio_valuation{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution{..}) | RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch{..}) | @@ -1469,7 +1469,7 @@ parameter_types! { pub const MaxWriteOffPolicySize: u32 = 100; } -impl pallet_loans::Config for Runtime { +impl pallet_loans_ref::Config for Runtime { type Balance = Balance; type CollectionId = CollectionId; type CurrencyId = CurrencyId; @@ -1617,7 +1617,7 @@ construct_runtime!( InterestAccrual: pallet_interest_accrual::{Pallet, Storage, Event, Config} = 184, Uniques: pallet_uniques::{Pallet, Call, Storage, Event} = 185, Keystore: pallet_keystore::{Pallet, Call, Storage, Event} = 186, - Loans: pallet_loans::{Pallet, Call, Storage, Event} = 187, + Loans: pallet_loans_ref::{Pallet, Call, Storage, Event} = 187, } ); @@ -1835,11 +1835,6 @@ impl_runtime_apis! { use frame_support::traits::StorageInfoTrait; use frame_system_benchmarking::Pallet as SystemBench; - // Used to avoid breaking the benchmark script. - // This can be removed once pallet-loans-ref is called pallet-loans - #[allow(unused_imports)] - use pallet_loans as pallet_loans_ref; - let mut list = Vec::::new(); list_benchmark!(list, extra, frame_system, SystemBench::); @@ -1903,11 +1898,6 @@ impl_runtime_apis! { // It should be called Anchors to make the runtime_benchmarks.sh script works type Anchors = Anchor; - // Used to avoid breaking the benchmark script. - // This can be removed once pallet-loans-ref is called pallet-loans - #[allow(unused_imports)] - use pallet_loans as pallet_loans_ref; - add_benchmark!(params, batches, frame_system, SystemBench::); add_benchmark!(params, batches, pallet_timestamp, Timestamp); add_benchmark!(params, batches, pallet_balances, Balances); diff --git a/runtime/centrifuge/src/weights/pallet_loans_ref.rs b/runtime/centrifuge/src/weights/pallet_loans_ref.rs index dba0528083..062bc5c194 100644 --- a/runtime/centrifuge/src/weights/pallet_loans_ref.rs +++ b/runtime/centrifuge/src/weights/pallet_loans_ref.rs @@ -1,10 +1,10 @@ -//! Autogenerated weights for `pallet_loans` +//! Autogenerated weights for `pallet_loans_ref` //! //! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev //! DATE: 2023-03-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` //! HOSTNAME: `MBP-de-Luis.home`, CPU: `` -//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: Some("development"), DB CACHE: 1024 +//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: Some("centrifuge"), DB CACHE: 1024 // Executed Command: // target/release/centrifuge-chain @@ -12,9 +12,9 @@ // pallet // --pallet=pallet-loans // --chain -// development +// centrifuge // --extrinsic=* -// --output=runtime/development/src/weights/pallet_loans.rs +// --output=runtime/centrifuge/src/weights/pallet_loans_ref.rs #![cfg_attr(rustfmt, rustfmt_skip)] #![allow(unused_parens)] @@ -23,24 +23,60 @@ use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; -/// Weight functions for `pallet_loans`. +/// Weight functions for `pallet_loans_ref`. pub struct WeightInfo(PhantomData); -impl pallet_loans::WeightInfo for WeightInfo { - // Storage: PoolSystem Pool (r:1 w:0) - // Storage: InterestAccrual Rates (r:1 w:0) - // Storage: LoansRef ActiveLoans (r:1 w:0) - // Storage: Timestamp Now (r:1 w:0) - // Storage: LoansRef PortfolioValuation (r:0 w:1) - /// The range of component `n` is `[1, 50]`. - /// The range of component `m` is `[1, 50]`. - fn update_portfolio_valuation(n: u32, m: u32, ) -> Weight { - // Minimum execution time: 33_000 nanoseconds. - Weight::from_ref_time(33_000_000 as u64) - // Standard Error: 380_142 - .saturating_add(Weight::from_ref_time(4_619_571 as u64).saturating_mul(n as u64)) - // Standard Error: 380_142 - .saturating_add(Weight::from_ref_time(313_449 as u64).saturating_mul(m as u64)) +impl pallet_loans_ref::WeightInfo for WeightInfo { + fn update_portfolio_valuation(n: u32) -> Weight { + Weight::from_ref_time(31_740_408) // Standard Error: 4_421 + .saturating_add(Weight::from_ref_time(5_889_944).saturating_mul(n as u64)) .saturating_add(T::DbWeight::get().reads(4 as u64)) .saturating_add(T::DbWeight::get().writes(1 as u64)) } + + fn create() -> Weight { + Weight::from_ref_time(55_000_000) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(6 as u64)) + } + + fn borrow(n: u32) -> Weight { + Weight::from_ref_time(89_980_992) // Standard Error: 6_031 + .saturating_add(Weight::from_ref_time(339_355).saturating_mul(n as u64)) + .saturating_add(T::DbWeight::get().reads(9 as u64)) + .saturating_add(T::DbWeight::get().writes(7 as u64)) + } + + fn repay(n: u32) -> Weight { + Weight::from_ref_time(88_057_556) // Standard Error: 9_218 + .saturating_add(Weight::from_ref_time(296_755).saturating_mul(n as u64)) + .saturating_add(T::DbWeight::get().reads(8 as u64)) + .saturating_add(T::DbWeight::get().writes(5 as u64)) + } + + fn write_off(n: u32) -> Weight { + Weight::from_ref_time(50_179_983) // Standard Error: 1_760 + .saturating_add(Weight::from_ref_time(299_592).saturating_mul(n as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + + fn admin_write_off(n: u32) -> Weight { + Weight::from_ref_time(63_153_708) // Standard Error: 2_472 + .saturating_add(Weight::from_ref_time(325_868).saturating_mul(n as u64)) + .saturating_add(T::DbWeight::get().reads(6 as u64)) + .saturating_add(T::DbWeight::get().writes(3 as u64)) + } + + fn close(n: u32) -> Weight { + Weight::from_ref_time(55_882_678) // Standard Error: 7_625 + .saturating_add(Weight::from_ref_time(338_879).saturating_mul(n as u64)) + .saturating_add(T::DbWeight::get().reads(5 as u64)) + .saturating_add(T::DbWeight::get().writes(7 as u64)) + } + + fn update_write_off_policy() -> Weight { + Weight::from_ref_time(27_000_000) + .saturating_add(T::DbWeight::get().reads(2 as u64)) + .saturating_add(T::DbWeight::get().writes(1 as u64)) + } } diff --git a/runtime/development/src/weights/pallet_loans_ref.rs b/runtime/development/src/weights/pallet_loans_ref.rs deleted file mode 100644 index 565551d44f..0000000000 --- a/runtime/development/src/weights/pallet_loans_ref.rs +++ /dev/null @@ -1,82 +0,0 @@ - -//! Autogenerated weights for `pallet_loans_ref` -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2023-03-09, STEPS: `2`, REPEAT: 1, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! HOSTNAME: `MBP-de-Luis.home`, CPU: `` -//! EXECUTION: None, WASM-EXECUTION: Compiled, CHAIN: Some("development"), DB CACHE: 1024 - -// Executed Command: -// target/release/centrifuge-chain -// benchmark -// pallet -// --pallet=pallet-loans -// --chain -// development -// --extrinsic=* -// --output=runtime/development/src/weights/pallet_loans_ref.rs - -#![cfg_attr(rustfmt, rustfmt_skip)] -#![allow(unused_parens)] -#![allow(unused_imports)] - -use frame_support::{traits::Get, weights::Weight}; -use sp_std::marker::PhantomData; - -/// Weight functions for `pallet_loans_ref`. -pub struct WeightInfo(PhantomData); -impl pallet_loans_ref::WeightInfo for WeightInfo { - fn update_portfolio_valuation(n: u32) -> Weight { - Weight::from_ref_time(31_740_408) // Standard Error: 4_421 - .saturating_add(Weight::from_ref_time(5_889_944).saturating_mul(n as u64)) - .saturating_add(T::DbWeight::get().reads(4 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } - - fn create() -> Weight { - Weight::from_ref_time(55_000_000) - .saturating_add(T::DbWeight::get().reads(6 as u64)) - .saturating_add(T::DbWeight::get().writes(6 as u64)) - } - - fn borrow(n: u32) -> Weight { - Weight::from_ref_time(89_980_992) // Standard Error: 6_031 - .saturating_add(Weight::from_ref_time(339_355).saturating_mul(n as u64)) - .saturating_add(T::DbWeight::get().reads(9 as u64)) - .saturating_add(T::DbWeight::get().writes(7 as u64)) - } - - fn repay(n: u32) -> Weight { - Weight::from_ref_time(88_057_556) // Standard Error: 9_218 - .saturating_add(Weight::from_ref_time(296_755).saturating_mul(n as u64)) - .saturating_add(T::DbWeight::get().reads(8 as u64)) - .saturating_add(T::DbWeight::get().writes(5 as u64)) - } - - fn write_off(n: u32) -> Weight { - Weight::from_ref_time(50_179_983) // Standard Error: 1_760 - .saturating_add(Weight::from_ref_time(299_592).saturating_mul(n as u64)) - .saturating_add(T::DbWeight::get().reads(5 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } - - fn admin_write_off(n: u32) -> Weight { - Weight::from_ref_time(63_153_708) // Standard Error: 2_472 - .saturating_add(Weight::from_ref_time(325_868).saturating_mul(n as u64)) - .saturating_add(T::DbWeight::get().reads(6 as u64)) - .saturating_add(T::DbWeight::get().writes(3 as u64)) - } - - fn close(n: u32) -> Weight { - Weight::from_ref_time(55_882_678) // Standard Error: 7_625 - .saturating_add(Weight::from_ref_time(338_879).saturating_mul(n as u64)) - .saturating_add(T::DbWeight::get().reads(5 as u64)) - .saturating_add(T::DbWeight::get().writes(7 as u64)) - } - - fn update_write_off_policy() -> Weight { - Weight::from_ref_time(27_000_000) - .saturating_add(T::DbWeight::get().reads(2 as u64)) - .saturating_add(T::DbWeight::get().writes(1 as u64)) - } -}