From b69cb1343d8bdcc76718e4bcf25af63cad766d6f Mon Sep 17 00:00:00 2001 From: open-junius Date: Thu, 22 Jan 2026 19:25:11 +0800 Subject: [PATCH 1/7] lower precompile log level --- precompiles/src/extensions.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/precompiles/src/extensions.rs b/precompiles/src/extensions.rs index df5ebf3fa2..928b781358 100644 --- a/precompiles/src/extensions.rs +++ b/precompiles/src/extensions.rs @@ -131,8 +131,7 @@ pub(crate) trait PrecompileHandleExt: PrecompileHandle { ::RuntimeCall, >>::post_dispatch((), &info, &mut post_info, 0, &result) .map_err(extension_error)?; - log::error!("Dispatch failed. Error: {e:?}"); - log::warn!("Returning error PrecompileFailure::Error"); + log::info!("Precompile dispatch failed. Error: {e:?}"); self.charge_and_refund_after_dispatch::(&info, &post_info)?; Err(PrecompileFailure::Error { From 9b04c36de6344c3488588afd67b29b4a310f4d0c Mon Sep 17 00:00:00 2001 From: open-junius Date: Thu, 22 Jan 2026 19:28:14 +0800 Subject: [PATCH 2/7] lower precompile log level --- precompiles/src/extensions.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/precompiles/src/extensions.rs b/precompiles/src/extensions.rs index 928b781358..5d73a75f9b 100644 --- a/precompiles/src/extensions.rs +++ b/precompiles/src/extensions.rs @@ -131,7 +131,7 @@ pub(crate) trait PrecompileHandleExt: PrecompileHandle { ::RuntimeCall, >>::post_dispatch((), &info, &mut post_info, 0, &result) .map_err(extension_error)?; - log::info!("Precompile dispatch failed. Error: {e:?}"); + log::info!("Precompile dispatch failed. message as: {e:?}"); self.charge_and_refund_after_dispatch::(&info, &post_info)?; Err(PrecompileFailure::Error { From 522b9601ecb2c39c74cef6e83bf888c45d15d345 Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 26 Jan 2026 11:31:30 -0500 Subject: [PATCH 3/7] Fix dissolving lp + spec bump --- pallets/swap/src/pallet/mod.rs | 3 ++- runtime/src/lib.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pallets/swap/src/pallet/mod.rs b/pallets/swap/src/pallet/mod.rs index 97a25ec242..ac20098f77 100644 --- a/pallets/swap/src/pallet/mod.rs +++ b/pallets/swap/src/pallet/mod.rs @@ -621,7 +621,8 @@ mod pallet { // Remove provided liquidity unconditionally because the network may have // user liquidity previously disabled - Self::do_dissolve_all_liquidity_providers(netuid)?; + // Ignore result to avoid early stopping + let _ = Self::do_dissolve_all_liquidity_providers(netuid); } Ok(()) diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 225c2e2706..000c0018b3 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -241,7 +241,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 371, + spec_version: 372, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, From c5f83db76b19b72ae07cc7e98b14681223b5a16f Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 26 Jan 2026 11:34:48 -0500 Subject: [PATCH 4/7] Disable add_liquidity --- pallets/swap/src/pallet/mod.rs | 95 ++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/pallets/swap/src/pallet/mod.rs b/pallets/swap/src/pallet/mod.rs index ac20098f77..db4f75c785 100644 --- a/pallets/swap/src/pallet/mod.rs +++ b/pallets/swap/src/pallet/mod.rs @@ -379,52 +379,55 @@ mod pallet { ) -> DispatchResult { let coldkey = ensure_signed(origin)?; - // Ensure that the subnet exists. - ensure!( - T::SubnetInfo::exists(netuid.into()), - Error::::MechanismDoesNotExist - ); - - ensure!( - T::SubnetInfo::is_subtoken_enabled(netuid.into()), - Error::::SubtokenDisabled - ); - - let (position_id, tao, alpha) = Self::do_add_liquidity( - netuid.into(), - &coldkey, - &hotkey, - tick_low, - tick_high, - liquidity, - )?; - let alpha = AlphaCurrency::from(alpha); - let tao = TaoCurrency::from(tao); - - // Remove TAO and Alpha balances or fail transaction if they can't be removed exactly - let tao_provided = T::BalanceOps::decrease_balance(&coldkey, tao)?; - ensure!(tao_provided == tao, Error::::InsufficientBalance); - - let alpha_provided = - T::BalanceOps::decrease_stake(&coldkey, &hotkey, netuid.into(), alpha)?; - ensure!(alpha_provided == alpha, Error::::InsufficientBalance); - - // Add provided liquidity to user-provided reserves - T::TaoReserve::increase_provided(netuid.into(), tao_provided); - T::AlphaReserve::increase_provided(netuid.into(), alpha_provided); - - // Emit an event - Self::deposit_event(Event::LiquidityAdded { - coldkey, - hotkey, - netuid, - position_id, - liquidity, - tao, - alpha, - tick_low, - tick_high, - }); + // Extrinsic should have no effect. This fix may have to be reverted later, + // so leaving the code in for now. + + // // Ensure that the subnet exists. + // ensure!( + // T::SubnetInfo::exists(netuid.into()), + // Error::::MechanismDoesNotExist + // ); + + // ensure!( + // T::SubnetInfo::is_subtoken_enabled(netuid.into()), + // Error::::SubtokenDisabled + // ); + + // let (position_id, tao, alpha) = Self::do_add_liquidity( + // netuid.into(), + // &coldkey, + // &hotkey, + // tick_low, + // tick_high, + // liquidity, + // )?; + // let alpha = AlphaCurrency::from(alpha); + // let tao = TaoCurrency::from(tao); + + // // Remove TAO and Alpha balances or fail transaction if they can't be removed exactly + // let tao_provided = T::BalanceOps::decrease_balance(&coldkey, tao)?; + // ensure!(tao_provided == tao, Error::::InsufficientBalance); + + // let alpha_provided = + // T::BalanceOps::decrease_stake(&coldkey, &hotkey, netuid.into(), alpha)?; + // ensure!(alpha_provided == alpha, Error::::InsufficientBalance); + + // // Add provided liquidity to user-provided reserves + // T::TaoReserve::increase_provided(netuid.into(), tao_provided); + // T::AlphaReserve::increase_provided(netuid.into(), alpha_provided); + + // // Emit an event + // Self::deposit_event(Event::LiquidityAdded { + // coldkey, + // hotkey, + // netuid, + // position_id, + // liquidity, + // tao, + // alpha, + // tick_low, + // tick_high, + // }); Ok(()) } From 32fde3ce309d277f6cb630d362b280d1fbf17eb2 Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 26 Jan 2026 12:06:49 -0500 Subject: [PATCH 5/7] Only root can set fee rate for swap --- pallets/swap/src/pallet/mod.rs | 8 +------- pallets/swap/src/pallet/tests.rs | 8 -------- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/pallets/swap/src/pallet/mod.rs b/pallets/swap/src/pallet/mod.rs index 97a25ec242..1a20925d34 100644 --- a/pallets/swap/src/pallet/mod.rs +++ b/pallets/swap/src/pallet/mod.rs @@ -299,13 +299,7 @@ mod pallet { #[pallet::call_index(0)] #[pallet::weight(::WeightInfo::set_fee_rate())] pub fn set_fee_rate(origin: OriginFor, netuid: NetUid, rate: u16) -> DispatchResult { - if ensure_root(origin.clone()).is_err() { - let account_id: T::AccountId = ensure_signed(origin)?; - ensure!( - T::SubnetInfo::is_owner(&account_id, netuid.into()), - DispatchError::BadOrigin - ); - } + ensure_root(origin)?; // Ensure that the subnet exists. ensure!( diff --git a/pallets/swap/src/pallet/tests.rs b/pallets/swap/src/pallet/tests.rs index 4013248abb..143a213639 100644 --- a/pallets/swap/src/pallet/tests.rs +++ b/pallets/swap/src/pallet/tests.rs @@ -97,14 +97,6 @@ mod dispatchables { // Check that fee rate was set correctly assert_eq!(FeeRate::::get(netuid), fee_rate); - let fee_rate = fee_rate * 2; - assert_ok!(Swap::set_fee_rate( - RuntimeOrigin::signed(1), - netuid, - fee_rate - )); - assert_eq!(FeeRate::::get(netuid), fee_rate); - // Verify fee rate validation - should fail if too high let too_high_fee = MaxFeeRate::get() + 1; assert_noop!( From efb6ef7e610f7529f38adb9e7f950a967598505f Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 26 Jan 2026 12:24:04 -0500 Subject: [PATCH 6/7] Fix clippy and tests --- pallets/subtensor/src/tests/networks.rs | 17 ++++--- pallets/swap/src/pallet/mod.rs | 12 ++--- pallets/swap/src/pallet/tests.rs | 67 +++++++++++++------------ 3 files changed, 49 insertions(+), 47 deletions(-) diff --git a/pallets/subtensor/src/tests/networks.rs b/pallets/subtensor/src/tests/networks.rs index 49114aa3fc..771444e8f8 100644 --- a/pallets/subtensor/src/tests/networks.rs +++ b/pallets/subtensor/src/tests/networks.rs @@ -2212,14 +2212,15 @@ fn massive_dissolve_refund_and_reregistration_flow_is_lossless_and_cleans_state( } // Ensure V3 still functional on new net: add a small position for the first cold using its hot1 - let who_cold = cold_lps[0]; - let [who_hot, _] = cold_to_hots[&who_cold]; - add_pos(net_new, who_hot, who_cold, 8, 123_456); - assert!( - pallet_subtensor_swap::Positions::::iter() - .any(|((n, owner, _pid), _)| n == net_new && owner == who_cold), - "new position not recorded on the re-registered net" - ); + // TODO: Revise when user liquidity is available + // let who_cold = cold_lps[0]; + // let [who_hot, _] = cold_to_hots[&who_cold]; + // add_pos(net_new, who_hot, who_cold, 8, 123_456); + // assert!( + // pallet_subtensor_swap::Positions::::iter() + // .any(|((n, owner, _pid), _)| n == net_new && owner == who_cold), + // "new position not recorded on the re-registered net" + // ); }); } diff --git a/pallets/swap/src/pallet/mod.rs b/pallets/swap/src/pallet/mod.rs index db4f75c785..eef10be738 100644 --- a/pallets/swap/src/pallet/mod.rs +++ b/pallets/swap/src/pallet/mod.rs @@ -371,13 +371,13 @@ mod pallet { #[pallet::weight(::WeightInfo::add_liquidity())] pub fn add_liquidity( origin: OriginFor, - hotkey: T::AccountId, - netuid: NetUid, - tick_low: TickIndex, - tick_high: TickIndex, - liquidity: u64, + _hotkey: T::AccountId, + _netuid: NetUid, + _tick_low: TickIndex, + _tick_high: TickIndex, + _liquidity: u64, ) -> DispatchResult { - let coldkey = ensure_signed(origin)?; + ensure_signed(origin)?; // Extrinsic should have no effect. This fix may have to be reverted later, // so leaving the code in for now. diff --git a/pallets/swap/src/pallet/tests.rs b/pallets/swap/src/pallet/tests.rs index 4013248abb..069dd447ff 100644 --- a/pallets/swap/src/pallet/tests.rs +++ b/pallets/swap/src/pallet/tests.rs @@ -1901,42 +1901,43 @@ fn test_less_price_movement() { } } -#[test] -fn test_swap_subtoken_disabled() { - new_test_ext().execute_with(|| { - let netuid = NetUid::from(SUBTOKEN_DISABLED_NETUID); // Use a netuid not used elsewhere - let price_low = 0.1; - let price_high = 0.2; - let tick_low = price_to_tick(price_low); - let tick_high = price_to_tick(price_high); - let liquidity = 1_000_000_u64; +// TODO: Revise when user liquidity is available +// #[test] +// fn test_swap_subtoken_disabled() { +// new_test_ext().execute_with(|| { +// let netuid = NetUid::from(SUBTOKEN_DISABLED_NETUID); // Use a netuid not used elsewhere +// let price_low = 0.1; +// let price_high = 0.2; +// let tick_low = price_to_tick(price_low); +// let tick_high = price_to_tick(price_high); +// let liquidity = 1_000_000_u64; - assert_ok!(Pallet::::maybe_initialize_v3(netuid)); +// assert_ok!(Pallet::::maybe_initialize_v3(netuid)); - assert_noop!( - Pallet::::add_liquidity( - RuntimeOrigin::signed(OK_COLDKEY_ACCOUNT_ID), - OK_HOTKEY_ACCOUNT_ID, - netuid, - tick_low, - tick_high, - liquidity, - ), - Error::::SubtokenDisabled - ); +// assert_noop!( +// Pallet::::add_liquidity( +// RuntimeOrigin::signed(OK_COLDKEY_ACCOUNT_ID), +// OK_HOTKEY_ACCOUNT_ID, +// netuid, +// tick_low, +// tick_high, +// liquidity, +// ), +// Error::::SubtokenDisabled +// ); - assert_noop!( - Pallet::::modify_position( - RuntimeOrigin::signed(OK_COLDKEY_ACCOUNT_ID), - OK_HOTKEY_ACCOUNT_ID, - netuid, - PositionId::from(0), - liquidity as i64, - ), - Error::::SubtokenDisabled - ); - }); -} +// assert_noop!( +// Pallet::::modify_position( +// RuntimeOrigin::signed(OK_COLDKEY_ACCOUNT_ID), +// OK_HOTKEY_ACCOUNT_ID, +// netuid, +// PositionId::from(0), +// liquidity as i64, +// ), +// Error::::SubtokenDisabled +// ); +// }); +// } #[test] fn test_liquidate_v3_removes_positions_ticks_and_state() { From 0ff74a0b182f58ae5ff8e42db219977d12d0edd3 Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Mon, 26 Jan 2026 12:39:58 -0500 Subject: [PATCH 7/7] Return error from add_liquidity instead of Ok --- pallets/subtensor/src/tests/networks.rs | 60 +++++++++--------- pallets/subtensor/src/tests/staking.rs | 82 ++++++++++++------------- pallets/swap/src/benchmarking.rs | 47 +++++++------- pallets/swap/src/pallet/mod.rs | 4 +- 4 files changed, 99 insertions(+), 94 deletions(-) diff --git a/pallets/subtensor/src/tests/networks.rs b/pallets/subtensor/src/tests/networks.rs index 771444e8f8..4605ac8bef 100644 --- a/pallets/subtensor/src/tests/networks.rs +++ b/pallets/subtensor/src/tests/networks.rs @@ -1812,24 +1812,25 @@ fn massive_dissolve_refund_and_reregistration_flow_is_lossless_and_cleans_state( ]; // Multiple bands/sizes → many positions per cold across nets, using mixed hotkeys. - let bands: [i32; 3] = [5, 13, 30]; - let liqs: [u64; 3] = [400_000, 700_000, 1_100_000]; + // let bands: [i32; 3] = [5, 13, 30]; + // let liqs: [u64; 3] = [400_000, 700_000, 1_100_000]; + // TODO: Revise when user liquidity is available // Helper: add a V3 position via a (hot, cold) pair. - let add_pos = |net: NetUid, hot: U256, cold: U256, band: i32, liq: u64| { - let ct = pallet_subtensor_swap::CurrentTick::::get(net); - let lo = ct.saturating_sub(band); - let hi = ct.saturating_add(band); - pallet_subtensor_swap::EnabledUserLiquidity::::insert(net, true); - assert_ok!(pallet_subtensor_swap::Pallet::::add_liquidity( - RuntimeOrigin::signed(cold), - hot, - net, - lo, - hi, - liq - )); - }; + // let add_pos = |net: NetUid, hot: U256, cold: U256, band: i32, liq: u64| { + // let ct = pallet_subtensor_swap::CurrentTick::::get(net); + // let lo = ct.saturating_sub(band); + // let hi = ct.saturating_add(band); + // pallet_subtensor_swap::EnabledUserLiquidity::::insert(net, true); + // assert_ok!(pallet_subtensor_swap::Pallet::::add_liquidity( + // RuntimeOrigin::signed(cold), + // hot, + // net, + // lo, + // hi, + // liq + // )); + // }; // ──────────────────────────────────────────────────────────────────── // 1) Create many subnets, enable V3, fix price at tick=0 (sqrt≈1) @@ -1954,19 +1955,20 @@ fn massive_dissolve_refund_and_reregistration_flow_is_lossless_and_cleans_state( // ──────────────────────────────────────────────────────────────────── // 4) Add many V3 positions per cold across nets, alternating hotkeys // ──────────────────────────────────────────────────────────────────── - for (ni, &net) in nets.iter().enumerate() { - let participants = lp_sets_per_net[ni]; - for (pi, &cold) in participants.iter().enumerate() { - let [hot1, hot2] = cold_to_hots[&cold]; - let hots = [hot1, hot2]; - for k in 0..3 { - let band = bands[(pi + k) % bands.len()]; - let liq = liqs[(ni + k) % liqs.len()]; - let hot = hots[k % hots.len()]; - add_pos(net, hot, cold, band, liq); - } - } - } + // TODO: Revise when user liquidity is available + // for (ni, &net) in nets.iter().enumerate() { + // let participants = lp_sets_per_net[ni]; + // for (pi, &cold) in participants.iter().enumerate() { + // let [hot1, hot2] = cold_to_hots[&cold]; + // let hots = [hot1, hot2]; + // for k in 0..3 { + // let band = bands[(pi + k) % bands.len()]; + // let liq = liqs[(ni + k) % liqs.len()]; + // let hot = hots[k % hots.len()]; + // add_pos(net, hot, cold, band, liq); + // } + // } + // } // Snapshot τ balances AFTER LP adds (to measure actual principal debit). let mut tao_after_adds: BTreeMap = BTreeMap::new(); diff --git a/pallets/subtensor/src/tests/staking.rs b/pallets/subtensor/src/tests/staking.rs index 4146786709..6c7e18b707 100644 --- a/pallets/subtensor/src/tests/staking.rs +++ b/pallets/subtensor/src/tests/staking.rs @@ -6,11 +6,9 @@ use frame_support::dispatch::{DispatchClass, DispatchInfo, GetDispatchInfo, Pays use frame_support::sp_runtime::DispatchError; use frame_support::{assert_err, assert_noop, assert_ok, traits::Currency}; use frame_system::RawOrigin; -use pallet_subtensor_swap::Call as SwapCall; use pallet_subtensor_swap::tick::TickIndex; use safe_math::FixedExt; use sp_core::{Get, H256, U256}; -use sp_runtime::traits::Dispatchable; use substrate_fixed::traits::FromFixed; use substrate_fixed::types::{I96F32, I110F18, U64F64, U96F32}; use subtensor_runtime_common::{ @@ -5337,44 +5335,45 @@ fn test_update_position_fees() { }); } -fn setup_positions(netuid: NetUid) { - for (coldkey, hotkey, low_price, high_price, liquidity) in [ - (2, 12, 0.1, 0.20, 1_000_000_000_000_u64), - (3, 13, 0.15, 0.25, 200_000_000_000_u64), - (4, 14, 0.25, 0.5, 3_000_000_000_000_u64), - (5, 15, 0.3, 0.6, 300_000_000_000_u64), - (6, 16, 0.4, 0.7, 8_000_000_000_000_u64), - (7, 17, 0.5, 0.8, 600_000_000_000_u64), - (8, 18, 0.6, 0.9, 700_000_000_000_u64), - (9, 19, 0.7, 1.0, 100_000_000_000_u64), - (10, 20, 0.8, 1.1, 300_000_000_000_u64), - ] { - SubtensorModule::create_account_if_non_existent(&U256::from(coldkey), &U256::from(hotkey)); - SubtensorModule::add_balance_to_coldkey_account( - &U256::from(coldkey), - 1_000_000_000_000_000, - ); - SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet( - &U256::from(hotkey), - &U256::from(coldkey), - netuid.into(), - 1_000_000_000_000_000.into(), - ); - - let tick_low = price_to_tick(low_price); - let tick_high = price_to_tick(high_price); - let add_lq_call = SwapCall::::add_liquidity { - hotkey: U256::from(hotkey), - netuid: netuid.into(), - tick_low, - tick_high, - liquidity, - }; - assert_ok!( - RuntimeCall::Swap(add_lq_call).dispatch(RuntimeOrigin::signed(U256::from(coldkey))) - ); - } -} +// TODO: Revise when user liquidity is available +// fn setup_positions(netuid: NetUid) { +// for (coldkey, hotkey, low_price, high_price, liquidity) in [ +// (2, 12, 0.1, 0.20, 1_000_000_000_000_u64), +// (3, 13, 0.15, 0.25, 200_000_000_000_u64), +// (4, 14, 0.25, 0.5, 3_000_000_000_000_u64), +// (5, 15, 0.3, 0.6, 300_000_000_000_u64), +// (6, 16, 0.4, 0.7, 8_000_000_000_000_u64), +// (7, 17, 0.5, 0.8, 600_000_000_000_u64), +// (8, 18, 0.6, 0.9, 700_000_000_000_u64), +// (9, 19, 0.7, 1.0, 100_000_000_000_u64), +// (10, 20, 0.8, 1.1, 300_000_000_000_u64), +// ] { +// SubtensorModule::create_account_if_non_existent(&U256::from(coldkey), &U256::from(hotkey)); +// SubtensorModule::add_balance_to_coldkey_account( +// &U256::from(coldkey), +// 1_000_000_000_000_000, +// ); +// SubtensorModule::increase_stake_for_hotkey_and_coldkey_on_subnet( +// &U256::from(hotkey), +// &U256::from(coldkey), +// netuid.into(), +// 1_000_000_000_000_000.into(), +// ); + +// let tick_low = price_to_tick(low_price); +// let tick_high = price_to_tick(high_price); +// let add_lq_call = SwapCall::::add_liquidity { +// hotkey: U256::from(hotkey), +// netuid: netuid.into(), +// tick_low, +// tick_high, +// liquidity, +// }; +// assert_ok!( +// RuntimeCall::Swap(add_lq_call).dispatch(RuntimeOrigin::signed(U256::from(coldkey))) +// ); +// } +// } #[test] fn test_large_swap() { @@ -5397,7 +5396,8 @@ fn test_large_swap() { ) .unwrap(); - setup_positions(netuid.into()); + // TODO: Revise when user liquidity is available + // setup_positions(netuid.into()); let swap_amount = TaoCurrency::from(100_000_000_000_000); assert_ok!(SubtensorModule::add_stake( diff --git a/pallets/swap/src/benchmarking.rs b/pallets/swap/src/benchmarking.rs index 66ff88fd31..a17ac59141 100644 --- a/pallets/swap/src/benchmarking.rs +++ b/pallets/swap/src/benchmarking.rs @@ -32,32 +32,33 @@ mod benchmarks { set_fee_rate(RawOrigin::Root, netuid, rate); } - #[benchmark] - fn add_liquidity() { - let netuid = NetUid::from(1); + // TODO: Revise when user liquidity is available + // #[benchmark] + // fn add_liquidity() { + // let netuid = NetUid::from(1); - if !SwapV3Initialized::::get(netuid) { - SwapV3Initialized::::insert(netuid, true); - AlphaSqrtPrice::::insert(netuid, U64F64::from_num(1)); - CurrentTick::::insert(netuid, TickIndex::new(0).unwrap()); - CurrentLiquidity::::insert(netuid, T::MinimumLiquidity::get()); - } + // if !SwapV3Initialized::::get(netuid) { + // SwapV3Initialized::::insert(netuid, true); + // AlphaSqrtPrice::::insert(netuid, U64F64::from_num(1)); + // CurrentTick::::insert(netuid, TickIndex::new(0).unwrap()); + // CurrentLiquidity::::insert(netuid, T::MinimumLiquidity::get()); + // } - let caller: T::AccountId = whitelisted_caller(); - let hotkey: T::AccountId = account("hotkey", 0, 0); - let tick_low = TickIndex::new_unchecked(-1000); - let tick_high = TickIndex::new_unchecked(1000); + // let caller: T::AccountId = whitelisted_caller(); + // let hotkey: T::AccountId = account("hotkey", 0, 0); + // let tick_low = TickIndex::new_unchecked(-1000); + // let tick_high = TickIndex::new_unchecked(1000); - #[extrinsic_call] - add_liquidity( - RawOrigin::Signed(caller), - hotkey, - netuid, - tick_low, - tick_high, - 1000, - ); - } + // #[extrinsic_call] + // add_liquidity( + // RawOrigin::Signed(caller), + // hotkey, + // netuid, + // tick_low, + // tick_high, + // 1000, + // ); + // } #[benchmark] fn remove_liquidity() { diff --git a/pallets/swap/src/pallet/mod.rs b/pallets/swap/src/pallet/mod.rs index eef10be738..b61e7c24ec 100644 --- a/pallets/swap/src/pallet/mod.rs +++ b/pallets/swap/src/pallet/mod.rs @@ -429,7 +429,9 @@ mod pallet { // tick_high, // }); - Ok(()) + // Ok(()) + + Err(Error::::UserLiquidityDisabled.into()) } /// Remove liquidity from a specific position.