Skip to content

Commit

Permalink
Add uniswap list for base and base sepolia
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx committed Dec 13, 2024
1 parent 2c6d5b1 commit 2812bd5
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 17 deletions.
50 changes: 33 additions & 17 deletions .github/scripts/generateMatrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const arbitrumCommands: Command[] = [
paths: ['ArbTokenLists/arbed_full.json'],
version: false,
command:
'npm run fullList --l2NetworkID 42161 --newArbifiedList ./src/ArbTokenLists/arbed_full.json --skipValidation',
'yarn fullList --l2NetworkID 42161 --newArbifiedList ./src/ArbTokenLists/arbed_full.json --skipValidation',
},
{
name: 'Arb1 Arbify Uniswap',
Expand Down Expand Up @@ -94,6 +94,21 @@ const arbitrumCommands: Command[] = [
command:
'yarn arbify --l2NetworkID 421614 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/421614_arbed_coingecko.json --tokenList https://tokens.coingecko.com/uniswap/all.json --newArbifiedList ./src/ArbTokenLists/421614_arbed_coingecko.json',
},
// Base
{
name: 'Base Uniswap',
paths: ['ArbTokenLists/8453_uniswap_labs.json'],
version: true,
command:
'yarn arbify --l2NetworkID 8453 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/8453_uniswap_labs.json --tokenList https://tokens.uniswap.org --newArbifiedList ./src/ArbTokenLists/8453_uniswap_labs.json',
},
{
name: 'Base Sepolia Uniswap',
paths: ['ArbTokenLists/84532_uniswap_labs.json'],
version: true,
command:
'yarn arbify --l2NetworkID 84532 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/84532_uniswap_labs.json --tokenList https://tokens.uniswap.org --newArbifiedList ./src/ArbTokenLists/84532_uniswap_labs.json',
},
];

const orbitCommands: Command[] = [];
Expand Down Expand Up @@ -128,22 +143,23 @@ async function addCommand({
}

function getUniswapTokenListFromPartnerChainId(chainId: number) {
return (
{
// L1
1: 'https://tokens.uniswap.org',
11155111: 'https://tokens.uniswap.org',
17000: 'https://tokens.uniswap.org',
// Arbitrum
42161:
'https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json',
42170:
'https://tokenlist.arbitrum.io/ArbTokenLists/42170_arbed_uniswap_labs.json',
421614:
'https://tokenlist.arbitrum.io/ArbTokenLists/421614_arbed_uniswap_labs.json',
// Base
}[chainId] ?? 'https://tokens.uniswap.org'
);
return {
// L1
1: 'https://tokens.uniswap.org',
11155111: 'https://tokens.uniswap.org',
17000: 'https://tokens.uniswap.org',
// Arbitrum
42161:
'https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json',
42170:
'https://tokenlist.arbitrum.io/ArbTokenLists/42170_arbed_uniswap_labs.json',
421614:
'https://tokenlist.arbitrum.io/ArbTokenLists/421614_arbed_uniswap_labs.json',
// Base
8453: 'https://tokenlist.arbitrum.io/ArbTokenLists/8453_uniswap_labs.json',
84532:
'https://tokenlist.arbitrum.io/ArbTokenLists/84532_uniswap_labs.json',
}[chainId];
}
const l1ChainIds = [1, 11155111, 17000]; // Mainnet, sepolia, holesky
(async () => {
Expand Down
23 changes: 23 additions & 0 deletions src/lib/token_list_gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,29 @@ export const arbifyL1List = async (
const prevArbTokenList = ignorePreviousList
? null
: await getPrevList(prevArbifiedList);

// We can't arbify token list for base, we filter out non-base tokens from uniswap list
const argv = getArgvs();
if (argv.l2NetworkID === 8453 || argv.l2NetworkID === 84532) {
const tokens = l1TokenList.tokens
.filter((token) => token.chainId === argv.l2NetworkID)
.map(({ extensions, ...token }) => ({
...token,
}));

const version = getVersion(prevArbTokenList, tokens);
return {
newList: {
...l1TokenList,
name: `Uniswap labs ${argv.l2NetworkID}`,
timestamp: new Date().toISOString(),
version,
tokens,
},
l1ListName: l1TokenList.name,
};
}

const newList = await generateTokenList(l1TokenList, prevArbTokenList, {
includeAllL1Tokens: false,
includeOldDataFields,
Expand Down

0 comments on commit 2812bd5

Please sign in to comment.