fix: check if contract exists before getting address (#105)

Closes: #3963
This commit is contained in:
Boris Melnik 2021-11-18 18:43:35 +03:00 committed by GitHub
parent 3f242713e9
commit b7872bc9cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -320,7 +320,10 @@ proc setPubKey*(username, pubKey, address, gas, gasPrice: string, isEIP1559Enabl
proc statusRegistrarAddress*():string =
let network = status_settings.getCurrentNetwork().toNetwork()
result = $contracts.findContract(network.chainId, "ens-usernames").address
let contract = contracts.findContract(network.chainId, "ens-usernames")
if contract != nil:
return $contract.address
result = ""
type
ENSType* {.pure.} = enum