@@ -631,13 +631,13 @@ def filter_excluded_proposals(
631631
632632
633633def calculate_total_stake_from_block0_configuration (
634- block0_config : Dict [str , Dict ], committee_keys : List [str ]
634+ block0_config : Dict [str , Dict ], committee_keys : List [str ], gamma : Fraction
635635):
636636 funds = (
637637 initial ["fund" ] for initial in block0_config ["initial" ] if "fund" in initial
638638 )
639639 return sum (
640- fund ["value" ]
640+ fund ["value" ] ** gamma
641641 for fund in itertools .chain .from_iterable (funds )
642642 if fund ["address" ] not in [key for key in committee_keys ]
643643 )
@@ -761,7 +761,12 @@ def save_results(
761761def calculate_rewards (
762762 output_file : str = typer .Option (...),
763763 block0_path : str = typer .Option (...),
764- gamma : str = typer .Option (...), # quadratic voting
764+ gamma : str = typer .Option (
765+ "1" ,
766+ help = """
767+ The gamma value applied for the calculation of the total stake threshold. It is applied to every single voting value before the sum is executed.
768+ """
769+ ),
765770 total_stake_threshold : float = typer .Option (
766771 0.01 ,
767772 help = """
@@ -770,7 +775,7 @@ def calculate_rewards(
770775 """ ,
771776 ),
772777 relative_threshold : float = typer .Option (
773- 0 ,
778+ - 1 ,
774779 help = "This value indicates the relative threshold between Yes/No votes needed by projects to be eligible for funding." ,
775780 ),
776781 output_format : OutputFormat = typer .Option ("csv" , help = "Output format" ),
@@ -853,15 +858,18 @@ def calculate_rewards(
853858 committee_keys = (
854859 load_json_from_file (committee_keys_path ) if committee_keys_path else []
855860 )
856- total_stake = calculate_total_stake_from_block0_configuration (
857- block0_config , committee_keys
858- )
861+
859862 # minimum amount of stake needed for a proposal to be accepted
860- print (f"\n Total stake before gamma applied { total_stake } " )
863+ _total_stake = calculate_total_stake_from_block0_configuration (
864+ block0_config , committee_keys , Fraction (1 )
865+ )
866+ print (f"\n Total stake before gamma applied { _total_stake } " )
861867 print (f"Gamma as fractional exponent: { gamma } " )
862868
863- expo = Fraction (gamma ) # gamma as fractional exponent
864- total_stake = Fraction (total_stake ) ** expo
869+ total_stake = calculate_total_stake_from_block0_configuration (
870+ block0_config , committee_keys , Fraction (gamma )
871+ )
872+
865873 total_stake_approval_threshold = float (total_stake_threshold ) * float (total_stake )
866874 print (f"Total stake after gamma applied { total_stake } \n " )
867875
0 commit comments