1- use subtensor_swap_interface:: { SwapEngine , SwapExt } ;
2-
31use super :: * ;
42use substrate_fixed:: types:: U96F32 ;
53use subtensor_runtime_common:: { AlphaCurrency , Currency , NetUid , TaoCurrency } ;
6- use subtensor_swap_interface:: Order ;
4+ use subtensor_swap_interface:: { Order , SwapHandler } ;
75
86impl < T : Config > Pallet < T > {
97 /// ---- The implementation for the extrinsic remove_stake: Removes stake from a hotkey account and adds it onto a coldkey.
@@ -74,7 +72,7 @@ impl<T: Config> Pallet<T> {
7472 & coldkey,
7573 netuid,
7674 alpha_unstaked,
77- T :: SwapExt :: min_price ( ) ,
75+ T :: SwapInterface :: min_price ( ) ,
7876 false ,
7977 ) ?;
8078
@@ -169,7 +167,7 @@ impl<T: Config> Pallet<T> {
169167 & coldkey,
170168 netuid,
171169 alpha_unstaked,
172- T :: SwapExt :: min_price ( ) ,
170+ T :: SwapInterface :: min_price ( ) ,
173171 false ,
174172 ) ?;
175173
@@ -262,7 +260,7 @@ impl<T: Config> Pallet<T> {
262260 & coldkey,
263261 netuid,
264262 alpha_unstaked,
265- T :: SwapExt :: min_price ( ) ,
263+ T :: SwapInterface :: min_price ( ) ,
266264 false ,
267265 ) ?;
268266
@@ -281,7 +279,7 @@ impl<T: Config> Pallet<T> {
281279 & coldkey,
282280 NetUid :: ROOT ,
283281 total_tao_unstaked,
284- T :: SwapExt :: max_price ( ) ,
282+ T :: SwapInterface :: max_price ( ) ,
285283 false , // no limit for Root subnet
286284 false ,
287285 ) ?;
@@ -407,7 +405,7 @@ impl<T: Config> Pallet<T> {
407405
408406 // Use reverting swap to estimate max limit amount
409407 let order = GetTaoForAlpha :: < T > :: with_amount ( u64:: MAX ) ;
410- let result = T :: SwapEngine :: swap ( netuid. into ( ) , order, limit_price. into ( ) , false , true )
408+ let result = T :: SwapInterface :: swap ( netuid. into ( ) , order, limit_price. into ( ) , false , true )
411409 . map ( |r| r. amount_paid_in . saturating_add ( r. fee_paid ) )
412410 . map_err ( |_| Error :: ZeroMaxStakeAmount ) ?;
413411
@@ -465,13 +463,13 @@ impl<T: Config> Pallet<T> {
465463
466464 let owner_emission_tao: TaoCurrency = if owner_alpha_u64 > 0 {
467465 let order = GetTaoForAlpha :: < T > :: with_amount ( owner_alpha_u64) ;
468- match T :: SwapEngine :: sim_swap ( netuid. into ( ) , order) {
466+ match T :: SwapInterface :: sim_swap ( netuid. into ( ) , order) {
469467 Ok ( sim) => sim. amount_paid_out ,
470468 Err ( e) => {
471469 log:: debug!(
472470 "destroy_alpha_in_out_stakes: sim_swap owner α→τ failed (netuid={netuid:?}, alpha={owner_alpha_u64}, err={e:?}); falling back to price multiply." ,
473471 ) ;
474- let cur_price: U96F32 = T :: SwapExt :: current_alpha_price ( netuid. into ( ) ) ;
472+ let cur_price: U96F32 = T :: SwapInterface :: current_alpha_price ( netuid. into ( ) ) ;
475473 let val_u64: u64 = U96F32 :: from_num ( owner_alpha_u64)
476474 . saturating_mul ( cur_price)
477475 . floor ( )
0 commit comments