@@ -54,6 +54,7 @@ impl<T: Config> Pallet<T> {
5454 // --- 3. Get subnet terms (tao_in, alpha_in, and alpha_out)
5555 // Computation is described in detail in the dtao whitepaper.
5656 let mut tao_in: BTreeMap < NetUid , U96F32 > = BTreeMap :: new ( ) ;
57+ let mut tao_issued: BTreeMap < NetUid , U96F32 > = BTreeMap :: new ( ) ;
5758 let mut alpha_in: BTreeMap < NetUid , U96F32 > = BTreeMap :: new ( ) ;
5859 let mut alpha_out: BTreeMap < NetUid , U96F32 > = BTreeMap :: new ( ) ;
5960 // Only calculate for subnets that we are emitting to.
@@ -115,6 +116,7 @@ impl<T: Config> Pallet<T> {
115116 }
116117 // Insert values into maps
117118 tao_in. insert ( * netuid_i, tao_in_i) ;
119+ tao_issued. insert ( * netuid_i, default_tao_in_i) ;
118120 alpha_in. insert ( * netuid_i, alpha_in_i) ;
119121 alpha_out. insert ( * netuid_i, alpha_out_i) ;
120122 }
@@ -150,10 +152,13 @@ impl<T: Config> Pallet<T> {
150152 TotalStake :: < T > :: mutate ( |total| {
151153 * total = total. saturating_add ( tao_in_i. into ( ) ) ;
152154 } ) ;
155+ // TAO issued
156+ let tao_issued_i: TaoCurrency =
157+ tou64 ! ( * tao_issued. get( netuid_i) . unwrap_or( & asfloat!( 0 ) ) ) . into ( ) ;
153158 TotalIssuance :: < T > :: mutate ( |total| {
154- * total = total. saturating_add ( tao_in_i . into ( ) ) ;
159+ * total = total. saturating_add ( tao_issued_i . into ( ) ) ;
155160 } ) ;
156- // Adjust protocol liquidity based on new reserves
161+ // Adjust protocol liquidity based added reserves
157162 T :: SwapInterface :: adjust_protocol_liquidity ( * netuid_i, tao_in_i, alpha_in_i) ;
158163 }
159164
0 commit comments