Skip to content

Commit

Permalink
multichain
Browse files Browse the repository at this point in the history
  • Loading branch information
bokkypoobah committed Dec 22, 2023
1 parent a394b67 commit 963fb30
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 43 deletions.
22 changes: 11 additions & 11 deletions docs/deploymentData.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 33 additions & 32 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ <h5 class="mt-3">Troubleshooting</h5>
}
}
const ensReverseRecordsContract = new ethers.Contract(ENSREVERSERECORDSADDRESS, ENSREVERSERECORDSABI, provider);
const erc721Helper = new ethers.Contract(ERC721HELPERADDRESS, ERC721HELPERABI, provider);
// const erc721Helper = new ethers.Contract(ERC721HELPERADDRESS, ERC721HELPERABI, provider);
this.sync.completed = 0;
this.sync.total = Object.keys(newAccountsMap).length;
this.sync.section = 'Addresses';
Expand All @@ -963,36 +963,34 @@ <h5 class="mt-3">Troubleshooting</h5>
accountData.decimals = CUSTOMNAMES[account].length >= 4 ? CUSTOMNAMES[account][3] : undefined;
} else {
let accountType = null;
let symbol = undefined;
let name = undefined;
let decimals = undefined;
let totalSupply = undefined;
const code = await provider.getCode(account);
console.log(account + " => " + code.length);
if (code.length == 2) {
accountType = "eoa";
}
const erc165Contract = new ethers.Contract(account, erc165Abi, provider);
if (!accountType) {
try {
const result = await erc165Contract.supportsInterface(ERC721_INTERFACE);
if (result) {
accountType = "erc721";
} else {
const erc165Contract = new ethers.Contract(account, erc165Abi, provider);
if (!accountType) {
try {
const result = await erc165Contract.supportsInterface(ERC721_INTERFACE);
if (result) {
accountType = "erc721";
}
} catch (e1) {
}
} catch (e1) {
}
}
if (!accountType) {
try {
const result = await erc165Contract.supportsInterface(ERC1155_INTERFACE);
if (result) {
accountType = "erc1155";
if (!accountType) {
try {
const result = await erc165Contract.supportsInterface(ERC1155_INTERFACE);
if (result) {
accountType = "erc1155";
}
} catch (e1) {
}
} catch (e1) {
}
}
let symbol = undefined;
let name = undefined;
let decimals = undefined;
let totalSupply = undefined;
const erc20Contract = new ethers.Contract(account, ERC20ABI, provider);
if (accountType != "eoa") {
const erc20Contract = new ethers.Contract(account, ERC20ABI, provider);
try {
symbol = await erc20Contract.symbol();
} catch (e1) {
Expand All @@ -1010,11 +1008,11 @@ <h5 class="mt-3">Troubleshooting</h5>
} catch (e1) {
}
}
console.log(account + " => " + code.length + " " + accountType + ", symbol: " + symbol + ", name: " + name + ", decimals: " + decimals + ", totalSupply: " + totalSupply);
console.log(account + " => code.length: " + code.length + ", accountType: " + accountType + ", symbol: " + symbol + ", name: " + name + ", decimals: " + decimals + ", totalSupply: " + totalSupply);
if (!accountType && decimals && totalSupply) {
accountType = "erc20";
accountData.decimals = decimals;
accountData.totalSupply = totalSupply;
accountData.decimals = parseInt(decimals);
accountData.totalSupply = totalSupply.toString();
}
accountData.type = accountType || "unknown";
accountData.symbol = symbol;
Expand Down Expand Up @@ -1065,11 +1063,14 @@ <h5 class="mt-3">Troubleshooting</h5>
accounts[this.chainId][account] = accountData;
this.sync.completed++;
}
for (const [account, accountData] of Object.entries(accounts[this.chainId])) {
if (!(["erc20", "erc721", "erc1155", "ftexchange", "nftexchange"].includes(accountData.type)) && !(account in CUSTOMNAMES)) {
const allnames = await ensReverseRecordsContract.getNames([account]);
if (allnames.length >= 0 && allnames[0].length > 0) {
accounts[this.chainId][account].name = allnames[0];
// ETH Mainnet ENS
if (this.chainId == 1) {
for (const [account, accountData] of Object.entries(accounts[this.chainId])) {
if (!(["erc20", "erc721", "erc1155", "ftexchange", "nftexchange"].includes(accountData.type)) && !(account in CUSTOMNAMES)) {
const allnames = await ensReverseRecordsContract.getNames([account]);
if (allnames.length >= 0 && allnames[0].length > 0) {
accounts[this.chainId][account].name = allnames[0];
}
}
}
}
Expand Down

0 comments on commit 963fb30

Please sign in to comment.