|
21 | 21 | from rich import print |
22 | 22 | from asyncio import run as aiorun |
23 | 23 | from copy import deepcopy |
| 24 | +from fractions import Fraction |
24 | 25 |
|
25 | 26 |
|
26 | 27 | # VIT servicing station models |
@@ -584,13 +585,13 @@ def filter_excluded_proposals( |
584 | 585 |
|
585 | 586 |
|
586 | 587 | def calculate_total_stake_from_block0_configuration( |
587 | | - block0_config: Dict[str, Dict], committee_keys: List[str] |
| 588 | + block0_config: Dict[str, Dict], committee_keys: List[str], gamma: Fraction |
588 | 589 | ): |
589 | 590 | funds = ( |
590 | 591 | initial["fund"] for initial in block0_config["initial"] if "fund" in initial |
591 | 592 | ) |
592 | 593 | return sum( |
593 | | - fund["value"] |
| 594 | + fund["value"] ** gamma |
594 | 595 | for fund in itertools.chain.from_iterable(funds) |
595 | 596 | if fund["address"] not in [key for key in committee_keys] |
596 | 597 | ) |
@@ -698,6 +699,12 @@ def save_results(output_path: str, title: str, output_format: OutputFormat, resu |
698 | 699 | def calculate_rewards( |
699 | 700 | output_file: str = typer.Option(...), |
700 | 701 | block0_path: str = typer.Option(...), |
| 702 | + gamma: str = typer.Option( |
| 703 | + 1, |
| 704 | + help=""" |
| 705 | + 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. |
| 706 | + """ |
| 707 | + ), |
701 | 708 | total_stake_threshold: float = typer.Option( |
702 | 709 | 0.01, |
703 | 710 | help=""" |
@@ -785,7 +792,7 @@ def calculate_rewards( |
785 | 792 | load_json_from_file(committee_keys_path) if committee_keys_path else [] |
786 | 793 | ) |
787 | 794 | total_stake = calculate_total_stake_from_block0_configuration( |
788 | | - block0_config, committee_keys |
| 795 | + block0_config, committee_keys, gamma |
789 | 796 | ) |
790 | 797 | # minimum amount of stake needed for a proposal to be accepted |
791 | 798 | total_stake_approval_threshold = float(total_stake_threshold) * float(total_stake) |
|
0 commit comments