Skip to content

Commit 2776686

Browse files
chrisli30claude
andauthored
fix: rebuild token whitelists from studio catalog with complete metadata (#532)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1f9cf95 commit 2776686

5 files changed

Lines changed: 369 additions & 929 deletions

File tree

core/taskengine/token_metadata.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,26 @@ func (t *TokenEnrichmentService) LoadWhitelist() error {
188188
return fmt.Errorf("failed to parse whitelist file %s: %w", whitelistPath, err)
189189
}
190190

191-
// Load tokens into cache (normalize addresses to lowercase)
191+
// Load tokens into cache (normalize addresses to lowercase). Surface
192+
// malformed entries (empty id, decimals=0) at startup rather than letting
193+
// them silently degrade balance lookups — once cached, GetTokenMetadata
194+
// short-circuits the RPC fallback that would otherwise fix the metadata.
192195
t.cacheMux.Lock()
196+
skipped := 0
193197
for _, token := range tokens {
194198
normalizedAddr := strings.ToLower(token.Id)
199+
if normalizedAddr == "" {
200+
skipped++
201+
if t.logger != nil {
202+
t.logger.Warn("Whitelist entry missing id, skipping",
203+
"file", whitelistPath, "name", token.Name, "symbol", token.Symbol)
204+
}
205+
continue
206+
}
207+
if token.Decimals == 0 && t.logger != nil {
208+
t.logger.Warn("Whitelist entry has decimals=0; balance lookups will use 0-decimal formatting unless populated",
209+
"file", whitelistPath, "id", normalizedAddr, "symbol", token.Symbol)
210+
}
195211
t.cache[normalizedAddr] = &TokenMetadata{
196212
Id: normalizedAddr,
197213
Name: token.Name,
@@ -206,6 +222,8 @@ func (t *TokenEnrichmentService) LoadWhitelist() error {
206222
t.logger.Debug("Loaded token whitelist",
207223
"file", whitelistPath,
208224
"tokenCount", len(tokens),
225+
"loaded", len(tokens)-skipped,
226+
"skipped", skipped,
209227
"chainID", t.chainID)
210228
}
211229

token_whitelist/base-sepolia.json

Lines changed: 13 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,26 @@
11
[
22
{
3-
"name": "Tea Token",
4-
"symbol": "TEA",
5-
"address": "0x87C51CD469A0E1E2aF0e0e597fD88D9Ae4BaA967"
3+
"name": "Chainlink",
4+
"symbol": "LINK",
5+
"decimals": 18,
6+
"id": "0xe4ab69c077896252fafbd49efd26b5d171a32410"
67
},
78
{
8-
"name": "Wrapped fake liquid staked Ether 2.0",
9-
"symbol": "wstETH",
10-
"address": "0x13e5FB0B6534BB22cBC59Fae339dbBE0Dc906871"
11-
},
12-
{
13-
"name": "Circle Fake USD",
9+
"name": "USD Coin",
1410
"symbol": "USDC",
15-
"address": "0xf7464321dE37BdE4C03AAeeF6b1e7b71379A9a64"
16-
},
17-
{
18-
"name": "Staked TEA",
19-
"symbol": "stTEA",
20-
"address": "0xa8cB1964ea7f9674Ac6EC2Bc87D386380bE264F8"
21-
},
22-
{
23-
"name": "Bond ETH",
24-
"symbol": "bondETH",
25-
"address": "0x5Bd36745f6199CF32d2465Ef1F8D6c51dCA9BdEE"
26-
},
27-
{
28-
"name": "Levered ETH",
29-
"symbol": "levETH",
30-
"address": "0x98f665D98a046fB81147879eCBE9A6fF68BC276C"
31-
},
32-
{
33-
"name": "SOGNI testnet token V1.0.2",
34-
"symbol": "tSOGNI",
35-
"address": "0xF0593d8dBb5D443156F782d89C6978CB4D8205D6"
36-
},
37-
{
38-
"name": "Bond ETH",
39-
"symbol": "BondETH",
40-
"address": "0x3EB4b2c7D235fE915E3A0eF6BE73FD458Bb891F4"
41-
},
42-
{
43-
"name": "USDG",
44-
"symbol": "USDG",
45-
"address": "0xD4fA4dE9D8F8DB39EAf4de9A19bF6910F6B5bD60"
46-
},
47-
{
48-
"name": "Leverage ETH",
49-
"symbol": "LevETH",
50-
"address": "0x8EE92Ce1caF5848d7a54672fC4320E4f92748643"
51-
},
52-
{
53-
"name": "Angry Dynomites Lab - Badges",
54-
"symbol": "BADGES",
55-
"address": "0x187F4cF75d86810fC9c9dDa1bc4B6Fd86c98158B"
56-
},
57-
{
58-
"name": "Black Pass",
59-
"symbol": "BP",
60-
"address": "0x5878e492fba20F47884841d093b79d259B5B799B"
61-
},
62-
{
63-
"name": "Coinbase Wrapped Fake Staked ETH",
64-
"symbol": "cbETH",
65-
"address": "0x1197766B82Eee9c2e57674E53F0D961590e43769"
66-
},
67-
{
68-
"name": "USDC",
69-
"symbol": "USDC",
70-
"address": "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
71-
},
72-
{
73-
"name": "Bond ETH",
74-
"symbol": "bondETH",
75-
"address": "0x1aC493C87a483518642f320Ba5b342c7b78154ED"
76-
},
77-
{
78-
"name": "Ethereum",
79-
"symbol": "ETH",
80-
"address": "0x464C8ec100F2F42fB4e42E07E203DA2324f9FC67"
81-
},
82-
{
83-
"name": "Ethena USD",
84-
"symbol": "USDe",
85-
"address": "0x28356C7B6087EebaFd1023D292eA9F5327e8F215"
11+
"decimals": 6,
12+
"id": "0x036cbd53842c5426634e7929541ec2318f3dcf7e"
8613
},
8714
{
8815
"name": "Tether USD",
8916
"symbol": "USDT",
90-
"address": "0xd7e9C75C6C05FdE929cAc19bb887892de78819B7"
91-
},
92-
{
93-
"name": "Levered ETH",
94-
"symbol": "levETH",
95-
"address": "0x975f67319f9DA83B403309108d4a8f84031538A6"
17+
"decimals": 6,
18+
"id": "0xce8565457cca0fc7542608a2c78610ed7bc66c8c"
9619
},
9720
{
98-
"name": "TAO Token",
99-
"symbol": "TAO",
100-
"address": "0x67025805e2431921C8359A0E1C0c514cFF5fcFDB"
21+
"name": "Wrapped Ether",
22+
"symbol": "WETH",
23+
"decimals": 18,
24+
"id": "0x4200000000000000000000000000000000000006"
10125
}
10226
]

0 commit comments

Comments
 (0)