Skip to content

Commit

Permalink
feat: add ens contract to token list (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
marthendalnunes authored Apr 12, 2024
1 parent c466546 commit 0aa3ee1
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
14 changes: 14 additions & 0 deletions packages/token-list/src/default-token-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,20 @@
}
}
},
{
"chainId": 1,
"address": "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85",
"name": "Ethereum Name Service",
"symbol": "ENS",
"logoURI": "https://assets.coingecko.com/nft_contracts/images/373/small_2x/ens-ethereum-name-service.png",
"extensions": {
"bridgeInfo": {
"8453": {
"tokenAddress": "0x3828727c3FD3D1A9F8692a457C8a80a3DBA16546"
}
}
}
},
{
"chainId": 1,
"address": "0x60E4d786628Fea6478F785A6d7e704777c86a7c6",
Expand Down
21 changes: 14 additions & 7 deletions packages/token-list/src/tests/valid-erc721s.test.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
import { expect, test } from "vitest";
import { type Address, erc721Abi } from "viem";
import { multicall } from "@wagmi/core";
import { erc721Abi, type Address } from "viem";
import { expect, test } from "vitest";
import { optimismMintableErc721FactoryAbi } from "../config/abis/optimism-mintable-erc721-factory-abi.js";
import {
l2ChainIds,
l2ChainIdsTestnet,
config,
l1ChainIdsTestnet,
l2ChainIds,
l2ChainIdsTestnet,
} from "../config/wagmi.js";
import { testnetTokenList, defaultTokenList } from "../index.js";
import { defaultTokenList, testnetTokenList } from "../index.js";

const OptimismMintableERC721FactoryAddress =
"0x4200000000000000000000000000000000000017";

// Production token list

test("Tokens are valid ERC721s", async () => {

// Removes ENS addresses from the default token list,
// since they don't have a name or symbol
const ENSMainnetAddress = "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85";
const filteredTokens = defaultTokenList.tokens.filter(
({ address }) => address !== ENSMainnetAddress,
);
const [names, symbols] = await Promise.all([
// Fetch the name of all tokens in the default token list
multicall(config, {
contracts: defaultTokenList.tokens.map(({ address }) => ({
contracts: filteredTokens.map(({ address }) => ({
address: address as Address,
abi: erc721Abi,
functionName: "name",
})),
}),
// Fetch the symbol of all tokens in the default token list
multicall(config, {
contracts: defaultTokenList.tokens.map(({ address }) => ({
contracts: filteredTokens.map(({ address }) => ({
address: address as Address,
abi: erc721Abi,
functionName: "symbol",
Expand Down

0 comments on commit 0aa3ee1

Please sign in to comment.