Skip to content

Commit

Permalink
fix: _get_price Decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Nov 12, 2023
1 parent 14a4594 commit bc0616f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions yearn/prices/magic.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ async def _get_price(token: AnyAddressType, block: Optional[Block]) -> Decimal:
from yearn.special import Backscratcher
# no liquid market for yveCRV-DAO -> return CRV token price
if token == Backscratcher().vault.address and block < 11786563:
return await _get_price("0xD533a949740bb3306d119CC777fa900bA034cd52", block)
return Decimal(await _get_price("0xD533a949740bb3306d119CC777fa900bA034cd52", block))
# no liquidity for curve pool (yvecrv-f) -> return 0
elif token == "0x7E46fd8a30869aa9ed55af031067Df666EfE87da" and block < 14987514:
return 0
return Decimal(0)
# no continuous price data before 2020-10-10
elif token == "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D" and block < 11024342:
return 0
return Decimal(0)
try:
return await magic.get_price(token, block, sync=False)
return Decimal(await magic.get_price(token, block, sync=False))
except:
for incident in INCIDENTS[token]:
if incident['start'] <= block <= incident['end']:
return incident['result']
return Decimal(incident['result'])
raise

# Will delete once we're sure we don't need anymore
Expand Down

0 comments on commit bc0616f

Please sign in to comment.