Skip to content

Commit

Permalink
Add warning regarding zero-balance positions
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Jun 23, 2023
1 parent e06be44 commit 4270478
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion eth_defi/enzyme/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,15 @@ def fetch_vault_balances(
- Does not get shares of individual investors
.. warning::
Enzyme returns positions with zero balance so you need to filter these out.
Example:
.. code-block:: python
balance_map = {b.token.address: b for b in fetch_vault_balances(vault)}
balance_map = {b.token.address: b for b in fetch_vault_balances(vault) if b.balance > 0}
assert len(balance_map) == 2
assert balance_map[usdc.address].balance == 1300
assert balance_map[weth.address].balance == pytest.approx(Decimal("0.124500872629987902"))
Expand Down

0 comments on commit 4270478

Please sign in to comment.