This commit is contained in:
Georges KABBOUCHI 2021-08-05 20:50:45 +03:00
parent 8a52b5d20e
commit 067544d391

View File

@ -6,7 +6,7 @@
<template #icon <template #icon
><IconCurrency :currency="rootTokenKey" class="w-20 h-20" noHeight ><IconCurrency :currency="rootTokenKey" class="w-20 h-20" noHeight
/></template> /></template>
<template #value>{{ formatNumber(balance) }} {{ symbol }}</template> <template #value>{{ formatNumber(originalBalance) }} {{ symbol }}</template>
</SidebarSectionValueWithIcon> </SidebarSectionValueWithIcon>
<div class="bg-[#C5CCE1] bg-opacity-[0.15] mt-10 p-8"> <div class="bg-[#C5CCE1] bg-opacity-[0.15] mt-10 p-8">
@ -98,16 +98,17 @@ export default defineComponent({
const { networkName, account } = useWeb3() const { networkName, account } = useWeb3()
const { dsa } = useDSA() const { dsa } = useDSA()
const { getTokenByKey, valInt } = useToken() const { getTokenByKey, valInt } = useToken()
const { fetchBalances } = useBalances()
const { formatNumber, formatUsdMax, formatUsd } = useFormatting() const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
const { isZero, gt, plus, max, minus } = useBigNumber() const { isZero, gt, plus, max, minus } = useBigNumber()
const { parseSafeFloat } = useParsing() const { parseSafeFloat } = useParsing()
const { showPendingTransaction } = useNotification() const { showPendingTransaction } = useNotification()
const originalBalance = ref('0')
const { stats, status, displayPositions, maxLiquidation, liquidationPrice, liquidationMaxPrice } = useAaveV2Position({ const { stats, status, displayPositions, maxLiquidation, liquidationPrice, liquidationMaxPrice } = useAaveV2Position({
overridePosition: (position) => { overridePosition: (position) => {
if (rootTokenKey.value !== position.key) return position if (rootTokenKey.value !== position.key) return position
originalBalance.value = position.supply
return { return {
...position, ...position,
supply: max(minus(position.supply, amountParsed.value), '0').toFixed(), supply: max(minus(position.supply, amountParsed.value), '0').toFixed(),
@ -149,7 +150,7 @@ export default defineComponent({
: null : null
return { return {
amount: { message: validateAmount(amountParsed.value, balance.value), show: hasAmountValue }, amount: { message: validateAmount(amountParsed.value, originalBalance.value), show: hasAmountValue },
liquidation: { message: liqValid, show: hasAmountValue }, liquidation: { message: liqValid, show: hasAmountValue },
auth: { message: validateIsLoggedIn(!!account.value), show: true }, auth: { message: validateIsLoggedIn(!!account.value), show: true },
liquidity: { liquidity: {
@ -196,6 +197,7 @@ export default defineComponent({
rootTokenKey, rootTokenKey,
token, token,
symbol, symbol,
originalBalance,
balance, balance,
formatNumber, formatNumber,
formatUsdMax, formatUsdMax,