Skip to content

Commit

Permalink
fix: unpacking err
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Sep 28, 2023
1 parent 205974e commit e2fe7a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
9 changes: 4 additions & 5 deletions y/prices/dex/uniswap/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,11 +367,10 @@ async def pools(self) -> Dict[Address,Dict[Address,Address]]:
async def get_pools_for(self, token_in: Address) -> Dict[UniswapV2Pool, Address]:
pool_to_token_out = {}
for pool, params in (await self.__pools__(sync=False)).items():
token0, token1, stable = params.values()
if token_in == token0:
pool_to_token_out[UniswapV2Pool(pool, asynchronous=self.asynchronous)] = token1
if token_in == token1:
pool_to_token_out[UniswapV2Pool(pool, asynchronous=self.asynchronous)] = token0
if token_in == params['token0']:
pool_to_token_out[UniswapV2Pool(pool, asynchronous=self.asynchronous)] = params['token1']
if token_in == params['token1']:
pool_to_token_out[UniswapV2Pool(pool, asynchronous=self.asynchronous)] = params['token0']
return pool_to_token_out

async def pools_for_token(self, token_address: Address, block: Optional[Block] = None, _ignore_pools: Tuple[UniswapV2Pool,...] = ()) -> Dict[UniswapV2Pool, Address]:
Expand Down
11 changes: 0 additions & 11 deletions y/prices/dex/velodrome.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,6 @@ async def get_pool(self, input_token: Address, output_token: Address, stable: bo
if await dank_w3.eth.get_code(str(pool_address), block_identifier=block) not in ['0x',b'']:
return UniswapV2Pool(pool_address, asynchronous=self.asynchronous)

@a_sync.a_sync(ram_cache_maxsize=None)
async def get_pools_for(self, token_in: Address) -> Dict[UniswapV2Pool, Address]:
pool_to_token_out = {}
for pool, params in (await self.__pools__(sync=False)).items():
token0, token1, stable = params.values()
if token_in == token0:
pool_to_token_out[UniswapV2Pool(pool, asynchronous=self.asynchronous)] = token1
if token_in == token1:
pool_to_token_out[UniswapV2Pool(pool, asynchronous=self.asynchronous)] = token0
return pool_to_token_out

@a_sync.aka.cached_property
async def pools(self) -> Dict[Address, Dict[Address,Address]]:
logger.info('Fetching pools for %s on %s. If this is your first time using ypricemagic, this can take a while. Please wait patiently...', self.label, Network.printable())
Expand Down

0 comments on commit e2fe7a3

Please sign in to comment.