From b93aaeff9e7c29f232c7c4591c8ce9d210c38f9b Mon Sep 17 00:00:00 2001 From: Roznovjak Date: Wed, 18 Dec 2024 13:22:47 +0100 Subject: [PATCH] fix tests build --- integration-tests/src/kusama_test_net.rs | 24 ++++++++++-- .../xyk-liquidity-mining/src/tests/mock.rs | 38 ++++++++++++------- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/integration-tests/src/kusama_test_net.rs b/integration-tests/src/kusama_test_net.rs index 117beebb05..faf3d0d2c9 100644 --- a/integration-tests/src/kusama_test_net.rs +++ b/integration-tests/src/kusama_test_net.rs @@ -48,7 +48,7 @@ use frame_support::assert_ok; use frame_support::traits::OnInitialize; use pallet_transaction_multi_payment::Price; pub use pallet_xyk::types::AssetPair; -use polkadot_primitives::v7::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE}; +use polkadot_primitives::v8::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE}; use polkadot_runtime_parachains::configuration::HostConfiguration; use pretty_assertions::assert_eq; use primitives::{constants::time::SLOT_DURATION, AssetId, Balance}; @@ -167,13 +167,12 @@ pub mod rococo { } use polkadot_primitives::{AssignmentId, ValidatorId}; - use polkadot_service::chain_spec::get_authority_keys_from_seed_no_beefy; + use polkadot_service::chain_spec::get_account_id_from_seed; use sc_consensus_grandpa::AuthorityId as GrandpaId; use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId; use sp_consensus_babe::AuthorityId as BabeId; use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId; - - use sp_core::{Pair, Public}; + use sp_core::{Pair, Public, sr25519}; /// Helper function to generate a crypto pair from seed fn get_from_seed(seed: &str) -> ::Public { @@ -200,6 +199,20 @@ pub mod rococo { } } + pub fn get_authority_keys_from_seed_no_beefy( + seed: &str, + ) -> (AccountId, AccountId, BabeId, GrandpaId, ValidatorId, AssignmentId, AuthorityDiscoveryId) { + ( + get_account_id_from_seed::(&format!("{}//stash", seed)), + get_account_id_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + get_from_seed::(seed), + ) + } + pub fn initial_authorities() -> Vec<( AccountId, AccountId, @@ -250,6 +263,7 @@ pub mod rococo { ) }) .collect::>(), + non_authority_keys: Default::default(), }, babe: rococo_runtime::BabeConfig { authorities: Default::default(), @@ -373,6 +387,7 @@ pub mod basilisk { ) }) .collect(), + non_authority_keys: Default::default(), }, asset_registry: basilisk_runtime::AssetRegistryConfig { registered_assets: vec![ @@ -460,6 +475,7 @@ pub mod other_parachain { ) }) .collect(), + non_authority_keys: Default::default(), }, asset_registry: basilisk_runtime::AssetRegistryConfig { registered_assets: vec![(b"AUSD".to_vec(), 1_000_000u128, Some(AUSD))], diff --git a/pallets/xyk-liquidity-mining/src/tests/mock.rs b/pallets/xyk-liquidity-mining/src/tests/mock.rs index ae64ea12bd..7718b67da4 100644 --- a/pallets/xyk-liquidity-mining/src/tests/mock.rs +++ b/pallets/xyk-liquidity-mining/src/tests/mock.rs @@ -242,6 +242,7 @@ impl AMM for DummyAMM { fn execute_buy( _transfer: &hydradx_traits::AMMTransfer, + _destination: Option<&AccountId>, ) -> frame_support::dispatch::DispatchResult { Err(sp_runtime::DispatchError::Other("NotImplemented")) } @@ -508,6 +509,20 @@ impl hydradx_traits::liquidity_mining::Mutate f Ok((farm_id, max_reward_per_period)) } + fn create_global_farm_without_price_adjustment( + _total_rewards: Self::Balance, + _planned_yielding_periods: Self::Period, + _blocks_per_period: BlockNumber, + _incentivized_asset: AssetId, + _reward_currency: AssetId, + _owner: AccountId, + _yield_per_period: Perquintill, + _min_deposit: Self::Balance, + ) -> Result<(YieldFarmId, Self::Balance), Self::Error> { + //NOTE: Basilisk is not using this fn. + Err(sp_runtime::DispatchError::Other("Not implemented")) + } + fn update_global_farm_price_adjustment( _who: AccountId, global_farm_id: u32, @@ -524,6 +539,15 @@ impl hydradx_traits::liquidity_mining::Mutate f }) } + fn update_global_farm( + _global_farm_id: GlobalFarmId, + _planned_yielding_periods: Self::Period, + _yield_per_period: Perquintill, + _min_deposit: Self::Balance + ) -> Result<(), Self::Error> { + Err(sp_runtime::DispatchError::Other("Not implemented")) + } + fn terminate_global_farm( who: AccountId, global_farm_id: u32, @@ -761,20 +785,6 @@ impl hydradx_traits::liquidity_mining::Mutate f fn get_global_farm_id(deposit_id: u128, yield_farm_id: u32) -> Option { DEPOSIT_ENTRIES.with(|v| v.borrow().get(&(deposit_id, yield_farm_id)).map(|d| d.global_farm_id)) } - - fn create_global_farm_without_price_adjustment( - _total_rewards: Self::Balance, - _planned_yielding_periods: Self::Period, - _blocks_per_period: BlockNumber, - _incentivized_asset: AssetId, - _reward_currency: AssetId, - _owner: AccountId, - _yield_per_period: Perquintill, - _min_deposit: Self::Balance, - ) -> Result<(YieldFarmId, Self::Balance), Self::Error> { - //NOTE: Basilisk is not using this fn. - Err(sp_runtime::DispatchError::Other("Not implemented")) - } } //NOTE: this is and should not be used anywhere. This exists only to make trait bellow happy. Trait