@@ -631,13 +631,13 @@ def filter_excluded_proposals(
631
631
632
632
633
633
def 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
635
635
):
636
636
funds = (
637
637
initial ["fund" ] for initial in block0_config ["initial" ] if "fund" in initial
638
638
)
639
639
return sum (
640
- fund ["value" ]
640
+ fund ["value" ] ** gamma
641
641
for fund in itertools .chain .from_iterable (funds )
642
642
if fund ["address" ] not in [key for key in committee_keys ]
643
643
)
@@ -761,7 +761,12 @@ def save_results(
761
761
def calculate_rewards (
762
762
output_file : str = typer .Option (...),
763
763
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
+ ),
765
770
total_stake_threshold : float = typer .Option (
766
771
0.01 ,
767
772
help = """
@@ -770,7 +775,7 @@ def calculate_rewards(
770
775
""" ,
771
776
),
772
777
relative_threshold : float = typer .Option (
773
- 0 ,
778
+ - 1 ,
774
779
help = "This value indicates the relative threshold between Yes/No votes needed by projects to be eligible for funding." ,
775
780
),
776
781
output_format : OutputFormat = typer .Option ("csv" , help = "Output format" ),
@@ -853,15 +858,18 @@ def calculate_rewards(
853
858
committee_keys = (
854
859
load_json_from_file (committee_keys_path ) if committee_keys_path else []
855
860
)
856
- total_stake = calculate_total_stake_from_block0_configuration (
857
- block0_config , committee_keys
858
- )
861
+
859
862
# 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 } " )
861
867
print (f"Gamma as fractional exponent: { gamma } " )
862
868
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
+
865
873
total_stake_approval_threshold = float (total_stake_threshold ) * float (total_stake )
866
874
print (f"Total stake after gamma applied { total_stake } \n " )
867
875
0 commit comments