Skip to content

Commit

Permalink
the rest
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler committed Apr 24, 2024
1 parent 8d0000a commit 17fbcdf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions y/contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ def is_contract(address: AnyAddressType) -> bool:
address = convert.to_address(address)
return web3.eth.get_code(address) not in ['0x',b'']

@a_sync.a_sync(default='sync', cache_type='memory')
@a_sync.a_sync(default='sync', ram_cache_ttl=ENVS.CACHE_TTL)
async def has_method(address: Address, method: str, return_response: bool = False) -> Union[bool,Any]:
'''
Checks to see if a contract has a `method` view method with no inputs.
Expand All @@ -398,7 +398,7 @@ async def has_method(address: Address, method: str, return_response: bool = Fals
raise

@stuck_coro_debugger
@a_sync.a_sync(default='sync', cache_type='memory', ram_cache_ttl=15*60)
@a_sync.a_sync(default='sync', ram_cache_ttl=ENVS.CACHE_TTL)
async def has_methods(
address: AnyAddressType,
methods: Tuple[str],
Expand All @@ -419,7 +419,7 @@ async def has_methods(
# Out of gas error implies one or more method is state-changing.
# If `_func == all` we return False because `has_methods` is only supposed to work for public view methods with no inputs
# If `_func == any` maybe one of the methods will work without "out of gas" error
return False if _func == all else any(await asyncio.gather(*[has_method(address, method, sync=False) for method in methods]))
return False if _func == all else await a_sync.map(has_method, methods, address=address).any(sync=False)


#yLazyLogger(logger)
Expand Down

0 comments on commit 17fbcdf

Please sign in to comment.