Lesson 13 Await vs wait() #4584
-
Hello everyone, I'm on Lesson 13 and I need simple explanation regarding const approveTx = await erc20.approve(spender, amount)
await approveTx.wait(1) Is totally clear, but why in our await approveERC20(AMOUNT, lendingPool.address, wethAddress, deployer)
await lendingPool.deposit(wethAddress, AMOUNT, deployer, 0)
await borrowDai(networkConfig[network.config.chainId].daiToken, lendingPool, amountDaiToBorrowWei, deployer) And last question is regarding missing txResponse = await erc20Token.approve(spenderAddress, amount)
await txResponse.wait(1) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
@Neftyr
And about the |
Beta Was this translation helpful? Give feedback.
@Neftyr
wait
we use with transactions which wait for the number of block confirmations we specified in it.await
we use in front of function calls which perform asynchronous calls inside. This allows the function to complete before our code moves down the line.And about the
const
, this variable must be defined somewhere before use.