Skip to content

Generate token lists #14979

Generate token lists

Generate token lists #14979

name: Generate token lists
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
environment:
description: 'Environment to run generation'
type: environment
default: Test
required: true
workflow_call:
inputs:
environment:
description: 'Environment to run generation'
type: string
required: true
default: 'Test'
jobs:
install:
name: 'Install'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check cache for "node_modules"
id: cache
uses: martijnhols/actions-cache/check@v3
with:
path: '**/node_modules'
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile
- name: Save "node_modules" to cache
if: steps.cache.outputs.cache-hit != 'true'
uses: martijnhols/actions-cache/save@v3
with:
path: '**/node_modules'
key: ${{ steps.cache.outputs.primary-key }}
generate-token-lists:
name: 'Generate'
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
needs: [install]
permissions:
id-token: write # need this for OIDC
contents: read # This is required for actions/checkout@v2
strategy:
max-parallel: 5
fail-fast: false
matrix:
commands:
# Arb1
- name: Arb1 FullList
paths:
- ArbTokenLists/arbed_full.json
version: false
command: yarn fullList --l2NetworkID 42161 --newArbifiedList ./src/ArbTokenLists/arbed_full.json --skipValidation
- name: Arb1 Arbify Uniswap
paths:
- ArbTokenLists/arbed_uniswap_labs.json
- ArbTokenLists/arbed_uniswap_labs_default.json
version: true
command: yarn arbify --l2NetworkID 42161 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json --tokenList https://tokens.uniswap.org --newArbifiedList ./src/ArbTokenLists/arbed_uniswap_labs.json && cp ./src/ArbTokenLists/arbed_uniswap_labs.json ./src/ArbTokenLists/arbed_uniswap_labs_default.json
# - name: Arb1 Arbify Gemini
# paths:
# - ArbTokenLists/arbed_gemini_token_list.json
# version: true
# command: yarn arbify --l2NetworkID 42161 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_gemini_token_list.json --tokenList https://www.gemini.com/uniswap/manifest.json --newArbifiedList ./src/ArbTokenLists/arbed_gemini_token_list.json
- name: Arb1 Arbify CMC
paths:
- ArbTokenLists/arbed_coinmarketcap.json
version: true
command: yarn arbify --l2NetworkID 42161 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_coinmarketcap.json --tokenList https://api.coinmarketcap.com/data-api/v3/uniswap/all.json --newArbifiedList ./src/ArbTokenLists/arbed_coinmarketcap.json
- name: Arb1 Arbify CoinGecko
paths:
- ArbTokenLists/arbed_coingecko.json
version: true
command: yarn arbify --l2NetworkID 42161 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_coingecko.json --tokenList https://tokens.coingecko.com/uniswap/all.json --newArbifiedList ./src/ArbTokenLists/arbed_coingecko.json
- name: Arb1 Update Whitelist
paths:
- ArbTokenLists/arbed_arb_whitelist_era.json
version: true
command: yarn update --l2NetworkID 42161 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_arb_whitelist_era.json --tokenList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_arb_whitelist_era.json --includeOldDataFields true --newArbifiedList ./src/ArbTokenLists/arbed_arb_whitelist_era.json
# ArbNova
- name: ArbNova Arbify Uniswap
paths:
- ArbTokenLists/42170_arbed_uniswap_labs.json
- ArbTokenLists/42170_arbed_uniswap_labs_default.json
version: true
command: yarn arbify --l2NetworkID 42170 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/42170_arbed_uniswap_labs_default.json --newArbifiedList ./src/ArbTokenLists/42170_arbed_uniswap_labs.json --tokenList https://tokens.uniswap.org && cp ./src/ArbTokenLists/42170_arbed_uniswap_labs.json ./src/ArbTokenLists/42170_arbed_uniswap_labs_default.json
# - name: ArbNova Arbify Gemini
# paths:
# - ArbTokenLists/42170_arbed_gemini_token_list.json
# version: true
# command: yarn arbify --l2NetworkID 42170 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/42170_arbed_gemini_token_list.json --tokenList https://www.gemini.com/uniswap/manifest.json --newArbifiedList ./src/ArbTokenLists/42170_arbed_gemini_token_list.json
- name: ArbNova Arbify CMC
paths:
- ArbTokenLists/42170_arbed_coinmarketcap.json
version: true
command: yarn arbify --l2NetworkID 42170 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/42170_arbed_coinmarketcap.json --tokenList https://api.coinmarketcap.com/data-api/v3/uniswap/all.json --newArbifiedList ./src/ArbTokenLists/42170_arbed_coinmarketcap.json
- name: ArbNova Arbify CoinGecko
paths:
- ArbTokenLists/42170_arbed_coingecko.json
version: true
command: yarn arbify --l2NetworkID 42170 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/42170_arbed_coingecko.json --tokenList https://tokens.coingecko.com/uniswap/all.json --newArbifiedList ./src/ArbTokenLists/42170_arbed_coingecko.json
# ArbSepolia
- name: ArbSepolia Arbify Uniswap
paths:
- ArbTokenLists/421614_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 421614 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/421614_arbed_uniswap_labs.json --tokenList https://tokens.uniswap.org --newArbifiedList ./src/ArbTokenLists/421614_arbed_uniswap_labs.json
- name: ArbSepolia Arbify CoinGecko
paths:
- ArbTokenLists/421614_arbed_coingecko.json
version: true
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
# Orbit Chains
- name: Xai Arbify Uniswap
paths:
- ArbTokenLists/660279_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 660279 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/660279_arbed_uniswap_labs.json --tokenList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json --newArbifiedList ./src/ArbTokenLists/660279_arbed_uniswap_labs.json
- name: Xai Arbify L2 native list
paths:
- ArbTokenLists/660279_arbed_native_list.json
version: true
command: yarn arbify --l2NetworkID 660279 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/660279_arbed_native_list.json --tokenList ./src/Assets/42161_arbitrum_native_token_list.json --newArbifiedList ./src/ArbTokenLists/660279_arbed_native_list.json
- name: Rari Arbify Uniswap
paths:
- ArbTokenLists/1380012617_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 1380012617 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/1380012617_arbed_uniswap_labs.json --tokenList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json --newArbifiedList ./src/ArbTokenLists/1380012617_arbed_uniswap_labs.json
- name: Rari Arbify L2 native list
paths:
- ArbTokenLists/1380012617_arbed_native_list.json
version: true
command: yarn arbify --l2NetworkID 1380012617 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/1380012617_arbed_native_list.json --tokenList ./src/Assets/42161_arbitrum_native_token_list.json --newArbifiedList ./src/ArbTokenLists/1380012617_arbed_native_list.json
- name: Muster Arbify Uniswap
paths:
- ArbTokenLists/4078_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 4078 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/4078_arbed_uniswap_labs.json --tokenList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json --newArbifiedList ./src/ArbTokenLists/4078_arbed_uniswap_labs.json
- name: Muster Arbify L2 native list
paths:
- ArbTokenLists/4078_arbed_native_list.json
version: true
command: yarn arbify --l2NetworkID 4078 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/4078_arbed_native_list.json --tokenList ./src/Assets/42161_arbitrum_native_token_list.json --newArbifiedList ./src/ArbTokenLists/4078_arbed_native_list.json
- name: Proof of Play Apex Arbify Uniswap
paths:
- ArbTokenLists/70700_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 70700 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/70700_arbed_uniswap_labs.json --tokenList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json --newArbifiedList ./src/ArbTokenLists/70700_arbed_uniswap_labs.json
- name: Proof of Play Apex Arbify L2 native list
paths:
- ArbTokenLists/70700_arbed_native_list.json
version: true
command: yarn arbify --l2NetworkID 70700 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/70700_arbed_native_list.json --tokenList ./src/Assets/42161_arbitrum_native_token_list.json --newArbifiedList ./src/ArbTokenLists/70700_arbed_native_list.json
- name: L3X Arbify Uniswap
paths:
- ArbTokenLists/12324_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 12324 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/12324_arbed_uniswap_labs.json --tokenList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json --newArbifiedList ./src/ArbTokenLists/12324_arbed_uniswap_labs.json
- name: L3X Arbify L2 native list
paths:
- ArbTokenLists/12324_arbed_native_list.json
version: true
command: yarn arbify --l2NetworkID 12324 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/12324_arbed_native_list.json --tokenList ./src/Assets/42161_arbitrum_native_token_list.json --newArbifiedList ./src/ArbTokenLists/12324_arbed_native_list.json
# Orbit Chains testnet
- name: Xai Testnet Arbify Uniswap
paths:
- ArbTokenLists/37714555429_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 37714555429 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/37714555429_arbed_uniswap_labs.json --tokenList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json --newArbifiedList ./src/ArbTokenLists/37714555429_arbed_uniswap_labs.json
- name: Dodochain Testnet Arbify Uniswap
paths:
- ArbTokenLists/53457_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 53457 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/53457_arbed_uniswap_labs.json --tokenList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json --newArbifiedList ./src/ArbTokenLists/53457_arbed_uniswap_labs.json
- name: L3X Testnet Arbify Uniswap
paths:
- ArbTokenLists/12325_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 12325 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/12325_arbed_uniswap_labs.json --tokenList https://tokenlist.arbitrum.io/ArbTokenLists/arbed_uniswap_labs.json --newArbifiedList ./src/ArbTokenLists/12325_arbed_uniswap_labs.json
env:
INFURA_KEY: '${{ secrets.INFURA_KEY }}'
MAINNET_RPC: 'https://mainnet.infura.io/v3/${{ secrets.INFURA_KEY }}'
SEPOLIA_RPC: 'https://sepolia.infura.io/v3/${{ secrets.INFURA_KEY }}'
ARB_ONE_RPC: 'https://arbitrum-mainnet.infura.io/v3/${{ secrets.INFURA_KEY }}'
ARB_SEPOLIA_RPC: 'https://arbitrum-sepolia.infura.io/v3/${{ secrets.INFURA_KEY }}'
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/restore-cache
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1-node16
with:
aws-region: 'us-west-2'
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: ${{ matrix.commands.name }}
if: success()
run: ${{ matrix.commands.command }}
- name: Get online version
id: onlineVersion
if: ${{ matrix.commands.version == true && matrix.commands.version == true }}
run: |
# Check if the list exists online (it will not exist on the first run)
if curl --silent --head --fail "https://tokenlist.arbitrum.io/${{ matrix.commands.paths[0] }}"; then
# Get the version from the online list (formatted to major.minor.patch)
version=$(curl https://tokenlist.arbitrum.io/${{ matrix.commands.paths[0] }} | jq .version | jq 'join(".")')
if [[ -n $version ]]; then
echo "onlineVersion=$version" >> $GITHUB_OUTPUT
else
# Make sure failure from curl or jq fails the generation
exit 1
fi
else
# Only applies when a new list is added
echo "onlineVersion=1.0.0" >> $GITHUB_OUTPUT
fi
- name: Backup
if: ${{ matrix.commands.version == true }}
run: |
paths=(${{ join(matrix.commands.paths, ' ') }})
for path in ${paths[*]}
do
if [[ "${{ inputs.environment }}" == "Test" ]]
then
additionalPath='TestFolder/'
else
additionalPath=''
fi
# Backup online list to {version}/{path} before deploying a new one
lines=$(aws s3 ls s3://${{ secrets.AWS_BUCKET }}/$additionalPath$path | wc -l)
if (( $lines > 0 )); then
backupCommand="aws s3 cp s3://${{ secrets.AWS_BUCKET }}/$additionalPath$path s3://${{ secrets.AWS_BUCKET }}/$additionalPath"
backupCommand+=$(echo $path | awk -F'.json' '{print $1}') # Remove .json
backupCommand+=/${{ steps.onlineVersion.outputs.onlineVersion }}.json
$backupCommand
fi
done
- name: Deploy (Test folder)
if: ${{ inputs.environment == 'Test' }}
run: aws s3 sync ./src/ s3://${{ secrets.AWS_BUCKET }}/TestFolder --exclude "*" --include "FullList/*.json" --include "ArbTokenLists/*.json"
- name: Deploy
if: ${{ inputs.environment == 'CI' }}
run: aws s3 sync ./src/ s3://${{ secrets.AWS_BUCKET }} --exclude "*" --include "FullList/*.json" --include "ArbTokenLists/*.json" --acl "public-read"
error-alerts:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
needs: [install, generate-token-lists]
# Run this job if any of the job in needs array failed
if: ${{ always() && contains(needs.*.result, 'failure') }}
steps:
- name: Post errors to Slack channel
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Token list generation failed"
}
},
{
"type": "divider"
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}