Closed worca333 closed 4 months ago
Hello @worca333, this is pretty interesting. Can you please share the lesson link on the updraft you are referring to? That way, we can add and update the written lesson in that section.
Cheers.
Hi @cromewar,
Sure here is the lesson link: https://updraft.cyfrin.io/courses/foundry/smart-contract-lottery/setup And here is the git repo link: https://github.com/Cyfrin/foundry-smart-contract-lottery-cu/blob/main/script/HelperConfig.s.sol#L87
Sorry, @worca333, but the lesson you mention is the beginning of it. Can you point me to the actual lesson video, please?
@cromewar
This is the lesson where Patrick makes up those values in HelperConfig.s.sol
. Interestingly, it looks correct in the video while it isn't in the codebase.
Ah! I've fixed it here.
https://github.com/Cyfrin/foundry-smart-contract-lottery-cu/blob/main/script/HelperConfig.s.sol
Thanks! We will update the written lessons too.
In advance, I'd like to thank @PatrickAlphaC for an fast & productive course!
I found an issue with the keyHash of VRF subscription for the sepolia network.
After successfully deploying
Raffle
contract, subscribing to a chainlink VRF, and creating a chainlink upkeep timer, it seemed everything was in place and ready to work correctly. But somehow the lottery didn't award the winner at the last step - choosing the winner by a random number which is provided by VRFCoordinatorV2_5. Why? There was an error occurred within thes_vrfCoordinator.requestRandomWords
request. What is irony though, the request itself came out as a successful one so that theperformUpkeep
method passed while updating the lottery status toCALC
. Our contract never got a call tofulfillRandomWords
which means it stuck withCALC
status and all funds entered.Deep inside, it was the problem with the keyHash (gasLane) of the config. Since we're using VRF v2.5, it should be
0x787d74caea10b2b357790d5b5247c2f63d1d91572a9846f780606e4d953677ae
from https://docs.chain.link/vrf/v2-5/supported-networks#sepolia-testnet But current codebase had0x474e34a077df58807dbe9c96d3c009b23b3c6d0cce433e59bbf5b34f823bc56c
from https://docs.chain.link/vrf/v2/subscription/supported-networks#sepolia-testnetShould it be fixed to a correct keyHash, it worked perfect!
Hope this helps.