From 59c0faa195d4ff486abe58dfcf09e4d73ffea862 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Mon, 1 Jul 2024 16:46:48 +0100 Subject: [PATCH] tweak FET calculation (#26) * As of July 1st, use fixed ratios instead of FET market price as the markets for OCEAN & AGIX are limited * migration contracts guarantee fixed rate so no need for market rates for OCEAN/FET or AGIX/FET --- features/strategies/components/Swap/Results.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/features/strategies/components/Swap/Results.tsx b/features/strategies/components/Swap/Results.tsx index 5e61639..ac80214 100644 --- a/features/strategies/components/Swap/Results.tsx +++ b/features/strategies/components/Swap/Results.tsx @@ -34,11 +34,20 @@ export function SwapResults({ isLoadingToOcean } = useQuote(tokenSymbol, amount, isUniswap) - const amountInUsd = - amount * prices[tokenSymbol.toLowerCase() as keyof Prices].usd + const tokenSelected = tokenSymbol.toLowerCase() as keyof Prices + + const amountInUsd = amount * prices[tokenSelected].usd const amountToOcean = amountInUsd / prices.ocean.usd const amountToAgix = amountInUsd / prices.agix.usd - const amountToFet = amountInUsd / prices.fet.usd + + // As of July 1st, use fixed ratios instead of FET market price + // as the markets for OCEAN & AGIX are limited + const amountToFet = + tokenSelected === 'ocean' + ? amount * ratioOceanToAsi + : tokenSelected === 'agix' + ? amount * ratioAgixToAsi + : amount return ( <>