diff --git a/package.json b/package.json index f2e6a7c..a16d370 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "mars", "homepage": "./", - "version": "1.4.8", + "version": "1.4.9", "license": "SEE LICENSE IN LICENSE FILE", "private": false, "scripts": { diff --git a/src/components/common/TxModal/Action.tsx b/src/components/common/TxModal/Action.tsx index d78b2e8..ddad798 100644 --- a/src/components/common/TxModal/Action.tsx +++ b/src/components/common/TxModal/Action.tsx @@ -220,13 +220,7 @@ export const Action = ({ const calculateMaxBorrowableAmount = useMemo((): number => { const assetLiquidity = Number(findByDenom(marketAssetLiquidity, denom)?.amount || 0) - return maxBorrowableAmount( - assetLiquidity, - availableBalanceBaseCurrency, - new BigNumber(currentAssetPrice) - .shiftedBy(baseCurrency.decimals - (currentAsset?.decimals || 0)) - .toNumber(), - ) + return maxBorrowableAmount(assetLiquidity, availableBalanceBaseCurrency, currentAssetPrice) }, [ denom, availableBalanceBaseCurrency, @@ -254,10 +248,9 @@ export const Action = ({ if (!asset || !asset.depositBalance || !asset.denom) return 0 // When withdrawing, we have to remove the slippage, otherwise we can't actually hit the borrow limit. - const withdrawableAmountOfAsset = new BigNumber( - availableBalanceBaseCurrency / (1 - DEFAULT_SLIPPAGE) / (currentAssetPrice * assetLtvRatio), - ) - .shiftedBy(asset.decimals - baseCurrency.decimals) + const withdrawableAmountOfAsset = new BigNumber(availableBalanceBaseCurrency) + .div(1 - DEFAULT_SLIPPAGE) + .div(currentAssetPrice * assetLtvRatio) .toNumber() return withdrawableAmountOfAsset < assetBalanceOrAvailableLiquidity diff --git a/src/components/fields/ActiveVaultsTable/ActiveVaultsTableMobile.tsx b/src/components/fields/ActiveVaultsTable/ActiveVaultsTableMobile.tsx index 76cded5..6c6346b 100644 --- a/src/components/fields/ActiveVaultsTable/ActiveVaultsTableMobile.tsx +++ b/src/components/fields/ActiveVaultsTable/ActiveVaultsTableMobile.tsx @@ -153,12 +153,11 @@ export const ActiveVaultsTableMobile = () => { return content } + const route = vault.position.status === 'active' ? 'edit' : 'close' return (
{content}