This commit is contained in:
Linkie Link 2023-06-12 23:28:10 +02:00
parent 50a82990e2
commit 8f0bce94a0
No known key found for this signature in database
GPG Key ID: 5318B0F2564D38EA
3 changed files with 7 additions and 15 deletions

View File

@ -1,7 +1,7 @@
{
"name": "mars",
"homepage": "./",
"version": "1.4.8",
"version": "1.4.9",
"license": "SEE LICENSE IN LICENSE FILE",
"private": false,
"scripts": {

View File

@ -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

View File

@ -153,12 +153,11 @@ export const ActiveVaultsTableMobile = () => {
return content
}
const route = vault.position.status === 'active' ? 'edit' : 'close'
return (
<Link
key={`${vault.address}-${i}`}
href={`/farm/vault/${vault.address}/${
vault.position.status === 'active' ? 'edit' : 'close'
}`}
href={`/farm/vault/${vault.address}/account/${vault.position.accountId}/${route}`}
className={styles.link}
>
<div>{content}</div>