Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak FET calculation #26

Merged
merged 1 commit into from
Jul 1, 2024
Merged
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
15 changes: 12 additions & 3 deletions features/strategies/components/Swap/Results.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
Expand Down