@@ -40,6 +40,7 @@ impl<T: Config> Pallet<T> {
4040 let mut tao_in: BTreeMap < NetUid , U96F32 > = BTreeMap :: new ( ) ;
4141 let mut alpha_in: BTreeMap < NetUid , U96F32 > = BTreeMap :: new ( ) ;
4242 let mut alpha_out: BTreeMap < NetUid , U96F32 > = BTreeMap :: new ( ) ;
43+ let mut ti_delta: BTreeMap < NetUid , U96F32 > = BTreeMap :: new ( ) ;
4344 let mut is_subsidized: BTreeMap < NetUid , bool > = BTreeMap :: new ( ) ;
4445 // Only calculate for subnets that we are emitting to.
4546 for netuid_i in subnets_to_emit_to. iter ( ) {
@@ -105,10 +106,12 @@ impl<T: Config> Pallet<T> {
105106 tao_in. insert ( * netuid_i, tao_in_i) ;
106107 alpha_in. insert ( * netuid_i, alpha_in_i) ;
107108 alpha_out. insert ( * netuid_i, alpha_out_i) ;
109+ ti_delta. insert ( * netuid_i, default_tao_in_i) ;
108110 }
109111 log:: debug!( "tao_in: {tao_in:?}" ) ;
110112 log:: debug!( "alpha_in: {alpha_in:?}" ) ;
111113 log:: debug!( "alpha_out: {alpha_out:?}" ) ;
114+ log:: debug!( "ti_delta: {ti_delta:?}" ) ;
112115
113116 // --- 4. Injection.
114117 // Actually perform the injection of alpha_in, alpha_out and tao_in into the subnet pool.
@@ -138,8 +141,10 @@ impl<T: Config> Pallet<T> {
138141 TotalStake :: < T > :: mutate ( |total| {
139142 * total = total. saturating_add ( tao_in_i. into ( ) ) ;
140143 } ) ;
144+ let ti_delta_i: TaoCurrency =
145+ tou64 ! ( * ti_delta. get( netuid_i) . unwrap_or( & asfloat!( 0 ) ) ) . into ( ) ;
141146 TotalIssuance :: < T > :: mutate ( |total| {
142- * total = total. saturating_add ( tao_in_i . into ( ) ) ;
147+ * total = total. saturating_add ( ti_delta_i . into ( ) ) ;
143148 } ) ;
144149 // Adjust protocol liquidity based on new reserves
145150 T :: SwapInterface :: adjust_protocol_liquidity ( * netuid_i, tao_in_i, alpha_in_i) ;
0 commit comments