PatrickAlphaC / hardhat-smartcontract-lottery-fcc

MIT License
117 stars 182 forks source link

Test case: picks a winner, resets, and sends money #155

Closed Timi-T closed 1 year ago

Timi-T commented 1 year ago

I had a challenge where the vrfCoordinatorV2Mock.fulfillRandomWords() function in the new Promise reverted but there was no error to indicate that on the console. The transaction simply timed out. I solved it by adding a try catch block to catch any transaction errors in the promise and log it to the console.

For more context, the cause of the bug was that I funded the subscription account with an integer 1 rather than a big number ethers.utils.parseEther("1"). This caused the transaction to revert with InsufficientBalance(). I couldn't see the error on the console and it took me some time to find out what was wrong.

PatrickAlphaC commented 1 year ago

Ah, sorry just seeing this!

PatrickAlphaC commented 1 year ago

LGTM