diff --git a/parachain/runtime/interlay/src/lib.rs b/parachain/runtime/interlay/src/lib.rs index 4b2c379474..76aa6ed8a2 100644 --- a/parachain/runtime/interlay/src/lib.rs +++ b/parachain/runtime/interlay/src/lib.rs @@ -94,7 +94,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("interlay-parachain"), impl_name: create_runtime_str!("interlay-parachain"), authoring_version: 1, - spec_version: 1023000, + spec_version: 1023001, impl_version: 1, transaction_version: 2, // added preimage apis: RUNTIME_API_VERSIONS, @@ -1257,10 +1257,6 @@ pub type Executive = frame_executive::Executive< Runtime, AllPalletsWithSystem, ( - // "Bound uses of call" - pallet_preimage::migration::v1::Migration, - pallet_scheduler::migration::v3::MigrateToV4, - pallet_multisig::migrations::v1::MigrateToV1, reward::migration::v1::MigrateToV1, vault_registry::migration::vault_capacity::RewardsMigration< Runtime, diff --git a/parachain/runtime/kintsugi/src/dex.rs b/parachain/runtime/kintsugi/src/dex.rs index ac37e9262b..13dbac2c54 100644 --- a/parachain/runtime/kintsugi/src/dex.rs +++ b/parachain/runtime/kintsugi/src/dex.rs @@ -1,13 +1,8 @@ use super::{ - parameter_types, Balance, CurrencyId, DexGeneral, DexStable, DispatchResult, Farming, Get, Loans, OnRuntimeUpgrade, - PalletId, Rate, Ratio, Runtime, RuntimeEvent, RuntimeOrigin, StablePoolId, Timestamp, Tokens, Vec, Weight, KBTC, - KINT, KSM, + parameter_types, Balance, CurrencyId, DexGeneral, DexStable, Get, PalletId, Runtime, RuntimeEvent, StablePoolId, + Timestamp, Tokens, }; use sp_core::ConstU16; -use sp_runtime::{traits::Zero, FixedPointNumber}; - -#[cfg(feature = "try-runtime")] -use frame_support::ensure; pub use dex_general::{AssetBalance, GenerateLpAssetId, PairInfo}; pub use dex_stable::traits::{StablePoolLpCurrencyIdGenerate, ValidateCurrency}; @@ -78,171 +73,3 @@ impl dex_swap_router::Config for Runtime { type MaxSwaps = ConstU16<4>; type WeightInfo = (); } - -pub struct DexSetup; - -fn create_pair_and_update_rewards(asset_0: CurrencyId, asset_1: CurrencyId, rewards: Balance, fee_rate: Balance) { - if let Err(err) = DexGeneral::create_pair(RuntimeOrigin::root(), asset_0, asset_1, fee_rate) { - log::error!("Could not create pair: {:?}", err); - } else { - if let Err(err) = Farming::update_reward_schedule( - RuntimeOrigin::root(), - CurrencyId::join_lp_token(asset_0, asset_1).expect("currencies are valid; qed"), - CurrencyId::Token(KINT), - // period is 5 (blocks per minute) - // so period count for three months - // is 60 minutes * 24 hours * 92 days - 132480, - rewards, - ) { - log::error!("Could not update rewards: {:?}", err); - } - } -} - -impl OnRuntimeUpgrade for DexSetup { - fn on_runtime_upgrade() -> Weight { - create_pair_and_update_rewards( - CurrencyId::Token(KBTC), - CurrencyId::Token(KSM), - 45000000000000000, // 45,000 KINT - 15, // 0.15% - ); - - create_pair_and_update_rewards( - CurrencyId::Token(KBTC), - CurrencyId::ForeignAsset(3), // USDT - 40000000000000000, // 40,000 KINT - 15, // 0.15% - ); - - create_pair_and_update_rewards( - CurrencyId::Token(KSM), - CurrencyId::Token(KINT), - 35000000000000000, // 35,000 KINT - 25, // 0.25% - ); - - Default::default() - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - ensure!( - dex_general::PairStatuses::::iter().collect::>().len() == 0, - "Should not have pools" - ); - Ok(Vec::new()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: Vec) -> Result<(), &'static str> { - ensure!( - dex_general::PairStatuses::::iter().collect::>().len() == 3, - "Should have pools" - ); - Ok(()) - } -} - -pub struct LoansSetup; - -fn add_and_activate_market(token: CurrencyId, market: loans::Market) { - if let Err(err) = Loans::add_market(RuntimeOrigin::root(), token, market) { - log::error!("Could not add market: {:?}", err); - } else { - if let Err(err) = Loans::activate_market(RuntimeOrigin::root(), token) { - log::error!("Could not activate market: {:?}", err); - } - } -} - -impl OnRuntimeUpgrade for LoansSetup { - fn on_runtime_upgrade() -> Weight { - add_and_activate_market( - CurrencyId::Token(KBTC), - loans::Market { - close_factor: Ratio::from_percent(50), - collateral_factor: Ratio::from_percent(63), - liquidation_threshold: Ratio::from_percent(67), - liquidate_incentive: Rate::from_inner(Rate::DIV / 100 * 110), - liquidate_incentive_reserved_factor: Ratio::zero(), - state: loans::MarketState::Pending, - rate_model: loans::InterestRateModel::Jump(loans::JumpModel { - base_rate: Rate::zero(), - jump_rate: Rate::from_inner(Rate::DIV / 100 * 5), - full_rate: Rate::from_inner(Rate::DIV / 100 * 50), - jump_utilization: Ratio::from_percent(90), - }), - reserve_factor: Ratio::from_percent(20), - supply_cap: 2000000000, // 20 KBTC - borrow_cap: 2000000000, // 20 KBTC - lend_token_id: CurrencyId::LendToken(1), - }, - ); - - add_and_activate_market( - CurrencyId::Token(KSM), - loans::Market { - close_factor: Ratio::from_percent(50), - collateral_factor: Ratio::from_percent(54), - liquidation_threshold: Ratio::from_percent(61), - liquidate_incentive: Rate::from_inner(Rate::DIV / 100 * 110), - liquidate_incentive_reserved_factor: Ratio::zero(), - state: loans::MarketState::Pending, - rate_model: loans::InterestRateModel::Jump(loans::JumpModel { - base_rate: Rate::zero(), - jump_rate: Rate::from_inner(Rate::DIV / 100 * 15), - full_rate: Rate::from_inner(Rate::DIV / 100 * 40), - jump_utilization: Ratio::from_percent(90), - }), - reserve_factor: Ratio::from_percent(20), - supply_cap: 30000000000000000, // 30,000 KSM - borrow_cap: 30000000000000000, // 30,000 KSM - lend_token_id: CurrencyId::LendToken(2), - }, - ); - - add_and_activate_market( - CurrencyId::ForeignAsset(3), // USDT - loans::Market { - close_factor: Ratio::from_percent(50), - collateral_factor: Ratio::from_percent(65), - liquidation_threshold: Ratio::from_percent(69), - liquidate_incentive: Rate::from_inner(Rate::DIV / 100 * 110), - liquidate_incentive_reserved_factor: Ratio::zero(), - state: loans::MarketState::Pending, - rate_model: loans::InterestRateModel::Jump(loans::JumpModel { - base_rate: Rate::zero(), - jump_rate: Rate::from_inner(Rate::DIV / 100 * 15), - full_rate: Rate::from_inner(Rate::DIV / 100 * 40), - jump_utilization: Ratio::from_percent(90), - }), - reserve_factor: Ratio::from_percent(20), - supply_cap: 800000000000, // 800,000 USDT - borrow_cap: 800000000000, // 800,000 USDT - lend_token_id: CurrencyId::LendToken(3), - }, - ); - - Default::default() - } - - #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, &'static str> { - ensure!( - loans::Markets::::iter().collect::>().len() == 0, - "Should not have markets" - ); - Ok(Vec::new()) - } - - #[cfg(feature = "try-runtime")] - fn post_upgrade(_state: Vec) -> Result<(), &'static str> { - ensure!( - loans::Markets::::iter().collect::>().len() == 3, - "Should have markets" - ); - Ok(()) - } -} diff --git a/parachain/runtime/kintsugi/src/lib.rs b/parachain/runtime/kintsugi/src/lib.rs index 863b8fffd8..edb3e26fb6 100644 --- a/parachain/runtime/kintsugi/src/lib.rs +++ b/parachain/runtime/kintsugi/src/lib.rs @@ -96,7 +96,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("kintsugi-parachain"), impl_name: create_runtime_str!("kintsugi-parachain"), authoring_version: 1, - spec_version: 1023000, + spec_version: 1023001, impl_version: 1, transaction_version: 3, // added preimage apis: RUNTIME_API_VERSIONS, @@ -1308,14 +1308,8 @@ pub type UncheckedExtrinsic = generic::UncheckedExtrinsic; /// Executive: handles dispatch to the various modules. -pub type Executive = frame_executive::Executive< - Runtime, - Block, - frame_system::ChainContext, - Runtime, - AllPalletsWithSystem, - (dex::DexSetup, dex::LoansSetup), ->; +pub type Executive = + frame_executive::Executive, Runtime, AllPalletsWithSystem>; #[cfg(not(feature = "disable-runtime-api"))] impl_runtime_apis! { diff --git a/parachain/runtime/testnet-interlay/src/lib.rs b/parachain/runtime/testnet-interlay/src/lib.rs index 5398c063fe..0609c41c5a 100644 --- a/parachain/runtime/testnet-interlay/src/lib.rs +++ b/parachain/runtime/testnet-interlay/src/lib.rs @@ -97,7 +97,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("testnet-interlay"), impl_name: create_runtime_str!("testnet-interlay"), authoring_version: 1, - spec_version: 1023000, + spec_version: 1023001, impl_version: 1, transaction_version: 1, // added preimage apis: RUNTIME_API_VERSIONS, diff --git a/parachain/runtime/testnet-kintsugi/src/lib.rs b/parachain/runtime/testnet-kintsugi/src/lib.rs index 2309383eb1..0f0cd959a4 100644 --- a/parachain/runtime/testnet-kintsugi/src/lib.rs +++ b/parachain/runtime/testnet-kintsugi/src/lib.rs @@ -97,7 +97,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { spec_name: create_runtime_str!("testnet-kintsugi"), impl_name: create_runtime_str!("testnet-kintsugi"), authoring_version: 1, - spec_version: 1023000, + spec_version: 1023001, impl_version: 1, transaction_version: 1, // added preimage apis: RUNTIME_API_VERSIONS,