Merge pull request #31 from mars-protocol/v1.4.9

v1.4.9
This commit is contained in:
Linkie Link 2023-06-14 18:57:33 +02:00 committed by GitHub
commit b40979d0e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 15 deletions

View File

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

View File

@ -220,13 +220,7 @@ export const Action = ({
const calculateMaxBorrowableAmount = useMemo((): number => { const calculateMaxBorrowableAmount = useMemo((): number => {
const assetLiquidity = Number(findByDenom(marketAssetLiquidity, denom)?.amount || 0) const assetLiquidity = Number(findByDenom(marketAssetLiquidity, denom)?.amount || 0)
return maxBorrowableAmount( return maxBorrowableAmount(assetLiquidity, availableBalanceBaseCurrency, currentAssetPrice)
assetLiquidity,
availableBalanceBaseCurrency,
new BigNumber(currentAssetPrice)
.shiftedBy(baseCurrency.decimals - (currentAsset?.decimals || 0))
.toNumber(),
)
}, [ }, [
denom, denom,
availableBalanceBaseCurrency, availableBalanceBaseCurrency,
@ -254,10 +248,9 @@ export const Action = ({
if (!asset || !asset.depositBalance || !asset.denom) return 0 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. // When withdrawing, we have to remove the slippage, otherwise we can't actually hit the borrow limit.
const withdrawableAmountOfAsset = new BigNumber( const withdrawableAmountOfAsset = new BigNumber(availableBalanceBaseCurrency)
availableBalanceBaseCurrency / (1 - DEFAULT_SLIPPAGE) / (currentAssetPrice * assetLtvRatio), .div(1 - DEFAULT_SLIPPAGE)
) .div(currentAssetPrice * assetLtvRatio)
.shiftedBy(asset.decimals - baseCurrency.decimals)
.toNumber() .toNumber()
return withdrawableAmountOfAsset < assetBalanceOrAvailableLiquidity return withdrawableAmountOfAsset < assetBalanceOrAvailableLiquidity

View File

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