diff --git a/tools/apr_v2_calculation.py b/tools/apr_v2_calculation.py index 036d4f3..4ce8725 100644 --- a/tools/apr_v2_calculation.py +++ b/tools/apr_v2_calculation.py @@ -7,6 +7,7 @@ URL = 'wss://docker-test.peaq.network' URL = 'wss://mpfn1.peaq.network' +# URL = 'wss://wss-async.agung.peaq.network' INFLAITON_PERCENTAGE = 0.035 COLLATR_DELEGATOR_PERCENTAGE = 0.40 TOTAL_ISSUANCE_NUMBER = 4.2 * 10 ** 9 * 10 ** 18 @@ -35,12 +36,12 @@ for k, v in in_candidate_pool.items(): print(f'collator: {k}') print(f' collator total: {v["total"]}') - # commission_rate = v['commission'] / 10000000 - commission_rate = 0.1 + # commission_rate = v['commission'] / 1000000 + commission_rate = 0.0 print(f' commission rate: {commission_rate}') for delegator in v['delegators']: print(f' delegator: {delegator["owner"]}') print(f' delegator stake: {delegator["amount"]}') - print(f' delegator apr: {(INFLAITON_PERCENTAGE * COLLATR_DELEGATOR_PERCENTAGE * TOTAL_ISSUANCE_NUMBER * (1 - commission_rate) * delegator["amount"] / total_staking_number / delegator["amount"] * 100)}') + print(f' delegator apr: {(INFLAITON_PERCENTAGE * COLLATR_DELEGATOR_PERCENTAGE * TOTAL_ISSUANCE_NUMBER * (1 - commission_rate) / total_staking_number * 100)}') # noqa print(f' sum: {total_staking_number}') - print(f' collator apr: {(INFLAITON_PERCENTAGE * COLLATR_DELEGATOR_PERCENTAGE * TOTAL_ISSUANCE_NUMBER * (v["stake"] + commission_rate * sum([delegator["amount"] for delegator in v["delegators"]])) / total_staking_number / v["stake"] * 100)}') + print(f' collator apr: {(INFLAITON_PERCENTAGE * COLLATR_DELEGATOR_PERCENTAGE * TOTAL_ISSUANCE_NUMBER * (v["stake"] + commission_rate * sum([delegator["amount"] for delegator in v["delegators"]])) / total_staking_number / v["stake"] * 100)}') # noqa diff --git a/tools/stress/stress_token_economy_v2.py b/tools/stress/stress_token_economy_v2.py index a7b464c..2b49830 100644 --- a/tools/stress/stress_token_economy_v2.py +++ b/tools/stress/stress_token_economy_v2.py @@ -133,6 +133,8 @@ def calculate_total_staking_ratio(staking_info, collator_block_info): for collator_addr, collator_stake_info in staking_info.items(): staking_ratio = {} + if collator_addr not in collator_block_info: + continue block_generated_num = float(collator_block_info[collator_addr]) commission = float(collator_stake_info['commission']) / 10 ** 6 @@ -153,6 +155,8 @@ def calculate_total_staking_ratio(staking_info, collator_block_info): def caculate_total_staking_num(staking_info, collator_block_info): total_staking_num = 0 for collator_addr, collator_stake_info in staking_info.items(): + if collator_addr not in collator_block_info: + continue block_generated_num = collator_block_info[collator_addr] total_staking_num += block_generated_num * collator_stake_info['stake'] for delegator_info in collator_stake_info['delegators']: