Skip to content

Commit

Permalink
cache token addresses fix (wormhole-foundation#2538)
Browse files Browse the repository at this point in the history
tokens without wrapped assets defined were not getting cached on the native chain
  • Loading branch information
kev1n-peters authored Sep 5, 2024
1 parent 30cd16a commit 11bd087
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions wormhole-connect/src/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,15 @@ export class WrappedTokenAddressCache {
this.caches = {};

// Pre-populate cache with values from built-in config
for (const key in addresses) {
const token = tokens[key];
if (!token) continue;

for (const [key, token] of Object.entries(tokens)) {
// Cache any Wormhole-wrapped tokens
const wrappedTokens = addresses[key];
for (const chain in wrappedTokens) {
const foreignAsset = wrappedTokens[chain];
const addr = WormholeV2.parseAddress(chain as Chain, foreignAsset);
this.set(key, chain as Chain, addr);
if (wrappedTokens) {
for (const chain in wrappedTokens) {
const foreignAsset = wrappedTokens[chain];
const addr = WormholeV2.parseAddress(chain as Chain, foreignAsset);
this.set(key, chain as Chain, addr);
}
}

// Cache it on its native chain too
Expand Down

0 comments on commit 11bd087

Please sign in to comment.