Skip to content

Commit

Permalink
fix: handle zero gauge address and zero working supply (yearn#162)
Browse files Browse the repository at this point in the history
  • Loading branch information
jstashh authored Nov 19, 2021
1 parent b27bcec commit 14d3744
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions yearn/apy/curve/simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def simple(vault, samples: ApySamples) -> Apy:

gauge_address = curve.get_gauge(pool_address)

if gauge_address is None:
raise ApyError("crv", "no gauge")

gauge = Contract(gauge_address)

try:
Expand All @@ -56,6 +59,8 @@ def simple(vault, samples: ApySamples) -> Apy:
block = samples.now
gauge_weight = controller.gauge_relative_weight.call(gauge_address, block_identifier=block)
gauge_working_supply = gauge.working_supply(block_identifier=block)
if gauge_working_supply == 0:
raise ApyError("crv", "gauge working supply is zero")

gauge_inflation_rate = gauge.inflation_rate(block_identifier=block)
pool = Contract(pool_address)
Expand Down

0 comments on commit 14d3744

Please sign in to comment.