mirror of
https://github.com/Instadapp/assembly.git
synced 2024-07-29 22:37:06 +00:00
payback fixes
This commit is contained in:
parent
7b558c52f1
commit
a9878a1baa
|
|
@ -113,7 +113,7 @@ export default defineComponent({
|
||||||
const { getTokenByKey, valInt } = useToken()
|
const { getTokenByKey, valInt } = useToken()
|
||||||
const { getBalanceByKey, getBalanceRawByKey, fetchBalances } = useBalances()
|
const { getBalanceByKey, getBalanceRawByKey, fetchBalances } = useBalances()
|
||||||
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
const { formatNumber, formatUsdMax, formatUsd } = useFormatting()
|
||||||
const { isZero, gt, plus, max, minus } = useBigNumber()
|
const { isZero, gte, plus, max, minus, min } = useBigNumber()
|
||||||
const { parseSafeFloat } = useParsing()
|
const { parseSafeFloat } = useParsing()
|
||||||
const { showPendingTransaction } = useNotification()
|
const { showPendingTransaction } = useNotification()
|
||||||
const tokenId = computed(() => props.tokenId)
|
const tokenId = computed(() => props.tokenId)
|
||||||
|
|
@ -122,7 +122,7 @@ export default defineComponent({
|
||||||
const rootTokenKey = computed(() => ctokens[networkName.value].rootTokens.includes(tokenKey.value) ? tokenKey.value : 'eth')
|
const rootTokenKey = computed(() => ctokens[networkName.value].rootTokens.includes(tokenKey.value) ? tokenKey.value : 'eth')
|
||||||
|
|
||||||
|
|
||||||
const { status, displayPositions, liquidation, liquidationPrice, liquidationMaxPrice } = useCompoundPosition({
|
const { status, position, displayPositions, liquidation, liquidationPrice, liquidationMaxPrice } = useCompoundPosition({
|
||||||
overridePosition: (position) => {
|
overridePosition: (position) => {
|
||||||
if (tokenId.value !== position.cTokenId) return position
|
if (tokenId.value !== position.cTokenId) return position
|
||||||
|
|
||||||
|
|
@ -137,7 +137,7 @@ export default defineComponent({
|
||||||
const amountParsed = computed(() => parseSafeFloat(amount.value))
|
const amountParsed = computed(() => parseSafeFloat(amount.value))
|
||||||
|
|
||||||
const currentPosition = computed(() =>
|
const currentPosition = computed(() =>
|
||||||
displayPositions.value.find((position) => position.cTokenId === tokenId.value)
|
position.value.data.find((position) => position.cTokenId === tokenId.value)
|
||||||
)
|
)
|
||||||
|
|
||||||
const token = computed(() => getTokenByKey(rootTokenKey.value))
|
const token = computed(() => getTokenByKey(rootTokenKey.value))
|
||||||
|
|
@ -152,14 +152,17 @@ export default defineComponent({
|
||||||
|
|
||||||
const address = computed(() => token.value?.address)
|
const address = computed(() => token.value?.address)
|
||||||
|
|
||||||
const { toggle, isMaxAmount } = useMaxAmountActive(amount, balance)
|
|
||||||
|
|
||||||
const { validateAmount, validateLiquidation, validateLiquidity, validateIsLoggedIn } = useValidators()
|
const maxBalance = computed(() => min(balance.value, tokenMaxBalance.value).toFixed())
|
||||||
|
const { toggle, isMaxAmount } = useMaxAmountActive(amount, maxBalance)
|
||||||
|
|
||||||
|
const { validateAmount, validateLiquidation, validateIsLoggedIn } = useValidators()
|
||||||
const errors = computed(() => {
|
const errors = computed(() => {
|
||||||
const hasAmountValue = !isZero(amount.value)
|
const hasAmountValue = !isZero(amount.value)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
amount: { message: validateAmount(amountParsed.value), show: hasAmountValue },
|
|
||||||
|
amount: { message: validateAmount(amountParsed.value, maxBalance.value), show: hasAmountValue },
|
||||||
liquidation: { message: validateLiquidation(status.value, liquidation.value), show: hasAmountValue },
|
liquidation: { message: validateLiquidation(status.value, liquidation.value), show: hasAmountValue },
|
||||||
auth: { message: validateIsLoggedIn(!!account.value), show: true },
|
auth: { message: validateIsLoggedIn(!!account.value), show: true },
|
||||||
}
|
}
|
||||||
|
|
@ -179,8 +182,6 @@ export default defineComponent({
|
||||||
|
|
||||||
const spells = dsa.value.Spell()
|
const spells = dsa.value.Spell()
|
||||||
|
|
||||||
const rateMode = rateType.value?.rateMode
|
|
||||||
|
|
||||||
spells.add({
|
spells.add({
|
||||||
connector: 'compound',
|
connector: 'compound',
|
||||||
method: 'payback',
|
method: 'payback',
|
||||||
|
|
@ -213,7 +214,10 @@ export default defineComponent({
|
||||||
formatUsdMax,
|
formatUsdMax,
|
||||||
formatUsd,
|
formatUsd,
|
||||||
toggle,
|
toggle,
|
||||||
|
displayPositions,
|
||||||
|
currentPosition,
|
||||||
isMaxAmount,
|
isMaxAmount,
|
||||||
|
liquidation,
|
||||||
liquidationPrice,
|
liquidationPrice,
|
||||||
liquidationMaxPrice,
|
liquidationMaxPrice,
|
||||||
errorMessages,
|
errorMessages,
|
||||||
|
|
|
||||||
|
|
@ -126,9 +126,6 @@ export function useCompoundPosition(
|
||||||
stats.ethSupplied = supply;
|
stats.ethSupplied = supply;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(key, supply, borrow, priceInEth, factor);
|
|
||||||
|
|
||||||
|
|
||||||
stats.totalSupplyInEth = plus(
|
stats.totalSupplyInEth = plus(
|
||||||
stats.totalSupplyInEth,
|
stats.totalSupplyInEth,
|
||||||
times(supply, priceInEth)
|
times(supply, priceInEth)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import SidebarWithdraw from '~/components/sidebar/context/SidebarWithdraw.vue'
|
||||||
import SidebarCompoundWithdraw from '~/components/sidebar/context/compound/SidebarCompoundWithdraw.vue'
|
import SidebarCompoundWithdraw from '~/components/sidebar/context/compound/SidebarCompoundWithdraw.vue'
|
||||||
import SidebarCompoundSupply from '~/components/sidebar/context/compound/SidebarCompoundSupply.vue'
|
import SidebarCompoundSupply from '~/components/sidebar/context/compound/SidebarCompoundSupply.vue'
|
||||||
import SidebarCompoundBorrow from '~/components/sidebar/context/compound/SidebarCompoundBorrow.vue'
|
import SidebarCompoundBorrow from '~/components/sidebar/context/compound/SidebarCompoundBorrow.vue'
|
||||||
import SidebarCompoundPayback from '~/components/sidebar/context/compound/SidebarCompoundBorrow.vue'
|
import SidebarCompoundPayback from '~/components/sidebar/context/compound/SidebarCompoundPayback.vue'
|
||||||
|
|
||||||
|
|
||||||
const sidebars = {
|
const sidebars = {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user