Skip to content

Commit 1dce1e0

Browse files
Darya KavianiDarya Kaviani
authored andcommitted
use promise.all
1 parent 4a5382c commit 1dce1e0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/frontend/src/state/lp/hooks.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ export const useClosePosition = () => {
9494
)
9595
return
9696

97-
const shortAmount = fromTokenAmount(vaultBefore.shortAmount, OSQUEETH_DECIMALS)
98-
const debtInEth = await getDebtAmount(shortAmount)
99-
const collateralToFlashloan = debtInEth.multipliedBy(COLLAT_RATIO)
100-
const limitEth = await getQuote(shortAmount, true)
97+
const shortAmount = fromTokenAmount(vaultBefore.shortAmount, OSQUEETH_DECIMALS)
98+
const debtInEthPromise = getDebtAmount(shortAmount)
99+
const limitEthPromise = getQuote(shortAmount, true)
100+
const [debtInEth, limitEth] = await Promise.all([debtInEthPromise, limitEthPromise])
101+
const collateralToFlashloan = debtInEth.multipliedBy(COLLAT_RATIO)
101102

102103
const flashloanCloseVaultLpNftParam = {
103104
vaultId: vaultId,

0 commit comments

Comments
 (0)