File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -585,7 +585,7 @@ mod dispatches {
585585 /// - Errors stemming from transaction pallet.
586586 ///
587587 #[ pallet:: call_index( 2 ) ]
588- #[ pallet:: weight( ( Weight :: from_parts( 345_500_000 , 0 )
588+ #[ pallet:: weight( ( Weight :: from_parts( 270_800_000 , 0 )
589589 . saturating_add( T :: DbWeight :: get( ) . reads( 26 ) )
590590 . saturating_add( T :: DbWeight :: get( ) . writes( 15 ) ) , DispatchClass :: Normal , Pays :: Yes ) ) ]
591591 pub fn add_stake (
@@ -924,7 +924,7 @@ mod dispatches {
924924
925925 /// User register a new subnetwork via burning token
926926 #[ pallet:: call_index( 7 ) ]
927- #[ pallet:: weight( ( Weight :: from_parts( 354_400_000 , 0 )
927+ #[ pallet:: weight( ( Weight :: from_parts( 278_400_000 , 0 )
928928 . saturating_add( T :: DbWeight :: get( ) . reads( 49 ) )
929929 . saturating_add( T :: DbWeight :: get( ) . writes( 43 ) ) , DispatchClass :: Normal , Pays :: No ) ) ]
930930 pub fn burned_register (
Original file line number Diff line number Diff line change @@ -368,12 +368,20 @@ impl<T: Config> Pallet<T> {
368368 . collect :: < sp_std:: vec:: Vec < _ > > ( ) ;
369369
370370 if let Some ( position) = positions. get_mut ( 0 ) {
371+ // Claim protocol fees and add them to liquidity
372+ let ( tao_fees, alpha_fees) = position. collect_fees ( ) ;
373+
374+ // Adjust liquidity
371375 let current_sqrt_price = Pallet :: < T > :: current_price_sqrt ( netuid) ;
372376 let maybe_token_amounts = position. to_token_amounts ( current_sqrt_price) ;
373377 if let Ok ( ( tao, alpha) ) = maybe_token_amounts {
374378 // Get updated reserves, calculate liquidity
375- let new_tao_reserve = tao. saturating_add ( tao_delta. to_u64 ( ) ) ;
376- let new_alpha_reserve = alpha. saturating_add ( alpha_delta. to_u64 ( ) ) ;
379+ let new_tao_reserve = tao
380+ . saturating_add ( tao_delta. to_u64 ( ) )
381+ . saturating_add ( tao_fees) ;
382+ let new_alpha_reserve = alpha
383+ . saturating_add ( alpha_delta. to_u64 ( ) )
384+ . saturating_add ( alpha_fees) ;
377385 let new_liquidity = helpers_128bit:: sqrt (
378386 ( new_tao_reserve as u128 ) . saturating_mul ( new_alpha_reserve as u128 ) ,
379387 ) as u64 ;
You can’t perform that action at this time.
0 commit comments