Hls text fixes (#667)
* 🐛 incorrect vault values calc * 🐛 incorrect message for no balance in wallet hls * 🐛 hls message on keep leverage * update to correct wasm files * update to correct wasm files
This commit is contained in:
parent
c8be254fb0
commit
f5034a095f
@ -19,7 +19,7 @@ import {
|
|||||||
getDepositCapMessage,
|
getDepositCapMessage,
|
||||||
getHealthFactorMessage,
|
getHealthFactorMessage,
|
||||||
getLiquidityMessage,
|
getLiquidityMessage,
|
||||||
getNoBalanceMessage,
|
getNoBalanceInWalletMessage,
|
||||||
} from 'utils/messages'
|
} from 'utils/messages'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -69,7 +69,7 @@ export default function useAccordionItems(props: Props) {
|
|||||||
const collateralWarningMessages = useMemo(() => {
|
const collateralWarningMessages = useMemo(() => {
|
||||||
const messages: string[] = []
|
const messages: string[] = []
|
||||||
if (!props.walletCollateralAsset?.amount) {
|
if (!props.walletCollateralAsset?.amount) {
|
||||||
messages.push(getNoBalanceMessage(props.collateralAsset.symbol))
|
messages.push(getNoBalanceInWalletMessage(props.collateralAsset.symbol))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.depositAmount.isGreaterThan(depositCapLeft)) {
|
if (props.depositAmount.isGreaterThan(depositCapLeft)) {
|
||||||
|
@ -25,7 +25,7 @@ import {
|
|||||||
getDepositCapMessage,
|
getDepositCapMessage,
|
||||||
getHealthFactorMessage,
|
getHealthFactorMessage,
|
||||||
getLiquidityMessage,
|
getLiquidityMessage,
|
||||||
getNoBalanceMessage,
|
getNoBalanceInWalletMessage,
|
||||||
} from 'utils/messages'
|
} from 'utils/messages'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -87,7 +87,7 @@ export default function Deposit(props: Props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (collateralAssetAmountInWallet.isZero()) {
|
if (collateralAssetAmountInWallet.isZero()) {
|
||||||
messages.push(getNoBalanceMessage(props.collateralAsset.symbol))
|
messages.push(getNoBalanceInWalletMessage(props.collateralAsset.symbol))
|
||||||
}
|
}
|
||||||
|
|
||||||
return messages
|
return messages
|
||||||
|
@ -11,7 +11,7 @@ import useStore from 'store'
|
|||||||
import { BNCoin } from 'types/classes/BNCoin'
|
import { BNCoin } from 'types/classes/BNCoin'
|
||||||
import { byDenom } from 'utils/array'
|
import { byDenom } from 'utils/array'
|
||||||
import { BN } from 'utils/helpers'
|
import { BN } from 'utils/helpers'
|
||||||
import { getNoBalanceMessage } from 'utils/messages'
|
import { getNoBalanceInWalletMessage } from 'utils/messages'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
account: Account
|
account: Account
|
||||||
@ -83,7 +83,7 @@ export default function Repay(props: Props) {
|
|||||||
|
|
||||||
const warningMessages = useMemo(() => {
|
const warningMessages = useMemo(() => {
|
||||||
if (borrowAssetAmountInWallet.isZero()) {
|
if (borrowAssetAmountInWallet.isZero()) {
|
||||||
return [getNoBalanceMessage(props.borrowAsset.symbol)]
|
return [getNoBalanceInWalletMessage(props.borrowAsset.symbol)]
|
||||||
}
|
}
|
||||||
return []
|
return []
|
||||||
}, [borrowAssetAmountInWallet, props.borrowAsset.symbol])
|
}, [borrowAssetAmountInWallet, props.borrowAsset.symbol])
|
||||||
|
@ -56,15 +56,17 @@ export default function useHealthComputer(account?: Account) {
|
|||||||
base_coin: {
|
base_coin: {
|
||||||
amount: '0', // Not used by healthcomputer
|
amount: '0', // Not used by healthcomputer
|
||||||
denom: curr.denoms.lp,
|
denom: curr.denoms.lp,
|
||||||
value: curr.amounts.unlocking.times(baseCoinPrice).integerValue().toString(),
|
value: curr.amounts.unlocking
|
||||||
|
.plus(curr.amounts.unlocked)
|
||||||
|
.times(baseCoinPrice)
|
||||||
|
.integerValue()
|
||||||
|
.toString(),
|
||||||
},
|
},
|
||||||
vault_coin: {
|
vault_coin: {
|
||||||
amount: '0', // Not used by healthcomputer
|
amount: '0', // Not used by healthcomputer
|
||||||
denom: curr.denoms.vault,
|
denom: curr.denoms.vault,
|
||||||
value: curr.values.primary
|
value: curr.values.primary
|
||||||
.plus(curr.values.secondary)
|
.plus(curr.values.secondary)
|
||||||
.plus(curr.values.unlocking)
|
|
||||||
.plus(curr.values.unlocked)
|
|
||||||
.shiftedBy(VALUE_SCALE_FACTOR + 6) // Need to scale additional 6 to correct for uusd values
|
.shiftedBy(VALUE_SCALE_FACTOR + 6) // Need to scale additional 6 to correct for uusd values
|
||||||
.integerValue()
|
.integerValue()
|
||||||
.toString(),
|
.toString(),
|
||||||
|
Binary file not shown.
@ -4,6 +4,10 @@ export function getNoBalanceMessage(symbol: string) {
|
|||||||
return `You don't have an ${symbol} balance in your account.`
|
return `You don't have an ${symbol} balance in your account.`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function getNoBalanceInWalletMessage(symbol: string) {
|
||||||
|
return `You don't have any ${symbol} in your wallet.`
|
||||||
|
}
|
||||||
|
|
||||||
export function getDepositCapMessage(
|
export function getDepositCapMessage(
|
||||||
denom: string,
|
denom: string,
|
||||||
amount: BigNumber,
|
amount: BigNumber,
|
||||||
@ -30,5 +34,5 @@ export function getHealthFactorMessage(
|
|||||||
return `You cannot ${action} more than ${formatAmountWithSymbol({
|
return `You cannot ${action} more than ${formatAmountWithSymbol({
|
||||||
denom,
|
denom,
|
||||||
amount: amount.toString(),
|
amount: amount.toString(),
|
||||||
})}, as it will result in a health factor lower than 1.`
|
})}, as it will likely result in a health factor lower than 1.`
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user