diff --git a/src/components/Modals/BorrowModal.tsx b/src/components/Modals/BorrowModal.tsx
index 823b1a68..a526c0f2 100644
--- a/src/components/Modals/BorrowModal.tsx
+++ b/src/components/Modals/BorrowModal.tsx
@@ -107,7 +107,7 @@ function BorrowModal(props: Props) {
)
const overpayExeedsCap = useMemo(() => {
- const marketAsset = markets.find(byDenom(asset.denom))
+ const marketAsset = markets.find((market) => market.asset.denom === asset.denom)
if (!marketAsset) return
const overpayAmount = totalDebtRepayAmount.minus(totalDebt)
const marketCapAfterOverpay = marketAsset.cap.used.plus(overpayAmount)
diff --git a/src/components/Modals/FundWithdraw/WithdrawFromAccount.tsx b/src/components/Modals/FundWithdraw/WithdrawFromAccount.tsx
index 9488088a..d7c31755 100644
--- a/src/components/Modals/FundWithdraw/WithdrawFromAccount.tsx
+++ b/src/components/Modals/FundWithdraw/WithdrawFromAccount.tsx
@@ -51,9 +51,8 @@ export default function WithdrawFromAccount(props: Props) {
const accountLent = account.lends.find(byDenom(currentAsset.denom))?.amount ?? BN_ZERO
const shouldReclaim = amount.isGreaterThan(accountDeposit) && !accountLent.isZero()
const isReclaimingMaxAmount = accountLent.isLessThanOrEqualTo(amount.minus(accountDeposit))
- const reclaimAmount = isReclaimingMaxAmount
- ? amount
- : accountLent.minus(amount).minus(accountDeposit)
+
+ const reclaimAmount = isReclaimingMaxAmount ? amount : amount.minus(accountDeposit)
function onChangeAmount(val: BigNumber) {
setAmount(val)
diff --git a/src/components/Modals/ModalContentWithSummary.tsx b/src/components/Modals/ModalContentWithSummary.tsx
index cd0ef2a9..c06dfbda 100644
--- a/src/components/Modals/ModalContentWithSummary.tsx
+++ b/src/components/Modals/ModalContentWithSummary.tsx
@@ -5,7 +5,6 @@ import AccountSummary from 'components/account/AccountSummary'
import Card from 'components/common/Card'
import { CircularProgress } from 'components/common/CircularProgress'
import Modal, { ModalProps } from 'components/Modals/Modal'
-import useStore from 'store'
interface Props extends ModalProps {
isHls?: boolean
@@ -36,7 +35,6 @@ function modalContent(content: React.ReactNode, isContentCard?: boolean, account
}
export default function ModalContentWithSummary(props: Props) {
- const updatedAccount = useStore((s) => s.updatedAccount)
return (
{props.subHeader && props.subHeader}
{modalContent(props.content, props.isContentCard, props.account)}
- {props.account && (
-
- )}
+ {props.account && }
)
}
diff --git a/src/components/account/AccountBalancesTable/Columns/Apy.tsx b/src/components/account/AccountBalancesTable/Columns/Apy.tsx
index 68e40cf0..a57baa6e 100644
--- a/src/components/account/AccountBalancesTable/Columns/Apy.tsx
+++ b/src/components/account/AccountBalancesTable/Columns/Apy.tsx
@@ -1,5 +1,4 @@
import AssetRate from 'components/common/assets/AssetRate'
-import { byDenom } from 'utils/array'
export const APY_META = { accessorKey: 'apy', header: 'APY', meta: { className: 'w-30' } }
@@ -14,7 +13,8 @@ export default function Apr(props: Props) {
const { markets, type, denom, apy } = props
if (apy === 0) return
–
- const isEnabled = markets.find(byDenom(denom))?.borrowEnabled ?? false
+ const isEnabled =
+ markets.find((market) => market.asset.denom === props.denom)?.borrowEnabled ?? false
return (
, b: Row getAmountChangeColor(type, amountChange), [amountChange, type])
if (type === 'vault') return –
-
- const color = getAmountChangeColor(type, amountChange)
const className = classNames('text-xs text-right', color)
const allowZero = !amountChange.isZero()
@@ -47,6 +47,7 @@ export default function Size(props: Props) {
const formattedAmount = formatAmountToPrecision(size, MAX_AMOUNT_DECIMALS)
const minimumAmount = allowZero ? 0 : MIN_AMOUNT
const lowAmount = formattedAmount === 0 ? minimumAmount : Math.max(formattedAmount, MIN_AMOUNT)
+
return (
strategy.denoms.deposit === asset.denom)?.apy ?? 0
: 0
const prevDeposit = updatedAccount ? account?.deposits.find(byDenom(deposit.denom)) : deposit
+
deposits.push(
getAssetAccountBalanceRow('deposit', asset, prices, assets, deposit, apy, prevDeposit),
)
diff --git a/src/components/account/AccountFund/AccountFundContent.tsx b/src/components/account/AccountFund/AccountFundContent.tsx
index 7232639a..4a5294d6 100644
--- a/src/components/account/AccountFund/AccountFundContent.tsx
+++ b/src/components/account/AccountFund/AccountFundContent.tsx
@@ -128,7 +128,7 @@ export default function AccountFundContent(props: Props) {
const depositCapReachedCoins = useMemo(() => {
const depositCapReachedCoins: BNCoin[] = []
fundingAssets.forEach((asset) => {
- const marketAsset = markets.find(byDenom(asset.denom))
+ const marketAsset = markets.find((market) => market.asset.denom === asset.denom)
if (!marketAsset) return
const capLeft = getCapLeftWithBuffer(marketAsset.cap)
diff --git a/src/components/common/Select/Option.tsx b/src/components/common/Select/Option.tsx
index 893fa043..34cb5dc1 100644
--- a/src/components/common/Select/Option.tsx
+++ b/src/components/common/Select/Option.tsx
@@ -9,7 +9,6 @@ import { BN_ZERO } from 'constants/math'
import useAsset from 'hooks/assets/useAsset'
import useMarkets from 'hooks/markets/useMarkets'
import { BNCoin } from 'types/classes/BNCoin'
-import { byDenom } from 'utils/array'
import { formatValue } from 'utils/formatters'
interface Props extends SelectOption {
@@ -33,7 +32,7 @@ export default function Option(props: Props) {
if (isCoin) {
const balance = props.amount ?? BN_ZERO
- const marketAsset = markets.find(byDenom(props.denom || ''))
+ const marketAsset = markets.find((market) => market.asset.denom === props.denom)
if (!asset || !marketAsset) return null
diff --git a/src/components/common/TokenInput/index.tsx b/src/components/common/TokenInput/index.tsx
index b88619b3..f1e50e5f 100644
--- a/src/components/common/TokenInput/index.tsx
+++ b/src/components/common/TokenInput/index.tsx
@@ -54,7 +54,7 @@ export default function TokenInput(props: Props) {
diff --git a/src/components/trade/TradeModule/SwapForm/index.tsx b/src/components/trade/TradeModule/SwapForm/index.tsx
index bf28bd54..e6c70ebe 100644
--- a/src/components/trade/TradeModule/SwapForm/index.tsx
+++ b/src/components/trade/TradeModule/SwapForm/index.tsx
@@ -63,7 +63,8 @@ export default function SwapForm(props: Props) {
inputAsset.denom,
outputAsset.denom,
)
- const isBorrowEnabled = !!markets.find(byDenom(inputAsset.denom))?.borrowEnabled
+ const isBorrowEnabled = !!markets.find((market) => market.asset.denom === inputAsset.denom)
+ ?.borrowEnabled
const isRepayable = !!account?.debts.find(byDenom(outputAsset.denom))
const [isMarginChecked, setMarginChecked] = useToggle(isBorrowEnabled ? useMargin : false)
const [isAutoRepayChecked, setAutoRepayChecked] = useToggle(
@@ -85,7 +86,7 @@ export default function SwapForm(props: Props) {
const assets = useMarketEnabledAssets()
const depositCapReachedCoins: BNCoin[] = useMemo(() => {
- const outputMarketAsset = markets.find(byDenom(outputAsset.denom))
+ const outputMarketAsset = markets.find((market) => market.asset.denom === outputAsset.denom)
if (!outputMarketAsset) return []