@@ -138,8 +138,10 @@ impl<T: Config> Pallet<T> {
138
138
for netuid_i in subnets. iter ( ) {
139
139
// Get alpha out.
140
140
let alpha_out_i: I96F32 = * alpha_out. get ( netuid_i) . unwrap_or ( & asfloat ! ( 0 ) ) ;
141
+ log:: debug!( "alpha_out_i: {:?}" , alpha_out_i) ;
141
142
// Calculate the owner cut.
142
143
let owner_cut_i: I96F32 = alpha_out_i. saturating_mul ( cut_percent) ;
144
+ log:: debug!( "owner_cut_i: {:?}" , owner_cut_i) ;
143
145
// Save owner cut.
144
146
* owner_cuts. entry ( * netuid_i) . or_insert ( asfloat ! ( 0 ) ) = owner_cut_i;
145
147
// Save new alpha_out.
@@ -155,24 +157,33 @@ impl<T: Config> Pallet<T> {
155
157
for netuid_i in subnets. iter ( ) {
156
158
// Get remaining alpha out.
157
159
let alpha_out_i: I96F32 = * alpha_out. get ( netuid_i) . unwrap_or ( & asfloat ! ( 0.0 ) ) ;
160
+ log:: debug!( "alpha_out_i: {:?}" , alpha_out_i) ;
158
161
// Get total TAO on root.
159
162
let root_tao: I96F32 = asfloat ! ( SubnetTAO :: <T >:: get( 0 ) ) ;
163
+ log:: debug!( "root_tao: {:?}" , root_tao) ;
160
164
// Get total ALPHA on subnet.
161
165
let alpha_issuance: I96F32 = asfloat ! ( Self :: get_alpha_issuance( * netuid_i) ) ;
166
+ log:: debug!( "alpha_issuance: {:?}" , alpha_issuance) ;
162
167
// Get tao_weight
163
168
let tao_weight: I96F32 = root_tao. saturating_mul ( Self :: get_tao_weight ( ) ) ;
169
+ log:: debug!( "tao_weight: {:?}" , tao_weight) ;
164
170
// Get root proportional dividends.
165
171
let root_proportion: I96F32 = tao_weight
166
172
. checked_div ( tao_weight. saturating_add ( alpha_issuance) )
167
173
. unwrap_or ( asfloat ! ( 0.0 ) ) ;
174
+ log:: debug!( "root_proportion: {:?}" , root_proportion) ;
168
175
// Get root proportion of alpha_out dividends.
169
176
let root_alpha: I96F32 = root_proportion
170
177
. saturating_mul ( alpha_out_i) // Total alpha emission per block remaining.
171
178
. saturating_mul ( asfloat ! ( 0.5 ) ) ; // 50% to validators.
172
179
// Remove root alpha from alpha_out.
180
+ log:: debug!( "root_alpha: {:?}" , root_alpha) ;
181
+ // Get pending alpha as original alpha_out - root_alpha.
173
182
let pending_alpha: I96F32 = alpha_out_i. saturating_sub ( root_alpha) ;
183
+ log:: debug!( "pending_alpha: {:?}" , pending_alpha) ;
174
184
// Sell root emission through the pool.
175
185
let root_tao: u64 = Self :: swap_alpha_for_tao ( * netuid_i, tou64 ! ( root_alpha) ) ;
186
+ log:: debug!( "root_tao: {:?}" , root_tao) ;
176
187
// Accumulate alpha emission in pending.
177
188
PendingAlphaSwapped :: < T > :: mutate ( * netuid_i, |total| {
178
189
* total = total. saturating_add ( tou64 ! ( root_alpha) ) ;
0 commit comments