Skip to content

Commit

Permalink
use promise.all
Browse files Browse the repository at this point in the history
  • Loading branch information
Darya Kaviani authored and Darya Kaviani committed Jul 16, 2022
1 parent 4a5382c commit 1dce1e0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/frontend/src/state/lp/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ export const useClosePosition = () => {
)
return

const shortAmount = fromTokenAmount(vaultBefore.shortAmount, OSQUEETH_DECIMALS)
const debtInEth = await getDebtAmount(shortAmount)
const collateralToFlashloan = debtInEth.multipliedBy(COLLAT_RATIO)
const limitEth = await getQuote(shortAmount, true)
const shortAmount = fromTokenAmount(vaultBefore.shortAmount, OSQUEETH_DECIMALS)
const debtInEthPromise = getDebtAmount(shortAmount)
const limitEthPromise = getQuote(shortAmount, true)
const [debtInEth, limitEth] = await Promise.all([debtInEthPromise, limitEthPromise])
const collateralToFlashloan = debtInEth.multipliedBy(COLLAT_RATIO)

const flashloanCloseVaultLpNftParam = {
vaultId: vaultId,
Expand Down

0 comments on commit 1dce1e0

Please sign in to comment.