add flash loan fee to swap review

This commit is contained in:
saml33 2024-03-04 21:47:28 +11:00
parent 08f20147e4
commit 83e6dea660
7 changed files with 36 additions and 0 deletions

View File

@ -556,6 +556,15 @@ const SwapReviewRouteInfo = ({
)
}, [inputBank, outputBank, outputTokenInfo, selectedRoute])
const flashLoanFee = useMemo(() => {
if (!inputBank || !outputBank) return 0
const rate = Math.max(
inputBank.flashLoanSwapFeeRate,
outputBank.flashLoanSwapFeeRate,
)
return amountIn.mul(rate).toNumber()
}, [amountIn, inputBank, outputBank])
const coinGeckoPriceDifference = useMemo(() => {
return amountOut?.toNumber()
? amountIn
@ -775,6 +784,21 @@ const SwapReviewRouteInfo = ({
: `${(selectedRoute?.priceImpactPct * 100).toFixed(2)}%`}
</p>
</div>
<div className="flex justify-between">
<Tooltip content={t('swap:tooltip-flash-loan-fee')}>
<p className="tooltip-underline">{t('swap:flash-loan-fee')}</p>
</Tooltip>
<p className="text-right font-mono text-sm text-th-fgd-2">
<FormatNumericValue
value={flashLoanFee}
decimals={inputBank?.mintDecimals}
/>{' '}
<span className="font-body text-th-fgd-3">
{inputBank?.name}
</span>
</p>
</div>
<div className="flex justify-between">
<Tooltip
content={

View File

@ -9,6 +9,7 @@
"est-liq-price": "Est. Liq Price",
"est-received": "Est. Received",
"fees-paid-to": "Fees Paid to {{route}}",
"flash-loan-fee": "Flash Loan Fee",
"health-impact": "Health Impact",
"hide-fees": "Hide Fees",
"hide-swap-history": "Hide Swap History",
@ -52,6 +53,7 @@
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
"tooltip-favorite-swap-add": "Add pair to favorites",
"tooltip-favorite-swap-remove": "Remove pair from favorites",
"tooltip-flash-loan-fee": "",
"tooltip-price-chart-source": "Price history by birdeye",
"tooltip-wallet-swap": "When enabled, you'll swap tokens in your wallet. When disabled, you'll swap tokens in your Mango Account.",
"trigger-beta": "Trigger orders are in beta",

View File

@ -9,6 +9,7 @@
"est-liq-price": "Est. Liq Price",
"est-received": "Est. Received",
"fees-paid-to": "Fees Paid to {{route}}",
"flash-loan-fee": "Flash Loan Fee",
"health-impact": "Health Impact",
"hide-fees": "Hide Fees",
"hide-swap-history": "Hide Swap History",
@ -52,6 +53,7 @@
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
"tooltip-favorite-swap-add": "Add pair to favorites",
"tooltip-favorite-swap-remove": "Remove pair from favorites",
"tooltip-flash-loan-fee": "",
"tooltip-price-chart-source": "Price history by birdeye",
"tooltip-wallet-swap": "When enabled, you'll swap tokens in your wallet. When disabled, you'll swap tokens in your Mango Account.",
"trigger-beta": "Trigger orders are in beta",

View File

@ -9,6 +9,7 @@
"est-liq-price": "Preço Est. de Liq.",
"est-received": "Est. Recebido",
"fees-paid-to": "Taxas Pagas a {{route}}",
"flash-loan-fee": "Flash Loan Fee",
"health-impact": "Impacto na Saúde",
"hide-fees": "Ocultar Taxas",
"hide-swap-history": "Ocultar Histórico de Trocas",
@ -52,6 +53,7 @@
"tooltip-max-slippage": "Se o preço escorregar além da sua derrapagem máxima, sua troca não será executada",
"tooltip-favorite-swap-add": "Adicionar par aos favoritos",
"tooltip-favorite-swap-remove": "Remover par dos favoritos",
"tooltip-flash-loan-fee": "",
"tooltip-price-chart-source": "Histórico de preços por birdeye",
"tooltip-wallet-swap": "Quando ativado, você trocará tokens na sua carteira. Quando desativado, você trocará tokens na sua Conta Mango.",
"trigger-beta": "Ordens de gatilho estão em beta",

View File

@ -9,6 +9,7 @@
"est-liq-price": "Est. Liq Price",
"est-received": "Est. Received",
"fees-paid-to": "Fees Paid to {{route}}",
"flash-loan-fee": "Flash Loan Fee",
"health-impact": "Health Impact",
"hide-fees": "Hide Fees",
"hide-swap-history": "Hide Swap History",
@ -52,6 +53,7 @@
"tooltip-max-slippage": "If price slips beyond your maximum slippage your swap will not be executed",
"tooltip-favorite-swap-add": "Add pair to favorites",
"tooltip-favorite-swap-remove": "Remove pair from favorites",
"tooltip-flash-loan-fee": "",
"tooltip-price-chart-source": "Price history by birdeye",
"tooltip-wallet-swap": "When enabled, you'll swap tokens in your wallet. When disabled, you'll swap tokens in your Mango Account.",
"trigger-beta": "Trigger orders are in beta",

View File

@ -9,6 +9,7 @@
"est-liq-price": "预计清算价格",
"est-received": "预计收到",
"fees-paid-to": "缴给{{route}}的费用",
"flash-loan-fee": "Flash Loan Fee",
"health-impact": "健康影响",
"hide-fees": "隐藏费用",
"hide-swap-history": "隐藏换币纪录",
@ -54,6 +55,7 @@
"tooltip-max-slippage": "如果价格下滑超过您的最大滑点,换币交易将不会被执行",
"tooltip-favorite-swap-add": "将币对加入收藏夹",
"tooltip-favorite-swap-remove": "从收藏夹移除币对",
"tooltip-flash-loan-fee": "",
"tooltip-wallet-swap": "启用后,换币会在你的钱包中执行。 停用后换币会在你的Mango帐户中执行。",
"tooltip-price-chart-source": "价格纪录由birdeye提供",
"trigger-beta": "触发订单还在开发中。请小心一点。",

View File

@ -9,6 +9,7 @@
"est-liq-price": "預計清算價格",
"est-received": "預計收到",
"fees-paid-to": "繳給{{route}}的費用",
"flash-loan-fee": "Flash Loan Fee",
"health-impact": "健康影響",
"hide-fees": "隱藏費用",
"hide-swap-history": "隱藏換幣紀錄",
@ -54,6 +55,7 @@
"tooltip-max-slippage": "如果價格下滑超過您的最大滑點,換幣交易將不會被執行",
"tooltip-favorite-swap-add": "將幣對加入收藏夾",
"tooltip-favorite-swap-remove": "從收藏夾移除幣對",
"tooltip-flash-loan-fee": "",
"tooltip-wallet-swap": "啟用後,換幣會在你的錢包中執行。 停用後換幣會在你的Mango帳戶中執行。",
"tooltip-price-chart-source": "價格紀錄由birdeye提供",
"trigger-beta": "觸發訂單還在開發中。請小心一點。",