Skip to content

Commit

Permalink
fix: Fix token price fallback issue
Browse files Browse the repository at this point in the history
  • Loading branch information
wenty22 committed Jan 24, 2025
1 parent a9738d2 commit 06bd8b1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 5 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
// "**/node_modules": true,
// "**/.next": true,
"**/node_modules": true,
"**/.next": true,
"**/*.log": true,
// "**/dist": true,
// "**/.rush": true,
// "**/temp": true,
"**/dist": true,
"**/.rush": true,
"**/temp": true,
"**/tsconfig.tsbuildinfo": true
},
"[typescript]": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ export class BridgeProcessor extends WorkerHost {

async fetchDeBridge() {
const config = await this.web3Service.getDebridgeChains();

if (!config) return;

const tokenMap: Record<string, IDeBridgeToken[]> = {};

for (const chain of config.chains) {
const data = await this.web3Service.getDebridgeChainTokens(chain.chainId);
tokenMap[chain.chainId] = Object.values(data.tokens);
if (data) {
tokenMap[chain.chainId] = Object.values(data.tokens);
}
}

const data = { chains: config.chains, tokens: tokenMap };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,9 @@ export class TokenService {

const cmcPrices = await this.cache.get(`${CACHE_KEY.CMC_CONFIG_V2}`);
const llamaPrices = await this.cache.get(`${CACHE_KEY.CMC_CONFIG_V2}`);
const key = `1:${tokenSymbol}`;
const key = `1:${tokenSymbol?.toLowerCase()}`;

return cmcPrices?.[key] ?? llamaPrices?.[key];
const price = cmcPrices?.[key]?.price ?? llamaPrices?.[key]?.price;
return price;
}
}

0 comments on commit 06bd8b1

Please sign in to comment.