Activated ENS on other Ethereum-compatible chains

This commit is contained in:
Alexandre Paillier
2023-06-16 15:52:43 +02:00
parent 34ea137c1a
commit c8360741a4
3 changed files with 9 additions and 2 deletions

View File

@@ -92,3 +92,7 @@ const char *get_network_ticker_from_chain_id(const uint64_t *chain_id) {
}
return PIC(net->ticker);
}
bool chain_is_ethereum_compatible(const uint64_t *chain_id) {
return get_network_from_chain_id(chain_id) != NULL;
}

View File

@@ -7,4 +7,6 @@
const char *get_network_name_from_chain_id(const uint64_t *chain_id);
const char *get_network_ticker_from_chain_id(const uint64_t *chain_id);
bool chain_is_ethereum_compatible(const uint64_t *chain_id);
#endif // _NETWORK_H_

View File

@@ -10,6 +10,7 @@
#include "challenge.h"
#include "mem.h"
#include "hash_bytes.h"
#include "network.h"
static const uint8_t DOMAIN_NAME_PUB_KEY[] = {
#ifdef HAVE_DOMAIN_NAME_TEST_KEY
@@ -124,8 +125,8 @@ bool has_domain_name(const uint64_t *chain_id, const uint8_t *addr) {
bool ret = false;
if (g_domain_name_info.valid) {
// TODO: Remove once other domain name providers are supported
if ((*chain_id == ETHEREUM_MAINNET_CHAINID) &&
// Check if chain ID is known to be Ethereum-compatible (same derivation path)
if ((chain_is_ethereum_compatible(chain_id)) &&
(memcmp(addr, g_domain_name_info.addr, ADDRESS_LENGTH) == 0)) {
ret = true;
}