Merge pull request #1034 from moonstream-to/fix-is-contract

Icorrect response from getCode will set is_contract to zero.
pull/1036/head
Andrey Dolgolev 2024-03-20 18:47:32 +02:00 zatwierdzone przez GitHub
commit e243442f5c
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 7 dodań i 1 usunięć

Wyświetl plik

@ -949,8 +949,14 @@ def check_if_smart_contract(
web3_client = connect(blockchain_type, user_token=user_token)
is_contract = False
try:
code = web3_client.eth.getCode(address)
except Exception as e:
logger.warning(
f"Error while getting code of address: {e} in blockchain: {blockchain_type}"
)
code = b""
code = web3_client.eth.getCode(address)
if code != b"":
is_contract = True