Downcasting error makes impossible to withdraw fees.
uint constant NUMBER_OF_PLAYERS = 100;
modifier playersEnteredMore() {
address[] memory players = new address[](NUMBER_OF_PLAYERS);
for (uint i = 0; i < NUMBER_OF_PLAYERS; i++) {
players[i] = address(i + 1);
}
puppyRaffle.enterRaffle{value: entranceFee * NUMBER_OF_PLAYERS}(players);
_;
}
function testWithdrawFeesDOS() public playersEnteredMore {
vm.warp(block.timestamp + duration + 1);
vm.roll(block.number + 1);
uint256 expectedPrizeAmount = ((entranceFee * NUMBER_OF_PLAYERS) * 20) / 100;
puppyRaffle.selectWinner();
console.log("puppyRaffle balance = %uint", uint64(address(puppyRaffle).balance));
console.log("puppyRaffle totalFees = %uint", puppyRaffle.totalFees());
puppyRaffle.withdrawFees();
assertEq(address(feeAddress).balance, expectedPrizeAmount);
}
Impossible to withdraw fees.
Make totalFees uint256 value.