Skip to content

Commit

Permalink
feat: support eth-brownie>=1.20 (#46)
Browse files Browse the repository at this point in the history
* chore: accept more brownie versions

* fix: conflict with eth-abi>=4.0.0

* fix: conflict with eth-abi>=4.0.0

* chore: add comment
  • Loading branch information
BobTheBuidler authored Apr 10, 2024
1 parent eabaaf8 commit ff92b8f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 7 additions & 3 deletions eth_portfolio/_ydb/token_transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

import a_sync
from brownie import chain
from eth_abi import encode_single
try:
# this is only available in 4.0.0+
from eth_abi import encode
except ImportError:
from eth_abi import encode_single as encode
from eth_utils import encode_hex
from web3.types import LogReceipt
from y.datatypes import Address
Expand Down Expand Up @@ -59,13 +63,13 @@ class InboundTokenTransfers(_TokenTransfers):
"""A container that fetches and iterates over all inbound token transfers for a particular wallet address"""
@property
def _topics(self) -> List:
return [TRANSFER_SIGS, None, [encode_hex(encode_single('address', str(self.address)))]]
return [TRANSFER_SIGS, None, [encode_hex(encode(['address'], str(self.address)))]]

class OutboundTokenTransfers(_TokenTransfers):
"""A container that fetches and iterates over all outbound token transfers for a particular wallet address"""
@property
def _topics(self) -> List:
return [TRANSFER_SIGS, [encode_hex(encode_single('address', str(self.address)))]]
return [TRANSFER_SIGS, [encode_hex(encode(['address'], str(self.address)))]]

class TokenTransfers(a_sync.ASyncIterable[TokenTransfer]):
"""
Expand Down
10 changes: 7 additions & 3 deletions eth_portfolio/protocols/lending/maker.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
from typing import Optional

from async_lru import alru_cache
from eth_abi import encode_single
try:
# this is only available in 4.0.0+
from eth_abi import encode
except ImportError:
from eth_abi import encode_single as encode
from y import Network, get_price
from y.constants import dai
from y.contracts import Contract
Expand All @@ -28,7 +32,7 @@ def __init__(self) -> None:
@stuck_coro_debugger
async def _balances(self, address: Address, block: Optional[Block] = None) -> TokenBalances:
balances: TokenBalances = TokenBalances()
ilk = encode_single('bytes32', b'YFI-A')
ilk = encode(['bytes32'], b'YFI-A')
urn = await self._urn(address)
ink = (await self.vat.urns.coroutine(ilk, urn, block_identifier=block)).dict()["ink"]
if ink:
Expand All @@ -39,7 +43,7 @@ async def _balances(self, address: Address, block: Optional[Block] = None) -> To

@stuck_coro_debugger
async def _debt(self, address: Address, block: Optional[int] = None) -> TokenBalances:
ilk = encode_single('bytes32', b'YFI-A')
ilk = encode(['bytes32'], b'YFI-A')
urn = await self._urn(address)
urns, ilks = await asyncio.gather(
self.vat.urns.coroutine(ilk, urn, block_identifier=block),
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
checksum_dict>=1.1.2
dank_mids>=4.20.84
eth-brownie>=1.19.3,<1.20
eth-brownie>=1.19.3,<1.21
eth_retry>=0.1.15,<1
ez-a-sync>=0.18.4,<0.20
pandas>=1.4.3,<1.6
Expand Down

0 comments on commit ff92b8f

Please sign in to comment.