@@ -65,7 +65,9 @@ pub mod pallet {
6565 } ,
6666 } ;
6767
68- pub const default_bonded_amount: u128 = 25_133_000_000_000_000_000_000u128 ;
68+ // this is only a default for test purposes and fallback.
69+ // set this to 0u128 in production
70+ pub const default_bonded_amount_u128: u128 = 25_133_000_000_000_000_000_000u128 ;
6971
7072 // type BalanceOf<T> = <T as pallet_balances::Config>::Balance;
7173 type BalanceOf < T > = <<T as Config >:: Currency as Currency < <T as frame_system:: Config >:: AccountId > >:: Balance ;
@@ -786,7 +788,7 @@ pub mod pallet {
786788 // half of 5000 DHX daily allowance (of 2500 DHX), but in that case we split the rewards
787789 // (i.e. 25,133 DHX locked at 10:1 gives 2513 DHX reward)
788790
789- let mut locks_first_amount_as_u128 = default_bonded_amount . clone ( ) ;
791+ let mut locks_first_amount_as_u128 = default_bonded_amount_u128 . clone ( ) ;
790792 let locked_vec = <pallet_balances:: Pallet < T > >:: locks ( miner. clone ( ) ) . into_inner ( ) ;
791793 if locked_vec. len ( ) != 0 {
792794 // println!("locked_vec: {:?}", locked_vec);
@@ -1277,6 +1279,9 @@ pub mod pallet {
12771279 // we could just divide both numbers by 1000000000000000000, so we'd have say 5000 and 1 instead,
12781280 // since we're just using these values to get a multiplier output.
12791281
1282+ println ! ( "000 {:?}" , rewards_allowance_dhx_daily_u128) ;
1283+ println ! ( "001 {:?}" , rewards_aggregated_dhx_daily_as_u128) ;
1284+
12801285 let mut manageable_rewards_allowance_dhx_daily_u128 = 0u128 ;
12811286 if let Some ( _manageable_rewards_allowance_dhx_daily_u128) =
12821287 rewards_allowance_dhx_daily_u128. clone ( ) . checked_div ( 1000000000000000000u128 ) {
@@ -1328,7 +1333,7 @@ pub mod pallet {
13281333 }
13291334 }
13301335 log:: info!( "distribution_multiplier_for_day_fixed128 {:#?}" , distribution_multiplier_for_day_fixed128) ;
1331- // println!("[multiplier] block: {:#?}, miner: {:#?}, date_start: {:#?} distribution_multiplier_for_day_fixed128: {:#?}", _n, miner_count, start_of_requested_date_millis, distribution_multiplier_for_day_fixed128);
1336+ println ! ( "[multiplier] block: {:#?}, miner: {:#?}, date_start: {:#?} distribution_multiplier_for_day_fixed128: {:#?}" , _n, miner_count, start_of_requested_date_millis, distribution_multiplier_for_day_fixed128) ;
13321337
13331338 // Initialise outside the loop as we need this value after the loop after we finish iterating through all the miners
13341339 let mut rewards_allowance_dhx_remaining_today_as_u128 = 0u128 ;
@@ -1374,6 +1379,7 @@ pub mod pallet {
13741379 continue ;
13751380 }
13761381 log:: info!( "daily_reward_for_miner_as_u128: {:?}" , daily_reward_for_miner_as_u128. clone( ) ) ;
1382+ println ! ( "0 {:?}" , daily_reward_for_miner_as_u128) ;
13771383
13781384 let mut manageable_daily_reward_for_miner_as_u128 = 0u128 ;
13791385 if let Some ( _manageable_daily_reward_for_miner_as_u128) =
@@ -1383,6 +1389,7 @@ pub mod pallet {
13831389 log:: error!( "Unable to divide daily_reward_for_miner_as_u128 to make it smaller" ) ;
13841390 return 0 ;
13851391 }
1392+ println ! ( "1 {:?}" , manageable_daily_reward_for_miner_as_u128) ;
13861393
13871394 // Multiply, handling overflow
13881395 // TODO - probably have to initialise below proportion_of_daily_reward_for_miner_fixed128 to 0u128,
@@ -1402,7 +1409,7 @@ pub mod pallet {
14021409 }
14031410 }
14041411 log:: info!( "proportion_of_daily_reward_for_miner_fixed128: {:?}" , proportion_of_daily_reward_for_miner_fixed128. clone( ) ) ;
1405-
1412+ println ! ( "2 {:?}" , proportion_of_daily_reward_for_miner_fixed128 ) ;
14061413 // round down to nearest integer. we need to round down, because if we round up then if there are
14071414 // 3x registered miners with 5000 DHX rewards allowance per day then they would each get 1667 rewards,
14081415 // but there would only be 1666 remaining after the first two, so the last one would miss out.
@@ -1419,7 +1426,7 @@ pub mod pallet {
14191426 return 0 ;
14201427 }
14211428
1422- // println!("[rewards] block: {:#?}, miner: {:#?}, date_start: {:#?} restored_proportion_of_daily_reward_for_miner_u128: {:#?}", _n, miner_count, start_of_requested_date_millis, restored_proportion_of_daily_reward_for_miner_u128);
1429+ println ! ( "[rewards] block: {:#?}, miner: {:#?}, date_start: {:#?} restored_proportion_of_daily_reward_for_miner_u128: {:#?}" , _n, miner_count, start_of_requested_date_millis, restored_proportion_of_daily_reward_for_miner_u128) ;
14231430
14241431 let treasury_account_id: T :: AccountId = <pallet_treasury:: Pallet < T > >:: account_id ( ) ;
14251432 let max_payout = pallet_balances:: Pallet :: < T > :: usable_balance ( treasury_account_id. clone ( ) ) ;
@@ -1467,6 +1474,9 @@ pub mod pallet {
14671474 return 0 ;
14681475 }
14691476
1477+ println ! ( "[prepared-for-payment] block: {:#?}, miner: {:#?}, date_start: {:#?} max payout: {:#?}, rewards remaining today {:?}, restored_proportion_of_daily_reward_for_miner_u128 {:?}" ,
1478+ _n, miner_count, start_of_requested_date_millis, max_payout_as_u128, rewards_allowance_dhx_remaining_today_as_u128, restored_proportion_of_daily_reward_for_miner_u128) ;
1479+
14701480 // check if miner's reward is less than or equal to: rewards_allowance_dhx_daily_remaining
14711481 if restored_proportion_of_daily_reward_for_miner_u128. clone ( ) > 0u128 &&
14721482 rewards_allowance_dhx_remaining_today_as_u128. clone ( ) >= restored_proportion_of_daily_reward_for_miner_u128. clone ( ) &&
@@ -1529,7 +1539,7 @@ pub mod pallet {
15291539 new_rewards_allowance_dhx_remaining_today. clone ( ) ,
15301540 ) ;
15311541
1532- // println!("[paid] block: {:#?}, miner: {:#?}, date_start: {:#?} new_rewards_allowance_dhx_remaining_today: {:#?}", _n, miner_count, start_of_requested_date_millis, new_rewards_allowance_dhx_remaining_today);
1542+ println ! ( "[paid] block: {:#?}, miner: {:#?}, date_start: {:#?} new_rewards_allowance_dhx_remaining_today: {:#?}" , _n, miner_count, start_of_requested_date_millis, new_rewards_allowance_dhx_remaining_today) ;
15331543
15341544 // emit event with reward payment history rather than bloating storage
15351545 Self :: deposit_event ( Event :: TransferredRewardsAllowanceDHXToMinerForDate (
0 commit comments