Skip to content

Commit

Permalink
Make script more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
shahthepro committed Aug 25, 2023
1 parent 90ad98a commit 0572c83
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions eagleproject/scripts/compute_boost_multiplier.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,34 @@ def run(*script_args):

print("Found {} Supply snapshots".format(len(snapshots)))
for s in snapshots:
if s.computed_supply == 0 or s.computed_supply == s.non_rebasing_supply:
continue

if s.project == OriginTokens.OETH:
print("Computing OETH Boost multiplier at block {}".format(s.block_number))
try:
oeth = ensure_asset("OETH", s.block_number, project=OriginTokens.OETH)
amo_supply = oeth.get_strat_holdings("oeth_curve_amo")
except Exception as e:
print(e)
print("Reading from on-chain for block {}".format(s.block_number))
amo_supply = OETHCurveAMOStrategy.get_underlying_balance(s.block_number).get("OETH", Decimal(0))
if s.block_number < 17249902: # block when AMO strategy was deployed
amo_supply = 0
else:
try:
oeth = ensure_asset("OETH", s.block_number, project=OriginTokens.OETH)
amo_supply = oeth.get_strat_holdings("oeth_curve_amo")
except Exception as e:
print(e)
print("Reading from on-chain for block {}".format(s.block_number))
amo_supply = OETHCurveAMOStrategy.get_underlying_balance(s.block_number).get("OETH", Decimal(0))
elif s.project == OriginTokens.OUSD:
print("Computing OUSD Boost multiplier at block {}".format(s.block_number))
try:
ousd = ensure_asset("OUSD", s.block_number, project=OriginTokens.OUSD)
amo_supply = ousd.get_strat_holdings("ousd_metastrat")
except Exception as e:
print(e)
print("Reading from on-chain for block {}".format(s.block_number))
amo_supply = OUSDMetaStrategy.get_underlying_balance(s.block_number).get("OUSD", Decimal(0))

if s.block_number < 15896478:
amo_supply = 0
else:
try:
ousd = ensure_asset("OUSD", s.block_number, project=OriginTokens.OUSD)
amo_supply = ousd.get_strat_holdings("ousd_metastrat")
except Exception as e:
print(e)
print("Reading from on-chain for block {}".format(s.block_number))
amo_supply = OUSDMetaStrategy.get_underlying_balance(s.block_number).get("OUSD", Decimal(0))

s.non_rebasing_boost_multiplier = (s.computed_supply - amo_supply) / (s.computed_supply - s.non_rebasing_supply)
s.save()

Expand Down

0 comments on commit 0572c83

Please sign in to comment.