Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/api/src/api/controllers/metrics.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const zeroVolume = (key: string, keyName: "day" | "month"): any => ({
});

async function getMonthlyVolumes(): Promise<MonthlyVolume[]> {
const cacheKey = `monthly`;
const cacheKey = "monthly";
const cached = cache.get<MonthlyVolume[]>(cacheKey);
if (cached) return cached;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class DistributeFeesHandler extends BasePhaseHandler {
logger.info(`Found existing distribute fee hash for ramp ${state.id}: ${existingHash}`);

const status = await this.checkExtrinsicStatus(existingHash).catch((_: unknown) => {
throw this.createRecoverableError(`Failed to check extrinsic status`);
throw this.createRecoverableError("Failed to check extrinsic status");
});

if (status === ExtrinsicStatus.Success) {
Expand Down
25 changes: 23 additions & 2 deletions apps/api/src/api/services/priceFeed.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
EvmToken,
getPendulumDetails,
getTokenOutAmount,
getTokenUsdPrice,
isFiatToken,
normalizeTokenSymbol,
PENDULUM_USDC_AXL,
Expand Down Expand Up @@ -488,6 +489,16 @@ export class PriceFeedService {
}

private async convertUsdToCrypto(amount: string, toCurrency: RampCurrency, decimals: number): Promise<string> {
// Try dynamic token price first
const dynamicPrice = getTokenUsdPrice(toCurrency);
if (dynamicPrice !== undefined && dynamicPrice > 0) {
const result = new Big(amount).div(dynamicPrice).toFixed(decimals);
logger.debug(`Converted ${amount} USD to ${result} ${toCurrency} using dynamic price: ${dynamicPrice}`);
return result;
}

// Fall back to CoinGecko
logger.debug(`No dynamic price for ${toCurrency}, falling back to CoinGecko`);
const tokenId = this.getCoinGeckoTokenId(toCurrency);
if (!tokenId) {
throw new Error(`No CoinGecko token ID mapping for ${toCurrency}`);
Expand All @@ -499,19 +510,29 @@ export class PriceFeedService {
}

const result = new Big(amount).div(cryptoPriceUSD).toFixed(decimals);
logger.debug(`Converted ${amount} USD to ${result} ${toCurrency} using price: ${cryptoPriceUSD}`);
logger.debug(`Converted ${amount} USD to ${result} ${toCurrency} using CoinGecko price: ${cryptoPriceUSD}`);
return result;
}

private async convertCryptoToUsd(amount: string, fromCurrency: RampCurrency, decimals: number): Promise<string> {
// Try dynamic token price first
const dynamicPrice = getTokenUsdPrice(fromCurrency);
if (dynamicPrice !== undefined && dynamicPrice > 0) {
const result = new Big(amount).mul(dynamicPrice).toFixed(decimals);
logger.debug(`Converted ${amount} ${fromCurrency} to ${result} USD using dynamic price: ${dynamicPrice}`);
return result;
}

// Fall back to CoinGecko
logger.debug(`No dynamic price for ${fromCurrency}, falling back to CoinGecko`);
const tokenId = this.getCoinGeckoTokenId(fromCurrency);
if (!tokenId) {
throw new Error(`No CoinGecko token ID mapping for ${fromCurrency}`);
}

const cryptoPriceUSD = await this.getCryptoPrice(tokenId, "usd");
const result = new Big(amount).mul(cryptoPriceUSD).toFixed(decimals);
logger.debug(`Converted ${amount} ${fromCurrency} to ${result} USD using price: ${cryptoPriceUSD}`);
logger.debug(`Converted ${amount} ${fromCurrency} to ${result} USD using CoinGecko price: ${cryptoPriceUSD}`);
return result;
}
}
Expand Down
2 changes: 2 additions & 0 deletions apps/api/src/api/services/quote/core/squidrouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ export function getTokenDetailsForEvmDestination(
});
}

console.log("Getting token details for:", finalOutputCurrency, "on network:", network);

const tokenDetails = getOnChainTokenDetails(network, finalOutputCurrency);

if (!tokenDetails || !isEvmTokenDetails(tokenDetails)) {
Expand Down
5 changes: 4 additions & 1 deletion apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dotenv.config({
path: [path.resolve(process.cwd(), ".env"), path.resolve(process.cwd(), "../.env")]
});

import { ApiManager, EvmClientManager, setLogger } from "@vortexfi/shared";
import { ApiManager, EvmClientManager, initializeEvmTokens, setLogger } from "@vortexfi/shared";
import { config, testDatabaseConnection } from "./config";
import cryptoService from "./config/crypto";
import app from "./config/express";
Expand Down Expand Up @@ -53,6 +53,9 @@ const initializeApp = async () => {
// Initialize RSA keys for webhook signing
cryptoService.initializeKeys();

// Initialize dynamic EVM tokens from SquidRouter API (falls back to static config on failure)
await initializeEvmTokens();

// Test database connection
await testDatabaseConnection();

Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"@tanstack/react-query": "^5.64.2",
"@tanstack/react-router": "^1.136.8",
"@tanstack/react-router-devtools": "^1.136.8",
"@tanstack/react-virtual": "^3.13.18",
"@tanstack/zod-adapter": "^1.144.0",
"@types/crypto-js": "^4.2.2",
"@vitejs/plugin-react": "^4.3.4",
Expand All @@ -56,6 +57,7 @@
"react-hook-form": "^7.65.0",
"react-i18next": "^15.4.1",
"react-toastify": "^11.0.5",
"react-window": "^2.2.5",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"stellar-sdk": "catalog:",
"tailwind-merge": "^3.1.0",
"tailwindcss": "^4.0.3",
Expand Down
38 changes: 0 additions & 38 deletions apps/frontend/src/assets/coins/DOT_ASSETHUB.svg

This file was deleted.

13 changes: 0 additions & 13 deletions apps/frontend/src/assets/coins/ETH.svg

This file was deleted.

37 changes: 0 additions & 37 deletions apps/frontend/src/assets/coins/ETH_ARBITRUM.svg

This file was deleted.

30 changes: 0 additions & 30 deletions apps/frontend/src/assets/coins/ETH_BASE.svg

This file was deleted.

37 changes: 0 additions & 37 deletions apps/frontend/src/assets/coins/ETH_BSC.svg

This file was deleted.

30 changes: 0 additions & 30 deletions apps/frontend/src/assets/coins/ETH_ETHEREUM.svg

This file was deleted.

Binary file removed apps/frontend/src/assets/coins/USDC.png
Binary file not shown.
Loading
Loading