diff --git a/Cargo.lock b/Cargo.lock index e8a6504ef..ba6e5a7be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1087,10 +1087,13 @@ dependencies = [ "frame-system-rpc-runtime-api", "frame-try-runtime", "hex-literal 0.3.4", + "lend-market", + "lend-market-rpc-runtime-api", "log", "merkle-distributor", "node-primitives", "nutsfinance-stable-asset", + "orml-oracle", "orml-tokens", "orml-traits", "orml-unknown-tokens", @@ -1111,6 +1114,7 @@ dependencies = [ "pallet-membership", "pallet-multisig", "pallet-preimage", + "pallet-prices", "pallet-proxy", "pallet-ranked-collective", "pallet-referenda", diff --git a/node/service/src/chain_spec/bifrost_kusama.rs b/node/service/src/chain_spec/bifrost_kusama.rs index 1c93e5498..bde462d31 100644 --- a/node/service/src/chain_spec/bifrost_kusama.rs +++ b/node/service/src/chain_spec/bifrost_kusama.rs @@ -24,9 +24,10 @@ use std::{ use bifrost_kusama_runtime::{ constants::currency::DOLLARS, AccountId, AssetRegistryConfig, Balance, BalancesConfig, BlockNumber, CouncilConfig, CouncilMembershipConfig, DefaultBlocksPerRound, DemocracyConfig, - GenesisConfig, IndicesConfig, InflationInfo, ParachainInfoConfig, ParachainStakingConfig, - PolkadotXcmConfig, Range, SS58Prefix, SalpConfig, SessionConfig, SystemConfig, - TechnicalCommitteeConfig, TechnicalMembershipConfig, TokensConfig, VestingConfig, WASM_BINARY, + GenesisConfig, IndicesConfig, InflationInfo, OracleMembershipConfig, ParachainInfoConfig, + ParachainStakingConfig, PolkadotXcmConfig, Range, SS58Prefix, SalpConfig, SessionConfig, + SystemConfig, TechnicalCommitteeConfig, TechnicalMembershipConfig, TokensConfig, VestingConfig, + WASM_BINARY, }; use bifrost_runtime_common::AuraId; use cumulus_primitives_core::ParaId; @@ -128,6 +129,7 @@ pub fn bifrost_genesis( Vec, Vec<(CurrencyId, u32, u32, u32)>, ), + oracle_membership: Vec, ) -> GenesisConfig { GenesisConfig { system: SystemConfig { @@ -144,6 +146,10 @@ pub fn bifrost_genesis( members: technical_committee_membership.try_into().expect("convert error!"), phantom: Default::default(), }, + oracle_membership: OracleMembershipConfig { + members: oracle_membership.try_into().expect("convert error!"), + phantom: Default::default(), + }, council: CouncilConfig { members: vec![], phantom: Default::default() }, technical_committee: TechnicalCommitteeConfig { members: vec![], @@ -216,6 +222,7 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig { let council_membership = vec![get_account_id_from_seed::("Alice")]; let technical_committee_membership = vec![get_account_id_from_seed::("Alice")]; + let oracle_membership = vec![get_account_id_from_seed::("Alice")]; let salp_multisig: AccountId = hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into(); @@ -235,6 +242,7 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig { technical_committee_membership, salp_multisig, (vec![], vec![], vec![]), + oracle_membership, ) } @@ -304,6 +312,7 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig { let council_membership = vec![get_account_id_from_seed::("Alice")]; let technical_committee_membership = vec![get_account_id_from_seed::("Alice")]; + let oracle_membership = vec![get_account_id_from_seed::("Alice")]; let salp_multisig: AccountId = hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into(); @@ -370,6 +379,7 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig { technical_committee_membership, salp_multisig, (currency, vcurrency, vsbond), + oracle_membership, ) } @@ -445,6 +455,10 @@ fn rococo_testnet_config_genesis(id: ParaId) -> GenesisConfig { // dDWnEWnx3GUgfugXh9mZtgj4CvJdmd8naYkWYCZGxjfb1Cz hex!["420398e0150cd9d417fb8fd4027b75bd42717262e6eac97c55f2f8f84e8ffb3f"].into(), ]; + let oracle_membership = vec![ + // dDWnEWnx3GUgfugXh9mZtgj4CvJdmd8naYkWYCZGxjfb1Cz + hex!["420398e0150cd9d417fb8fd4027b75bd42717262e6eac97c55f2f8f84e8ffb3f"].into(), + ]; bifrost_genesis( invulnerables, @@ -464,6 +478,7 @@ fn rococo_testnet_config_genesis(id: ParaId) -> GenesisConfig { vec![], vec![], ), + oracle_membership, ) } @@ -503,6 +518,7 @@ fn rococo_local_config_genesis(id: ParaId) -> GenesisConfig { let council_membership = vec![get_account_id_from_seed::("Alice")]; let technical_committee_membership = vec![get_account_id_from_seed::("Alice")]; + let oracle_membership = vec![get_account_id_from_seed::("Alice")]; bifrost_genesis( vec![ @@ -526,6 +542,7 @@ fn rococo_local_config_genesis(id: ParaId) -> GenesisConfig { technical_committee_membership, salp_multisig, (vec![(Token(DOT), 100_000_000, None), (Token(KSM), 10_000_000, None)], vec![], vec![]), + oracle_membership, ) } @@ -642,6 +659,7 @@ fn bifrost_config_genesis(id: ParaId) -> GenesisConfig { vec![], // technical committee membership salp_multisig, (vec![], vec![], vec![]), + vec![], ) } diff --git a/node/service/src/chain_spec/bifrost_polkadot.rs b/node/service/src/chain_spec/bifrost_polkadot.rs index b624a1406..c53d9df4f 100644 --- a/node/service/src/chain_spec/bifrost_polkadot.rs +++ b/node/service/src/chain_spec/bifrost_polkadot.rs @@ -19,8 +19,9 @@ use bifrost_polkadot_runtime::{ constants::currency::DOLLARS, AccountId, AssetRegistryConfig, Balance, BalancesConfig, BlockNumber, CollatorSelectionConfig, CouncilMembershipConfig, GenesisConfig, IndicesConfig, - ParachainInfoConfig, PolkadotXcmConfig, SS58Prefix, SalpConfig, SessionConfig, SystemConfig, - TechnicalMembershipConfig, TokensConfig, VestingConfig, WASM_BINARY, + OracleMembershipConfig, ParachainInfoConfig, PolkadotXcmConfig, SS58Prefix, SalpConfig, + SessionConfig, SystemConfig, TechnicalMembershipConfig, TokensConfig, VestingConfig, + WASM_BINARY, }; use bifrost_runtime_common::AuraId; use cumulus_primitives_core::ParaId; @@ -83,6 +84,7 @@ pub fn bifrost_polkadot_genesis( Vec, Vec<(CurrencyId, u32, u32, u32)>, ), + oracle_membership: Vec, ) -> GenesisConfig { GenesisConfig { system: SystemConfig { @@ -99,6 +101,10 @@ pub fn bifrost_polkadot_genesis( members: technical_committee_membership.try_into().expect("convert error!"), phantom: Default::default(), }, + oracle_membership: OracleMembershipConfig { + members: oracle_membership.try_into().expect("convert error!"), + phantom: Default::default(), + }, council: Default::default(), technical_committee: Default::default(), treasury: Default::default(), @@ -156,6 +162,7 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig { let council_membership = vec![get_account_id_from_seed::("Alice")]; let technical_committee_membership = vec![get_account_id_from_seed::("Alice")]; + let oracle_membership = vec![get_account_id_from_seed::("Alice")]; let salp_multisig: AccountId = hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into(); @@ -172,6 +179,7 @@ fn development_config_genesis(id: ParaId) -> GenesisConfig { technical_committee_membership, salp_multisig, (vec![], vec![], vec![]), + oracle_membership, ) } @@ -219,6 +227,7 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig { .collect(); let council_membership = vec![get_account_id_from_seed::("Alice")]; let technical_committee_membership = vec![get_account_id_from_seed::("Alice")]; + let oracle_membership = vec![get_account_id_from_seed::("Alice")]; let salp_multisig: AccountId = hex!["49daa32c7287890f38b7e1a8cd2961723d36d20baa0bf3b82e0c4bdda93b1c0a"].into(); let currency = vec![ @@ -247,6 +256,7 @@ fn local_config_genesis(id: ParaId) -> GenesisConfig { technical_committee_membership, salp_multisig, (currency, vcurrency, vec![]), + oracle_membership, ) } @@ -321,5 +331,6 @@ fn bifrost_polkadot_config_genesis(id: ParaId) -> GenesisConfig { vec![], salp_multisig, (vec![], vec![], vec![]), + vec![], ) } diff --git a/pallets/lend-market/src/mock.rs b/pallets/lend-market/src/mock.rs index 65cda0766..9909b8707 100644 --- a/pallets/lend-market/src/mock.rs +++ b/pallets/lend-market/src/mock.rs @@ -310,8 +310,6 @@ impl pallet_assets::Config for Test { type WeightInfo = (); type RemoveItemsLimit = frame_support::traits::ConstU32<1000>; type CallbackHandle = (); - // #[cfg(feature = "runtime-benchmarks")] - // type BenchmarkHelper = (); } impl pallet_prices::Config for Test { diff --git a/runtime/bifrost-kusama/src/lib.rs b/runtime/bifrost-kusama/src/lib.rs index 8b6a4fb9c..c2c621341 100644 --- a/runtime/bifrost-kusama/src/lib.rs +++ b/runtime/bifrost-kusama/src/lib.rs @@ -1708,7 +1708,7 @@ impl orml_oracle::Config for Runtime { type RootOperatorAccountId = OracleRootOperatorAccountId; type MaxHasDispatchedSize = MaxHasDispatchedSize; type WeightInfo = weights::orml_oracle::WeightInfo; - type Members = CouncilMembership; + type Members = OracleMembership; } pub type TimeStampedPrice = orml_oracle::TimestampedValue; @@ -1759,6 +1759,23 @@ impl lend_market::Config for Runtime { type LiquidationFreeAssetId = RelayCurrencyId; } +parameter_types! { + pub const OracleMaxMembers: u32 = 100; +} + +impl pallet_membership::Config for Runtime { + type AddOrigin = MoreThanHalfCouncil; + type RuntimeEvent = RuntimeEvent; + type MaxMembers = OracleMaxMembers; + type MembershipInitialized = (); + type MembershipChanged = (); + type PrimeOrigin = MoreThanHalfCouncil; + type RemoveOrigin = MoreThanHalfCouncil; + type ResetOrigin = MoreThanHalfCouncil; + type SwapOrigin = MoreThanHalfCouncil; + type WeightInfo = pallet_membership::weights::SubstrateWeight; +} + // Below is the implementation of tokens manipulation functions other than native token. pub struct LocalAssetAdaptor(PhantomData); @@ -1947,6 +1964,7 @@ construct_runtime! { LendMarket: lend_market::{Pallet, Call, Storage, Event} = 131, Prices: pallet_prices::{Pallet, Call, Storage, Event} = 132, Oracle: orml_oracle::::{Pallet, Storage, Call, Event} = 133, + OracleMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 134, } } @@ -2015,7 +2033,7 @@ impl OnRuntimeUpgrade for BLPOnRuntimeUpgrade if let Some(old_metadata) = bifrost_asset_registry::CurrencyMetadatas::::get(CurrencyId::BLP(pool_id)) { - log::info!("Old currency_metadatas is {:?}", old_metadata); + log::info!("Old currency_metadatas name is {:?}", old_metadata.name); } } @@ -2044,7 +2062,9 @@ impl OnRuntimeUpgrade for BLPOnRuntimeUpgrade if let Some(new_metadata) = bifrost_asset_registry::CurrencyMetadatas::::get(CurrencyId::BLP(pool_id)) { - log::info!("New currency_metadatas is {:?}", new_metadata); + let symbol = scale_info::prelude::format!("BLP{}", pool_id).as_bytes().to_vec(); + assert_eq!(new_metadata.symbol, symbol); + log::info!("New currency_metadatas name is {:?}", new_metadata.name); } } diff --git a/runtime/bifrost-kusama/src/weights/orml_oracle.rs b/runtime/bifrost-kusama/src/weights/orml_oracle.rs index 699adfe05..dffcbeaf8 100644 --- a/runtime/bifrost-kusama/src/weights/orml_oracle.rs +++ b/runtime/bifrost-kusama/src/weights/orml_oracle.rs @@ -5,7 +5,7 @@ //! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 // Executed Command: -// /Users/xiliangchen/projects/acala/target/release/acala +// target/release/bifrost // benchmark // --chain=dev // --steps=50 diff --git a/runtime/bifrost-polkadot/Cargo.toml b/runtime/bifrost-polkadot/Cargo.toml index a8f413597..801c256d1 100644 --- a/runtime/bifrost-polkadot/Cargo.toml +++ b/runtime/bifrost-polkadot/Cargo.toml @@ -39,7 +39,7 @@ sp-version = { git = "https://github.com/paritytech/substrate", branch = "polkad # frame dependencies frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false, optional = true } frame-executive = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false } -frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false } +frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false, features = ["tuples-96"] } frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false } frame-system-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false, optional = true } frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false } @@ -118,6 +118,9 @@ bifrost-currencies = { workspace = true } bifrost-stable-pool = { path = "../../pallets/stable-pool", default-features = false } bifrost-stable-pool-rpc-runtime-api = { path = "../../pallets/stable-pool/rpc/runtime-api", default-features = false } bifrost-vtoken-voting = { path = "../../pallets/vtoken-voting", default-features = false, features = [ "polkadot" ] } +lend-market = { path = "../../pallets/lend-market", default-features = false } +lend-market-rpc-runtime-api = { path = "../../pallets/lend-market/rpc/runtime-api", default-features = false } +pallet-prices = { path = "../../pallets/prices", default-features = false } # orml orml-tokens = { version = "0.4.1-dev", default-features = false } @@ -126,6 +129,7 @@ orml-xtokens = { version = "0.4.1-dev", default-features = false } orml-unknown-tokens = { version = "0.4.1-dev", default-features = false } orml-xcm = { version = "0.4.1-dev", default-features = false } orml-xcm-support = { version = "0.4.1-dev", default-features = false } +orml-oracle = { version = "0.4.1-dev", default-features = false } merkle-distributor = { version = "*", default-features = false } zenlink-protocol = { version = "*", default-features = false } @@ -204,6 +208,7 @@ std = [ "orml-unknown-tokens/std", "orml-xcm/std", "orml-xcm-support/std", + "orml-oracle/std", "bifrost-runtime-common/std", "bifrost-farming/std", "bifrost-farming-rpc-runtime-api/std", @@ -226,6 +231,9 @@ std = [ "bifrost-cross-in-out/std", "substrate-wasm-builder", "bifrost-slpx/std", + "lend-market/std", + "lend-market-rpc-runtime-api/std", + "pallet-prices/std", "bifrost-stable-pool/std", "bifrost-stable-pool-rpc-runtime-api/std", ] @@ -261,6 +269,7 @@ runtime-benchmarks = [ "bifrost-stable-pool/runtime-benchmarks", "bifrost-vtoken-voting/runtime-benchmarks", "sp-api/disable-logging", + "lend-market/runtime-benchmarks", ] try-runtime = [ @@ -306,6 +315,7 @@ try-runtime = [ "bifrost-currencies/try-runtime", "orml-unknown-tokens/try-runtime", "orml-xcm/try-runtime", + "orml-oracle/try-runtime", "zenlink-protocol/try-runtime", "merkle-distributor/try-runtime", "bifrost-flexible-fee/try-runtime", @@ -326,6 +336,8 @@ try-runtime = [ "nutsfinance-stable-asset/try-runtime", "bifrost-stable-pool/try-runtime", "bifrost-vtoken-voting/try-runtime", + "lend-market/try-runtime", + "pallet-prices/try-runtime", ] # When enabled, the runtime API will not be build. diff --git a/runtime/bifrost-polkadot/src/lib.rs b/runtime/bifrost-polkadot/src/lib.rs index 84dbf307d..a9ed59026 100644 --- a/runtime/bifrost-polkadot/src/lib.rs +++ b/runtime/bifrost-polkadot/src/lib.rs @@ -50,6 +50,7 @@ pub use frame_support::{ PalletId, RuntimeDebug, StorageValue, }; use frame_system::limits::{BlockLength, BlockWeights}; +use orml_oracle::{DataFeeder, DataProvider, DataProviderExtended}; pub use pallet_balances::Call as BalancesCall; pub use pallet_timestamp::Call as TimestampCall; use sp_api::impl_runtime_apis; @@ -95,8 +96,9 @@ pub use node_primitives::{ XcmDestWeightAndFeeHandler, }, AccountId, Amount, AssetIds, Balance, BlockNumber, CurrencyId, CurrencyIdMapping, - DistributionId, ExtraFeeInfo, ExtraFeeName, Moment, Nonce, ParaId, PoolId, - RpcContributionStatus, TimeUnit, TokenSymbol, DOT_TOKEN_ID, GLMR_TOKEN_ID, + DistributionId, ExtraFeeInfo, ExtraFeeName, Liquidity, Moment, Nonce, ParaId, PoolId, Price, + Rate, Ratio, RpcContributionStatus, Shortfall, TimeUnit, TokenSymbol, DOT_TOKEN_ID, + GLMR_TOKEN_ID, }; // zenlink imports use bifrost_salp::remove_storage::RemoveUnusedQueryIdContributionInfo; @@ -307,6 +309,8 @@ parameter_types! { pub const VeMintingPalletId: PalletId = PalletId(*b"bf/vemnt"); pub const IncentivePalletId: PalletId = PalletId(*b"bf/veict"); pub const FarmingBoostPalletId: PalletId = PalletId(*b"bf/fmbst"); + pub const LendMarketPalletId: PalletId = PalletId(*b"bf/ldmkt"); + pub const OraclePalletId: PalletId = PalletId(*b"bf/oracl"); } impl frame_system::Config for Runtime { @@ -1494,6 +1498,93 @@ impl bifrost_ve_minting::Config for Runtime { type VoteWeightMultiplier = VoteWeightMultiplier; } +parameter_types! { + pub const MinimumCount: u32 = 3; + pub const ExpiresIn: Moment = 1000 * 60 * 60; // 60 mins + pub const MaxHasDispatchedSize: u32 = 100; + pub OracleRootOperatorAccountId: AccountId = OraclePalletId::get().into_account_truncating(); +} + +type BifrostDataProvider = orml_oracle::Instance1; +impl orml_oracle::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type OnNewData = (); + type CombineData = + orml_oracle::DefaultCombineData; + type Time = Timestamp; + type OracleKey = CurrencyId; + type OracleValue = Price; + type RootOperatorAccountId = OracleRootOperatorAccountId; + type MaxHasDispatchedSize = MaxHasDispatchedSize; + type WeightInfo = weights::orml_oracle::WeightInfo; + type Members = OracleMembership; +} + +pub type TimeStampedPrice = orml_oracle::TimestampedValue; +pub struct AggregatedDataProvider; +impl DataProvider for AggregatedDataProvider { + fn get(key: &CurrencyId) -> Option { + Oracle::get(key) + } +} + +impl DataProviderExtended for AggregatedDataProvider { + fn get_no_op(key: &CurrencyId) -> Option { + Oracle::get_no_op(key) + } + + fn get_all_values() -> Vec<(CurrencyId, Option)> { + Oracle::get_all_values() + } +} + +impl DataFeeder for AggregatedDataProvider { + fn feed_value(_: AccountId, _: CurrencyId, _: TimeStampedPrice) -> DispatchResult { + Err("Not supported".into()) + } +} + +impl pallet_prices::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type Source = AggregatedDataProvider; + type FeederOrigin = EitherOfDiverse; + type UpdateOrigin = EitherOfDiverse; + type RelayCurrency = RelayCurrencyId; + type CurrencyIdConvert = AssetIdMaps; + type Assets = Currencies; + type WeightInfo = pallet_prices::weights::SubstrateWeight; +} + +impl lend_market::Config for Runtime { + type RuntimeEvent = RuntimeEvent; + type PalletId = LendMarketPalletId; + type PriceFeeder = Prices; + type ReserveOrigin = EitherOfDiverse; + type UpdateOrigin = EitherOfDiverse; + type WeightInfo = lend_market::weights::BifrostWeight; + type UnixTime = Timestamp; + type Assets = Currencies; + type RewardAssetId = NativeCurrencyId; + type LiquidationFreeAssetId = RelayCurrencyId; +} + +parameter_types! { + pub const OracleMaxMembers: u32 = 100; +} + +impl pallet_membership::Config for Runtime { + type AddOrigin = MoreThanHalfCouncil; + type RuntimeEvent = RuntimeEvent; + type MaxMembers = OracleMaxMembers; + type MembershipInitialized = (); + type MembershipChanged = (); + type PrimeOrigin = MoreThanHalfCouncil; + type RemoveOrigin = MoreThanHalfCouncil; + type ResetOrigin = MoreThanHalfCouncil; + type SwapOrigin = MoreThanHalfCouncil; + type WeightInfo = pallet_membership::weights::SubstrateWeight; +} + // Below is the implementation of tokens manipulation functions other than native token. pub struct LocalAssetAdaptor(PhantomData); @@ -1676,6 +1767,10 @@ construct_runtime! { StableAsset: nutsfinance_stable_asset::{Pallet, Storage, Event} = 128, StablePool: bifrost_stable_pool::{Pallet, Call, Storage} = 129, VtokenVoting: bifrost_vtoken_voting::{Pallet, Call, Storage, Event} = 130, + LendMarket: lend_market::{Pallet, Call, Storage, Event} = 131, + Prices: pallet_prices::{Pallet, Call, Storage, Event} = 132, + Oracle: orml_oracle::::{Pallet, Storage, Call, Event} = 133, + OracleMembership: pallet_membership::::{Pallet, Call, Storage, Event, Config} = 134, } } @@ -1975,6 +2070,20 @@ impl_runtime_apis! { } } + impl lend_market_rpc_runtime_api::LendMarketApi for Runtime { + fn get_account_liquidity(account: AccountId) -> Result<(Liquidity, Shortfall, Liquidity, Shortfall), DispatchError> { + LendMarket::get_account_liquidity(&account) + } + + fn get_market_status(asset_id: CurrencyId) -> Result<(Rate, Rate, Rate, Ratio, Balance, Balance, sp_runtime::FixedU128), DispatchError> { + LendMarket::get_market_status(asset_id) + } + + fn get_liquidation_threshold_liquidity(account: AccountId) -> Result<(Liquidity, Shortfall, Liquidity, Shortfall), DispatchError> { + LendMarket::get_account_liquidation_threshold_liquidity(&account) + } + } + impl bifrost_stable_pool_rpc_runtime_api::StablePoolRuntimeApi for Runtime { fn get_swap_output( pool_id: u32, diff --git a/runtime/bifrost-polkadot/src/weights/mod.rs b/runtime/bifrost-polkadot/src/weights/mod.rs index 239b4103b..4190333bd 100644 --- a/runtime/bifrost-polkadot/src/weights/mod.rs +++ b/runtime/bifrost-polkadot/src/weights/mod.rs @@ -37,5 +37,6 @@ pub mod bifrost_ve_minting; pub mod bifrost_vstoken_conversion; pub mod bifrost_vtoken_minting; pub mod bifrost_vtoken_voting; +pub mod orml_oracle; pub mod orml_tokens; pub mod pallet_xcm; diff --git a/runtime/bifrost-polkadot/src/weights/orml_oracle.rs b/runtime/bifrost-polkadot/src/weights/orml_oracle.rs new file mode 100644 index 000000000..dffcbeaf8 --- /dev/null +++ b/runtime/bifrost-polkadot/src/weights/orml_oracle.rs @@ -0,0 +1,45 @@ +//! Autogenerated weights for orml_oracle +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-05-04, STEPS: [50, ], REPEAT: 20, LOW RANGE: [], HIGH RANGE: [] +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 128 + +// Executed Command: +// target/release/bifrost +// benchmark +// --chain=dev +// --steps=50 +// --repeat=20 +// --pallet=orml_oracle +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --output=./oracle/src/weights.rs +// --template +// ../templates/orml-weight-template.hbs + + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] +#![allow(clippy::unnecessary_cast)] + +use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; +use sp_std::marker::PhantomData; + +pub struct WeightInfo(PhantomData); +impl orml_oracle::WeightInfo for WeightInfo { + fn feed_values(c: u32, ) -> Weight { + Weight::from_parts(16_800_000, 0) + // Standard Error: 84_000 + .saturating_add(Weight::from_parts(3_600_000, 0).saturating_mul(c as u64)) + .saturating_add(RocksDbWeight::get().reads(3 as u64)) + .saturating_add(RocksDbWeight::get().writes(1 as u64)) + .saturating_add(RocksDbWeight::get().writes((2 as u64).saturating_mul(c as u64))) + } + fn on_finalize() -> Weight { + Weight::from_parts(3_000_000, 0) + .saturating_add(RocksDbWeight::get().writes(1 as u64)) + } +} \ No newline at end of file