@@ -537,20 +537,23 @@ fn test_distribute_lease_network_dividends_multiple_contributors_works() {
537537 let distributed_alpha =
538538 accumulated_dividends + emissions_share. mul_ceil ( owner_cut_alpha. to_u64 ( ) ) . into ( ) ;
539539 assert_ne ! ( distributed_alpha, AlphaCurrency :: ZERO ) ;
540+
540541 let contributor1_alpha_delta = SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet (
541542 & lease. hotkey ,
542543 & contributions[ 0 ] . 0 ,
543544 lease. netuid ,
544545 )
545546 . saturating_sub ( contributor1_alpha_before) ;
546547 assert_ne ! ( contributor1_alpha_delta, AlphaCurrency :: ZERO ) ;
548+
547549 let contributor2_alpha_delta = SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet (
548550 & lease. hotkey ,
549551 & contributions[ 1 ] . 0 ,
550552 lease. netuid ,
551553 )
552554 . saturating_sub ( contributor2_alpha_before) ;
553555 assert_ne ! ( contributor2_alpha_delta, AlphaCurrency :: ZERO ) ;
556+
554557 let beneficiary_alpha_delta = SubtensorModule :: get_stake_for_hotkey_and_coldkey_on_subnet (
555558 & lease. hotkey ,
556559 & beneficiary,
@@ -571,18 +574,42 @@ fn test_distribute_lease_network_dividends_multiple_contributors_works() {
571574 . ceil ( )
572575 . to_num :: < u64 > ( ) ;
573576 assert_eq ! ( contributor1_alpha_delta, expected_contributor1_alpha. into( ) ) ;
577+ assert_eq ! (
578+ System :: events( ) . get( 2 ) . expect( "Event not found" ) . event,
579+ RuntimeEvent :: SubtensorModule ( Event :: SubnetLeaseDividendsDistributed {
580+ lease_id,
581+ contributor: contributions[ 0 ] . 0 . into( ) ,
582+ alpha: expected_contributor1_alpha. into( ) ,
583+ } , )
584+ ) ;
574585
575586 let expected_contributor2_alpha =
576587 SubnetLeaseShares :: < Test > :: get ( lease_id, contributions[ 1 ] . 0 )
577588 . saturating_mul ( U64F64 :: from ( distributed_alpha. to_u64 ( ) ) )
578589 . ceil ( )
579590 . to_num :: < u64 > ( ) ;
580591 assert_eq ! ( contributor2_alpha_delta, expected_contributor2_alpha. into( ) ) ;
592+ assert_eq ! (
593+ System :: events( ) . get( 5 ) . expect( "Event not found" ) . event,
594+ RuntimeEvent :: SubtensorModule ( Event :: SubnetLeaseDividendsDistributed {
595+ lease_id,
596+ contributor: contributions[ 1 ] . 0 . into( ) ,
597+ alpha: expected_contributor2_alpha. into( ) ,
598+ } , )
599+ ) ;
581600
582601 // The beneficiary should have received the remaining dividends
583602 let expected_beneficiary_alpha = distributed_alpha. to_u64 ( )
584603 - ( expected_contributor1_alpha + expected_contributor2_alpha) ;
585604 assert_eq ! ( beneficiary_alpha_delta, expected_beneficiary_alpha. into( ) ) ;
605+ assert_eq ! (
606+ System :: events( ) . get( 8 ) . expect( "Event not found" ) . event,
607+ RuntimeEvent :: SubtensorModule ( Event :: SubnetLeaseDividendsDistributed {
608+ lease_id,
609+ contributor: beneficiary. into( ) ,
610+ alpha: expected_beneficiary_alpha. into( ) ,
611+ } , )
612+ ) ;
586613
587614 // Ensure nothing was accumulated for later distribution
588615 assert_eq ! (
@@ -644,6 +671,13 @@ fn test_distribute_lease_network_dividends_only_beneficiary_works() {
644671 )
645672 . saturating_sub ( beneficiary_alpha_before) ;
646673 assert_eq ! ( beneficiary_alpha_delta, distributed_alpha. into( ) ) ;
674+ assert_last_event :: < Test > ( RuntimeEvent :: SubtensorModule (
675+ Event :: SubnetLeaseDividendsDistributed {
676+ lease_id,
677+ contributor : beneficiary. into ( ) ,
678+ alpha : distributed_alpha,
679+ } ,
680+ ) ) ;
647681
648682 // Ensure nothing was accumulated for later distribution
649683 assert_eq ! (
0 commit comments