Skip to content

Commit

Permalink
feat: update bondRequirementRate per rev28 for mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
robcxyz committed Aug 30, 2024
1 parent cb031cd commit bae3878
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions icon_governance/workers/crons/prep_attributes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from time import sleep

from icon_governance.config import settings
from icon_governance.log import logger
from icon_governance.metrics import prom_metrics
from icon_governance.models.preps import Prep
Expand All @@ -16,9 +15,8 @@
def run_prep_attributes(session):
logger.info(f"Starting {__name__} cron")

if settings.NETWORK_NAME in ["lisbon", "berlin"]:
network_info = get_network_info()
bond_requirement_rate = int(network_info["bondRequirementRate"], 0) / 10_000
network_info = get_network_info()
bond_requirement_rate = int(network_info["bondRequirementRate"], 0) / 10_000

preps_rpc = post_rpc_json(getPReps())
if preps_rpc is None:
Expand Down Expand Up @@ -48,12 +46,9 @@ def run_prep_attributes(session):
prep.delegated = convert_hex_int(p["delegated"]) / 1e18

if prep.delegated != 0:
if settings.NETWORK_NAME in ["lisbon", "berlin"]:
prep.bond_percent = (
prep.bonded / bond_requirement_rate / prep.delegated / 1e18
)
else:
prep.bond_percent = 20 * prep.bonded / prep.delegated / 1e18
prep.bond_percent = (
prep.bonded / bond_requirement_rate / prep.delegated / 1e18
)
else:
prep.bond_percent = 0

Expand Down

0 comments on commit bae3878

Please sign in to comment.