Skip to content

Commit

Permalink
fix: Handle price failure case (#600)
Browse files Browse the repository at this point in the history
* fix: price err tvl edge case

* chore: cleanup
  • Loading branch information
BobTheBuidler authored Sep 7, 2023
1 parent 642ad3d commit 623bd06
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions yearn/v1/vaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,5 +159,6 @@ async def tvl(self, block=None):
except yPriceMagicError as e:
if not isinstance(e.exception, PriceError):
raise e
price = None
tvl = total_assets * price / 10 ** await self.vault.decimals.coroutine(block_identifier=block) if price else None
return Tvl(total_assets, price, tvl)
3 changes: 0 additions & 3 deletions yearn/v2/vaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,7 @@ async def tvl(self, block=None):
raise e
price = 0

# NOTE: which one of these do we use? idk, must check
tvl = total_assets * price / 10 ** self.vault.decimals(block_identifier=block)
tvl = total_assets * price / await ERC20(self.vault, asynchronous=True).scale if price else None

return Tvl(total_assets, price, tvl)

@cached_property
Expand Down

0 comments on commit 623bd06

Please sign in to comment.