@@ -743,6 +743,7 @@ impl<T: Config> Pallet<T> {
743743 // Calculate the hotkey's share of the validator emission based on its childkey take
744744 let validating_emission: U96F32 = U96F32 :: saturating_from_num ( dividends) ;
745745 let mut remaining_emission: U96F32 = validating_emission;
746+
746747 let childkey_take_proportion: U96F32 =
747748 U96F32 :: saturating_from_num ( Self :: get_childkey_take ( hotkey, netuid) )
748749 . safe_div ( U96F32 :: saturating_from_num ( u16:: MAX ) ) ;
@@ -826,14 +827,26 @@ impl<T: Config> Pallet<T> {
826827 . saturating_mul ( U96F32 :: saturating_from_num ( parent_emission) )
827828 } ;
828829
830+ let childkey_emission_take_tax: U96F32 = child_emission_take
831+ . saturating_mul ( U96F32 :: saturating_from_num ( Self :: get_childkey_tax_rate ( ) ) )
832+ . safe_div ( U96F32 :: saturating_from_num ( u16:: MAX ) ) ;
833+
834+ let child_emission_take_after_tax: U96F32 =
835+ child_emission_take. saturating_sub ( childkey_emission_take_tax) ;
836+
829837 // Remove the childkey take from the parent's emission.
830838 parent_emission = parent_emission. saturating_sub ( child_emission_take) ;
831839
832840 // Add the childkey take to the total childkey take tracker.
833841 total_child_emission_take =
834- total_child_emission_take. saturating_add ( child_emission_take ) ;
842+ total_child_emission_take. saturating_add ( child_emission_take_after_tax ) ;
835843
836- log:: debug!( "Child emission take: {child_emission_take:?} for hotkey {hotkey:?}" ) ;
844+ log:: debug!(
845+ "Child emission take tax: {childkey_emission_take_tax:?} for hotkey {hotkey:?}"
846+ ) ;
847+ log:: debug!(
848+ "Child emission take after tax: {child_emission_take_after_tax:?} for hotkey {hotkey:?}"
849+ ) ;
837850 log:: debug!( "Parent emission: {parent_emission:?} for hotkey {hotkey:?}" ) ;
838851 log:: debug!( "remaining emission: {remaining_emission:?}" ) ;
839852
0 commit comments