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
This commit is contained in:
Matthias Kretschmann 2024-07-01 16:46:48 +01:00 committed by GitHub
parent 10f6ceb1f2
commit 59c0faa195
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 (
<>