-
Notifications
You must be signed in to change notification settings - Fork 17
308 lines (274 loc) · 15.8 KB
/
generate-token-lists.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
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
# SX Network
- name: SX Network Arbify Uniswap
paths:
- ArbTokenLists/4162_arbed_uniswap_labs.json
version: true
command: yarn arbify --l2NetworkID 4162 --prevArbifiedList https://tokenlist.arbitrum.io/ArbTokenLists/4162_arbed_uniswap_labs.json --newArbifiedList ./src/ArbTokenLists/4162_arbed_uniswap_labs.json --tokenList https://tokens.uniswap.org
# 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
# 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
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 }}'
L2_GATEWAY_SUBGRAPH_URL: '${{ secrets.L2_GATEWAY_SUBGRAPH_URL }}'
L2_GATEWAY_SEPOLIA_SUBGRAPH_URL: '${{ secrets.L2_GATEWAY_SEPOLIA_SUBGRAPH_URL }}'
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 }}