diff --git a/components/WithdrawModal.tsx b/components/WithdrawModal.tsx index 68d47d6..a64e7db 100644 --- a/components/WithdrawModal.tsx +++ b/components/WithdrawModal.tsx @@ -160,31 +160,12 @@ const WithdrawModal = ({ isOpen, onClose }) => { } } - const DECIMALS = { - BTC: 4, - ETH: 3, - USDT: 2, - } - const getBorrowAmount = () => { const tokenBalance = getMaxForSelectedAccount() const borrowAmount = parseFloat(inputAmount) - tokenBalance return borrowAmount > 0 ? borrowAmount : 0 } - const getInterestCostPerYear = () => { - const borrowAmount = getBorrowAmount() - const interestRate = selectedMangoGroup.getBorrowRate(tokenIndex) - const symbol = getSymbolForTokenMintAddress( - selectedAccount?.account?.mint.toString() - ) - if (borrowAmount > 0) { - const borrowCostPerYear = borrowAmount * interestRate - return `~${borrowCostPerYear.toFixed(DECIMALS[symbol])} ${symbol}` - } - return `0 ${symbol}` - } - if (!selectedAccount) return null return ( @@ -202,8 +183,8 @@ const WithdrawModal = ({ isOpen, onClose }) => { />
- Include Borrow - + Borrow Funds + @@ -246,23 +227,13 @@ const WithdrawModal = ({ isOpen, onClose }) => { {includeBorrow ? (
-
Loan Amount
-
{`${getBorrowAmount().toFixed( - DECIMALS[ - getSymbolForTokenMintAddress( - selectedAccount?.account?.mint.toString() - ) - ] - )} ${getSymbolForTokenMintAddress( +
Borrow Amount
+
{`${getBorrowAmount()} ${getSymbolForTokenMintAddress( selectedAccount?.account?.mint.toString() )}`}
-
-
Yearly Loan Cost
-
{getInterestCostPerYear()}
-
-
Interest Rate
+
Current APR
{(selectedMangoGroup.getBorrowRate(tokenIndex) * 100).toFixed( 2