diff --git a/Cargo.lock b/Cargo.lock index 4b13fa2b97..ebb7e3780c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -143,7 +143,8 @@ dependencies = [ "module-evm-accounts", "module-evm-bridge", "module-evm-rpc-runtime-api", - "module-homa-lite", + "module-homa", + "module-homa-xcm", "module-honzon", "module-idle-scheduler", "module-incentives", diff --git a/runtime/acala/Cargo.toml b/runtime/acala/Cargo.toml index 3df076798a..60bbbe5e2a 100644 --- a/runtime/acala/Cargo.toml +++ b/runtime/acala/Cargo.toml @@ -103,7 +103,8 @@ module-nft = { path = "../../modules/nft", default-features = false } module-prices = { path = "../../modules/prices", default-features = false } module-incentives = { path = "../../modules/incentives", default-features = false } module-support = { path = "../../modules/support", default-features = false } -module-homa-lite = { path = "../../modules/homa-lite", default-features = false } +module-homa = { path = "../../modules/homa", default-features = false } +module-homa-xcm = { path = "../../modules/homa-xcm", default-features = false } module-session-manager = { path = "../../modules/session-manager", default-features = false } module-relaychain = { path = "../../modules/relaychain", default-features = false, features = ["polkadot"] } module-idle-scheduler = { path = "../../modules/idle-scheduler", default-features = false } @@ -219,7 +220,8 @@ std = [ "module-prices/std", "module-incentives/std", "module-support/std", - "module-homa-lite/std", + "module-homa/std", + "module-homa-xcm/std", "module-session-manager/std", "module-relaychain/std", "module-idle-scheduler/std", @@ -245,7 +247,6 @@ runtime-benchmarks = [ "pallet-xcm/runtime-benchmarks", "module-nft/runtime-benchmarks", - "module-homa-lite/runtime-benchmarks", "module-evm-accounts/runtime-benchmarks", "sp-api/disable-logging", @@ -315,6 +316,7 @@ try-runtime = [ "module-nft/try-runtime", "module-prices/try-runtime", "module-incentives/try-runtime", - "module-homa-lite/try-runtime", + "module-homa/try-runtime", + "module-homa-xcm/try-runtime", "module-session-manager/try-runtime", ] diff --git a/runtime/acala/src/benchmarking/mod.rs b/runtime/acala/src/benchmarking/mod.rs index 7be90c868b..6697207e97 100644 --- a/runtime/acala/src/benchmarking/mod.rs +++ b/runtime/acala/src/benchmarking/mod.rs @@ -51,6 +51,9 @@ pub mod evm { pub mod evm_accounts { include!("../../../mandala/src/benchmarking/evm_accounts.rs"); } +pub mod homa { + include!("../../../mandala/src/benchmarking/homa.rs"); +} pub mod honzon { include!("../../../mandala/src/benchmarking/honzon.rs"); } diff --git a/runtime/acala/src/lib.rs b/runtime/acala/src/lib.rs index 1bc048b917..e747c6bddc 100644 --- a/runtime/acala/src/lib.rs +++ b/runtime/acala/src/lib.rs @@ -155,6 +155,7 @@ parameter_types! { pub const LoansPalletId: PalletId = PalletId(*b"aca/loan"); pub const DEXPalletId: PalletId = PalletId(*b"aca/dexm"); pub const CDPTreasuryPalletId: PalletId = PalletId(*b"aca/cdpt"); + pub const HomaPalletId: PalletId = PalletId(*b"aca/homa"); pub const HonzonTreasuryPalletId: PalletId = PalletId(*b"aca/hztr"); pub const HomaTreasuryPalletId: PalletId = PalletId(*b"aca/hmtr"); pub const IncentivesPalletId: PalletId = PalletId(*b"aca/inct"); @@ -175,6 +176,7 @@ pub fn get_all_module_accounts() -> Vec { CDPTreasuryPalletId::get().into_account(), CollatorPotId::get().into_account(), DEXPalletId::get().into_account(), + HomaPalletId::get().into_account(), HomaTreasuryPalletId::get().into_account(), HonzonTreasuryPalletId::get().into_account(), IncentivesPalletId::get().into_account(), @@ -829,7 +831,7 @@ impl module_prices::Config for Runtime { type GetStakingCurrencyId = GetStakingCurrencyId; type GetLiquidCurrencyId = GetLiquidCurrencyId; type LockOrigin = EnsureRootOrTwoThirdsGeneralCouncil; - type LiquidStakingExchangeRateProvider = HomaLite; + type LiquidStakingExchangeRateProvider = Homa; type DEX = Dex; type Currency = Currencies; type Erc20InfoMapping = EvmErc20InfoMapping; @@ -1158,7 +1160,7 @@ impl module_evm_accounts::Config for Runtime { impl module_asset_registry::Config for Runtime { type Event = Event; type Currency = Balances; - type LiquidCroadloanCurrencyId = DOTCurrencyId; + type LiquidCroadloanCurrencyId = GetStakingCurrencyId; type EVMBridge = module_evm_bridge::EVMBridge; type RegisterOrigin = EnsureRootOrHalfGeneralCouncil; type WeightInfo = weights::module_asset_registry::WeightInfo; @@ -1564,51 +1566,53 @@ pub fn create_x2_parachain_multilocation(index: u16) -> MultiLocation { } parameter_types! { - pub const DOTCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::DOT); - pub const LDOTCurrencyId: CurrencyId = CurrencyId::Token(TokenSymbol::LDOT); - pub MinimumMintThreshold: Balance = 5 * dollar(DOT); - pub MinimumRedeemThreshold: Balance = 50 * dollar(LDOT); - pub RelayChainSovereignSubAccount: MultiLocation = create_x2_parachain_multilocation(RelayChainSubAccountId::HomaLite as u16); - pub RelayChainSovereignSubAccountId: AccountId = Utility::derivative_account_id( - ParachainInfo::get().into_account(), - RelayChainSubAccountId::HomaLite as u16 - ); - pub MaxRewardPerEra: Permill = Permill::from_rational(500u32, 1_000_000u32); // 1.2 ^ (1/365) = 1.0004996359 - pub MintFee: Balance = 20 * millicent(DOT); // 2x XCM fee on Polkadot TODO: identify xcm fee pub DefaultExchangeRate: ExchangeRate = ExchangeRate::saturating_from_rational(1, 10); - pub BaseWithdrawFee: Permill = Permill::from_rational(14_085u32, 1_000_000u32); // 20% yield per year, unbounding period = 28 days. 1.2^(28/365) = 1.014085 - pub MaximumRedeemRequestMatchesForMint: u32 = 20; - pub RelayChainUnbondingSlashingSpans: u32 = 5; - pub MaxScheduledUnbonds: u32 = 35; - pub ParachainAccount: AccountId = ParachainInfo::get().into_account(); - pub SubAccountIndex: u16 = RelayChainSubAccountId::HomaLite as u16; - pub XcmUnbondFee: Balance = 60 * millicent(DOT); // TODO identify unbond fee + pub HomaTreasuryAccount: AccountId = HomaTreasuryPalletId::get().into_account(); + pub ActiveSubAccountsIndexList: Vec = vec![RelayChainSubAccountId::HomaLite as u16]; + pub BondingDuration: EraIndex = 28; + pub MintThreshold: Balance = 5 * dollar(DOT); + pub RedeemThreshold: Balance = 50 * dollar(LDOT); } -impl module_homa_lite::Config for Runtime { +impl module_homa::Config for Runtime { type Event = Event; - type WeightInfo = weights::module_homa_lite::WeightInfo; type Currency = Currencies; - type StakingCurrencyId = DOTCurrencyId; - type LiquidCurrencyId = LDOTCurrencyId; type GovernanceOrigin = EnsureRootOrHalfGeneralCouncil; - type MinimumMintThreshold = MinimumMintThreshold; - type MinimumRedeemThreshold = MinimumRedeemThreshold; - type XcmTransfer = XTokens; - type SovereignSubAccountLocation = RelayChainSovereignSubAccount; - type SubAccountIndex = SubAccountIndex; + type StakingCurrencyId = GetStakingCurrencyId; + type LiquidCurrencyId = GetLiquidCurrencyId; + type PalletId = HomaPalletId; + type TreasuryAccount = HomaTreasuryAccount; type DefaultExchangeRate = DefaultExchangeRate; - type MaxRewardPerEra = MaxRewardPerEra; - type MintFee = MintFee; - type RelayChainCallBuilder = RelayChainCallBuilder; - type BaseWithdrawFee = BaseWithdrawFee; - type XcmUnbondFee = XcmUnbondFee; + type ActiveSubAccountsIndexList = ActiveSubAccountsIndexList; + type BondingDuration = BondingDuration; + type MintThreshold = MintThreshold; + type RedeemThreshold = RedeemThreshold; type RelayChainBlockNumber = RelayChainBlockNumberProvider; + type HomaXcm = HomaXcm; + type WeightInfo = weights::module_homa::WeightInfo; +} + +pub struct SubAccountIndexMultiLocationConvertor; +impl Convert for SubAccountIndexMultiLocationConvertor { + fn convert(sub_account_index: u16) -> MultiLocation { + create_x2_parachain_multilocation(sub_account_index) + } +} + +parameter_types! { + pub RelayChainUnbondingSlashingSpans: u32 = 5; + pub ParachainAccount: AccountId = ParachainInfo::get().into_account(); +} + +impl module_homa_xcm::Config for Runtime { + type Event = Event; + type UpdateOrigin = EnsureRootOrHalfGeneralCouncil; + type StakingCurrencyId = GetStakingCurrencyId; type ParachainAccount = ParachainAccount; - type MaximumRedeemRequestMatchesForMint = MaximumRedeemRequestMatchesForMint; type RelayChainUnbondingSlashingSpans = RelayChainUnbondingSlashingSpans; - type MaxScheduledUnbonds = MaxScheduledUnbonds; - type StakingUpdateFrequency = OneDay; + type SovereignSubAccountLocationConvert = SubAccountIndexMultiLocationConvertor; + type RelayChainCallBuilder = RelayChainCallBuilder; + type XcmTransfer = XTokens; } pub type LocalAssetTransactor = MultiCurrencyAdapter< @@ -1837,7 +1841,8 @@ construct_runtime!( EmergencyShutdown: module_emergency_shutdown::{Pallet, Storage, Call, Event} = 105, // Homa - HomaLite: module_homa_lite::{Pallet, Call, Storage, Event} = 115, + Homa: module_homa::{Pallet, Call, Storage, Event} = 116, + HomaXcm: module_homa_xcm::{Pallet, Call, Storage, Event} = 117, // Acala Other Incentives: module_incentives::{Pallet, Storage, Call, Event} = 120, @@ -2129,14 +2134,11 @@ impl_runtime_apis! { use frame_benchmarking::{list_benchmark, Benchmarking, BenchmarkList}; use frame_support::traits::StorageInfoTrait; use orml_benchmarking::list_benchmark as orml_list_benchmark; - use module_nft::benchmarking::Pallet as NftBench; - use module_homa_lite::benchmarking::Pallet as HomaLiteBench; let mut list = Vec::::new(); list_benchmark!(list, extra, module_nft, NftBench::); - list_benchmark!(list, extra, module_homa_lite, HomaLiteBench::); orml_list_benchmark!(list, extra, module_dex, benchmarking::dex); orml_list_benchmark!(list, extra, module_asset_registry, benchmarking::asset_registry); @@ -2144,6 +2146,7 @@ impl_runtime_apis! { orml_list_benchmark!(list, extra, module_cdp_engine, benchmarking::cdp_engine); orml_list_benchmark!(list, extra, module_emergency_shutdown, benchmarking::emergency_shutdown); orml_list_benchmark!(list, extra, module_evm, benchmarking::evm); + orml_list_benchmark!(list, extra, module_homa, benchmarking::homa); orml_list_benchmark!(list, extra, module_honzon, benchmarking::honzon); orml_list_benchmark!(list, extra, module_cdp_treasury, benchmarking::cdp_treasury); orml_list_benchmark!(list, extra, module_collator_selection, benchmarking::collator_selection); @@ -2170,9 +2173,7 @@ impl_runtime_apis! { ) -> Result, sp_runtime::RuntimeString> { use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; use orml_benchmarking::{add_benchmark as orml_add_benchmark}; - use module_nft::benchmarking::Pallet as NftBench; - use module_homa_lite::benchmarking::Pallet as HomaLiteBench; let whitelist: Vec = vec![ // Block Number @@ -2195,7 +2196,6 @@ impl_runtime_apis! { let params = (&config, &whitelist); add_benchmark!(params, batches, module_nft, NftBench::); - add_benchmark!(params, batches, module_homa_lite, HomaLiteBench::); orml_add_benchmark!(params, batches, module_dex, benchmarking::dex); orml_add_benchmark!(params, batches, module_asset_registry, benchmarking::asset_registry); @@ -2203,6 +2203,7 @@ impl_runtime_apis! { orml_add_benchmark!(params, batches, module_cdp_engine, benchmarking::cdp_engine); orml_add_benchmark!(params, batches, module_emergency_shutdown, benchmarking::emergency_shutdown); orml_add_benchmark!(params, batches, module_evm, benchmarking::evm); + orml_add_benchmark!(params, batches, module_homa, benchmarking::homa); orml_add_benchmark!(params, batches, module_honzon, benchmarking::honzon); orml_add_benchmark!(params, batches, module_cdp_treasury, benchmarking::cdp_treasury); orml_add_benchmark!(params, batches, module_collator_selection, benchmarking::collator_selection); diff --git a/runtime/acala/src/weights/mod.rs b/runtime/acala/src/weights/mod.rs index 3fbe9244e8..46947c89d5 100644 --- a/runtime/acala/src/weights/mod.rs +++ b/runtime/acala/src/weights/mod.rs @@ -29,7 +29,7 @@ pub mod module_dex; pub mod module_emergency_shutdown; pub mod module_evm; pub mod module_evm_accounts; -pub mod module_homa_lite; +pub mod module_homa; pub mod module_honzon; pub mod module_incentives; pub mod module_nft; diff --git a/runtime/acala/src/weights/module_homa.rs b/runtime/acala/src/weights/module_homa.rs new file mode 100644 index 0000000000..48e3b0eed1 --- /dev/null +++ b/runtime/acala/src/weights/module_homa.rs @@ -0,0 +1,102 @@ +// This file is part of Acala. + +// Copyright (C) 2020-2022 Acala Foundation. +// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +//! Autogenerated weights for module_homa +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-12-20, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("acala-latest"), DB CACHE: 128 + +// Executed Command: +// target/release/acala +// benchmark +// --chain=acala-latest +// --steps=50 +// --repeat=20 +// --pallet=module_homa +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --template=./templates/runtime-weight-template.hbs +// --output=./runtime/acala/src/weights/ + +#![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 module_homa. +pub struct WeightInfo(PhantomData); +impl module_homa::WeightInfo for WeightInfo { + fn on_initialize() -> Weight { + (5_884_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + } + fn on_initialize_with_bump_era() -> Weight { + (490_360_000 as Weight) + .saturating_add(T::DbWeight::get().reads(32 as Weight)) + .saturating_add(T::DbWeight::get().writes(16 as Weight)) + } + fn mint() -> Weight { + (150_048_000 as Weight) + .saturating_add(T::DbWeight::get().reads(11 as Weight)) + .saturating_add(T::DbWeight::get().writes(7 as Weight)) + } + fn request_redeem() -> Weight { + (84_397_000 as Weight) + .saturating_add(T::DbWeight::get().reads(5 as Weight)) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + fn fast_match_redeems(n: u32, ) -> Weight { + (593_000 as Weight) + // Standard Error: 217_000 + .saturating_add((114_002_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads(8 as Weight)) + .saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes(5 as Weight)) + .saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(n as Weight))) + } + fn claim_redemption() -> Weight { + (132_187_000 as Weight) + .saturating_add(T::DbWeight::get().reads(10 as Weight)) + .saturating_add(T::DbWeight::get().writes(7 as Weight)) + } + fn update_homa_params() -> Weight { + (63_205_000 as Weight) + .saturating_add(T::DbWeight::get().writes(4 as Weight)) + } + fn update_bump_era_params() -> Weight { + (26_983_000 as Weight) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn reset_ledgers(n: u32, ) -> Weight { + (22_598_000 as Weight) + // Standard Error: 604_000 + .saturating_add((18_501_000 as Weight).saturating_mul(n as Weight)) + .saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(n as Weight))) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(n as Weight))) + } + fn reset_current_era() -> Weight { + (21_189_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(1 as Weight)) + } +} diff --git a/runtime/acala/src/weights/module_homa_lite.rs b/runtime/acala/src/weights/module_homa_lite.rs deleted file mode 100644 index 5eb88203d0..0000000000 --- a/runtime/acala/src/weights/module_homa_lite.rs +++ /dev/null @@ -1,120 +0,0 @@ -// This file is part of Acala. - -// Copyright (C) 2020-2022 Acala Foundation. -// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 - -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -//! Autogenerated weights for module_homa_lite -//! -//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev -//! DATE: 2021-11-24, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` -//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("acala-dev"), DB CACHE: 128 - -// Executed Command: -// target/release/acala -// benchmark -// --chain=acala-dev -// --steps=50 -// --repeat=20 -// --pallet=module-homa-lite -// --extrinsic=* -// --execution=wasm -// --wasm-execution=compiled -// --heap-pages=4096 -// --template=./templates/runtime-weight-template.hbs -// --output=./runtime/acala/src/weights/ - - -#![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 module_homa_lite. -pub struct WeightInfo(PhantomData); -impl module_homa_lite::WeightInfo for WeightInfo { - fn on_initialize() -> Weight { - (13_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn on_initialize_without_work() -> Weight { - (2_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - } - fn mint() -> Weight { - (129_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(19 as Weight)) - .saturating_add(T::DbWeight::get().writes(9 as Weight)) - } - fn mint_for_requests() -> Weight { - (330_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(35 as Weight)) - .saturating_add(T::DbWeight::get().writes(23 as Weight)) - } - fn set_total_staking_currency() -> Weight { - (11_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn adjust_total_staking_currency() -> Weight { - (11_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn adjust_available_staking_balance_with_no_matches() -> Weight { - (18_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(2 as Weight)) - } - fn set_minting_cap() -> Weight { - (10_000_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_xcm_dest_weight() -> Weight { - (9_000_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn request_redeem() -> Weight { - (32_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(4 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } - fn schedule_unbond() -> Weight { - (11_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(1 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn replace_schedule_unbond() -> Weight { - (10_000_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn set_staking_interest_rate_per_update() -> Weight { - (10_000_000 as Weight) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn redeem_with_available_staking_balance() -> Weight { - (5_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(2 as Weight)) - .saturating_add(T::DbWeight::get().writes(1 as Weight)) - } - fn xcm_unbond() -> Weight { - (30_000_000 as Weight) - .saturating_add(T::DbWeight::get().reads(8 as Weight)) - .saturating_add(T::DbWeight::get().writes(3 as Weight)) - } -} diff --git a/runtime/integration-tests/src/homa_xcm.rs b/runtime/integration-tests/src/homa_xcm.rs index dc5ac96acb..2e91e01045 100644 --- a/runtime/integration-tests/src/homa_xcm.rs +++ b/runtime/integration-tests/src/homa_xcm.rs @@ -416,6 +416,8 @@ fn homa_mint_and_redeem_works() { let homa_lite_sub_account: AccountId = hex_literal::hex!["d7b8926b326dd349355a9a7cca6606c1e0eb6fd2b506066b518c7155ff0d8297"].into(); let mut parachain_account: AccountId = AccountId::default(); + let bonding_duration = BondingDuration::get(); + Karura::execute_with(|| { parachain_account = ParachainAccount::get(); }); @@ -552,7 +554,7 @@ fn homa_mint_and_redeem_works() { // Unbonds the tokens on the Relay chain. assert_ok!(Homa::bump_current_era(1)); - let unbonding_era = Homa::relay_chain_current_era() + KusamaBondingDuration::get(); + let unbonding_era = Homa::relay_chain_current_era() + bonding_duration; assert_eq!(unbonding_era, 30); assert_eq!(Homa::unbondings(&alice(), unbonding_era), 999_995_000_000_000); @@ -594,7 +596,7 @@ fn homa_mint_and_redeem_works() { )); // Wait for the chunk to unlock - for _ in 0..KusamaBondingDuration::get() + 1 { + for _ in 0..bonding_duration + 1 { assert_ok!(Homa::bump_current_era(1)); } diff --git a/runtime/integration-tests/src/lib.rs b/runtime/integration-tests/src/lib.rs index a9d276d893..0c56f0b891 100644 --- a/runtime/integration-tests/src/lib.rs +++ b/runtime/integration-tests/src/lib.rs @@ -43,9 +43,6 @@ mod dex; ))] mod evm; -#[cfg(feature = "with-acala-runtime")] -mod homa_lite; - #[cfg(feature = "with-karura-runtime")] mod homa_xcm; diff --git a/runtime/integration-tests/src/prices.rs b/runtime/integration-tests/src/prices.rs index 54de0db301..4895dc6b3a 100644 --- a/runtime/integration-tests/src/prices.rs +++ b/runtime/integration-tests/src/prices.rs @@ -90,32 +90,20 @@ fn test_update_liquid_currency_price() { set_oracle_price(vec![(RELAY_CHAIN_CURRENCY, relaychain_price)]); - #[cfg(any(feature = "with-mandala-runtime", feature = "with-karura-runtime"))] assert_ok!(Homa::reset_ledgers( Origin::root(), vec![(0, Some(100 * dollar(RELAY_CHAIN_CURRENCY)), None)] )); - #[cfg(feature = "with-acala-runtime")] - assert_ok!(HomaLite::set_total_staking_currency( - Origin::root(), - 100 * dollar(RELAY_CHAIN_CURRENCY) - )); assert_eq!( RealTimePriceProvider::::get_relative_price(LIQUID_CURRENCY, RELAY_CHAIN_CURRENCY), Some(Ratio::saturating_from_rational(100, 1000)) ); - #[cfg(any(feature = "with-mandala-runtime", feature = "with-karura-runtime"))] assert_ok!(Homa::reset_ledgers( Origin::root(), vec![(0, Some(110 * dollar(RELAY_CHAIN_CURRENCY)), None)] )); - #[cfg(feature = "with-acala-runtime")] - assert_ok!(HomaLite::set_total_staking_currency( - Origin::root(), - 110 * dollar(RELAY_CHAIN_CURRENCY) - )); assert_eq!( RealTimePriceProvider::::get_relative_price(LIQUID_CURRENCY, RELAY_CHAIN_CURRENCY), diff --git a/runtime/integration-tests/src/runtime.rs b/runtime/integration-tests/src/runtime.rs index b4e36aa97f..c255749fd5 100644 --- a/runtime/integration-tests/src/runtime.rs +++ b/runtime/integration-tests/src/runtime.rs @@ -218,12 +218,6 @@ fn parachain_subaccounts_are_unique() { hex_literal::hex!["70617261d0070000000000000000000000000000000000000000000000000000"].into() ); - #[cfg(feature = "with-acala-runtime")] - assert_eq!( - RelayChainSovereignSubAccount::get(), - create_x2_parachain_multilocation(0) - ); - assert_eq!( create_x2_parachain_multilocation(0), MultiLocation::new( diff --git a/runtime/integration-tests/src/setup.rs b/runtime/integration-tests/src/setup.rs index 347bc30d8e..e948a28649 100644 --- a/runtime/integration-tests/src/setup.rs +++ b/runtime/integration-tests/src/setup.rs @@ -75,11 +75,11 @@ mod karura_imports { pub use frame_support::{parameter_types, weights::Weight}; pub use karura_runtime::{ constants::parachains, create_x2_parachain_multilocation, get_all_module_accounts, AcalaOracle, AccountId, - AssetRegistry, AuctionManager, Authority, AuthoritysOriginId, Balance, Balances, BlockNumber, Call, CdpEngine, - CdpTreasury, CreateClassDeposit, CreateTokenDeposit, Currencies, CurrencyId, CurrencyIdConvert, - DataDepositPerByte, DefaultExchangeRate, Dex, EmergencyShutdown, Event, EvmAccounts, ExistentialDeposits, - FinancialCouncil, Get, GetNativeCurrencyId, Homa, HomaXcm, Honzon, IdleScheduler, KarPerSecond, - KaruraFoundationAccounts, KsmPerSecond, KusamaBondingDuration, KusdPerSecond, Loans, MaxTipsOfPriority, + AssetRegistry, AuctionManager, Authority, AuthoritysOriginId, Balance, Balances, BlockNumber, BondingDuration, + Call, CdpEngine, CdpTreasury, CreateClassDeposit, CreateTokenDeposit, Currencies, CurrencyId, + CurrencyIdConvert, DataDepositPerByte, DefaultExchangeRate, Dex, EmergencyShutdown, Event, EvmAccounts, + ExistentialDeposits, FinancialCouncil, Get, GetNativeCurrencyId, Homa, HomaXcm, Honzon, IdleScheduler, + KarPerSecond, KaruraFoundationAccounts, KsmPerSecond, KusdPerSecond, Loans, MaxTipsOfPriority, MinimumDebitValue, MultiLocation, NativeTokenExistentialDeposit, NetworkId, NftPalletId, OneDay, Origin, OriginCaller, ParachainAccount, ParachainInfo, ParachainSystem, PolkadotXcm, Proxy, ProxyType, Ratio, RelayChainBlockNumberProvider, Runtime, Scheduler, Session, SessionManager, SevenDays, System, Timestamp, @@ -131,15 +131,15 @@ pub use acala_imports::*; mod acala_imports { pub use acala_runtime::{ create_x2_parachain_multilocation, get_all_module_accounts, AcalaFoundationAccounts, AcalaOracle, AccountId, - AssetRegistry, AuctionManager, Authority, AuthoritysOriginId, Balance, Balances, BlockNumber, Call, CdpEngine, - CdpTreasury, CreateClassDeposit, CreateTokenDeposit, Currencies, CurrencyId, CurrencyIdConvert, - DataDepositPerByte, DefaultExchangeRate, Dex, EmergencyShutdown, Event, EvmAccounts, ExistentialDeposits, - FinancialCouncil, Get, GetNativeCurrencyId, HomaLite, Honzon, IdleScheduler, Loans, MaxTipsOfPriority, - MinimumDebitValue, MultiLocation, NativeTokenExistentialDeposit, NetworkId, NftPalletId, OneDay, Origin, - OriginCaller, ParachainAccount, ParachainInfo, ParachainSystem, PolkadotXcm, Proxy, ProxyType, - RelayChainBlockNumberProvider, RelayChainSovereignSubAccount, Runtime, Scheduler, Session, SessionManager, - SevenDays, System, Timestamp, TipPerWeightStep, TokenSymbol, Tokens, TreasuryPalletId, Utility, Vesting, - XTokens, XcmConfig, XcmExecutor, XcmUnbondFee, EVM, NFT, + AssetRegistry, AuctionManager, Authority, AuthoritysOriginId, Balance, Balances, BlockNumber, BondingDuration, + Call, CdpEngine, CdpTreasury, CreateClassDeposit, CreateTokenDeposit, Currencies, CurrencyId, + CurrencyIdConvert, DataDepositPerByte, DefaultExchangeRate, Dex, EmergencyShutdown, Event, EvmAccounts, + ExistentialDeposits, FinancialCouncil, Get, GetNativeCurrencyId, Homa, HomaXcm, Honzon, IdleScheduler, Loans, + MaxTipsOfPriority, MinimumDebitValue, MultiLocation, NativeTokenExistentialDeposit, NetworkId, NftPalletId, + OneDay, Origin, OriginCaller, ParachainAccount, ParachainInfo, ParachainSystem, PolkadotXcm, Proxy, ProxyType, + RelayChainBlockNumberProvider, Runtime, Scheduler, Session, SessionManager, SevenDays, System, Timestamp, + TipPerWeightStep, TokenSymbol, Tokens, TreasuryPalletId, Utility, Vesting, XTokens, XcmConfig, XcmExecutor, + EVM, NFT, }; pub use frame_support::parameter_types; pub use primitives::TradingPair; diff --git a/runtime/karura/src/lib.rs b/runtime/karura/src/lib.rs index 2a48949a5d..fd866a4037 100644 --- a/runtime/karura/src/lib.rs +++ b/runtime/karura/src/lib.rs @@ -1633,7 +1633,7 @@ parameter_types! { pub DefaultExchangeRate: ExchangeRate = ExchangeRate::saturating_from_rational(1, 10); pub HomaTreasuryAccount: AccountId = HomaTreasuryPalletId::get().into_account(); pub ActiveSubAccountsIndexList: Vec = vec![RelayChainSubAccountId::HomaLite as u16]; - pub KusamaBondingDuration: EraIndex = 28; + pub BondingDuration: EraIndex = 28; pub MintThreshold: Balance = dollar(KSM); pub RedeemThreshold: Balance = 10 * dollar(LKSM); } @@ -1648,7 +1648,7 @@ impl module_homa::Config for Runtime { type TreasuryAccount = HomaTreasuryAccount; type DefaultExchangeRate = DefaultExchangeRate; type ActiveSubAccountsIndexList = ActiveSubAccountsIndexList; - type BondingDuration = KusamaBondingDuration; + type BondingDuration = BondingDuration; type MintThreshold = MintThreshold; type RedeemThreshold = RedeemThreshold; type RelayChainBlockNumber = RelayChainBlockNumberProvider;