Skip to content

Commit

Permalink
update to 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 d1f565f commit 10a4d27
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/frontend/src/state/lp/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ export const useOpenPositionDeposit = () => {
async (squeethToMint: BigNumber, lowerTickInput: number, upperTickInput: number, vaultId: number, onTxConfirmed?: () => void) => {
if (!contract || !address) return null

const squeethPrice = await getTwapSqueethPrice()
const mintWSqueethAmount = fromTokenAmount(squeethToMint, OSQUEETH_DECIMALS)
const ethDebt = await getDebtAmount(mintWSqueethAmount)
const squeethPricePromise = getTwapSqueethPrice()
const ethDebtPromise = getDebtAmount(mintWSqueethAmount)
const [squeethPrice, ethDebt] = await Promise.all([squeethPricePromise, ethDebtPromise])

const collateralToMint = ethDebt.multipliedBy(COLLAT_RATIO)
const collateralToLp = mintWSqueethAmount.multipliedBy(squeethPrice)
Expand Down

0 comments on commit 10a4d27

Please sign in to comment.