Cyfrin / foundry-smart-contract-lottery-cu

47 stars 38 forks source link

Update Raffle.sol constructor, clear balance when deploying #29 #42 #43

Closed usgeeus closed 7 months ago

usgeeus commented 7 months ago

The raffle contract gets deployed to address '0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496'. Refer these two issues #29 #42. and there is 0.04 ETH (40000000000000000 wei) on that address. See this etherscan That's why that testPerformUpkeepRevertsIfCheckUpkeepIsFalse test function fails on Sepolia forked network. So you'll need to add below to the constructor function to clear balance when deploying.

uint256 balance = address(this).balance;
if (balance > 0) {
    payable(msg.sender).transfer(balance);
}

The issues #29 #42 are already closed without appropriate correction.

PatrickAlphaC commented 7 months ago

Good shout, thanks!