Skip to content

Commit

Permalink
fixed the bug by add a receive function but meet a new bug in vrfcoor…
Browse files Browse the repository at this point in the history
…dinator fullfillRandowWord
  • Loading branch information
WhatMe1on committed Dec 9, 2024
1 parent cc0bf29 commit 6862776
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/unit/RaffleTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ contract RaffleTest is Test {
using CCEncoder for bool[];
using CCEncoder for bool[4];
event EnterRaffle(address indexed player);
event fallbackCalled(address Sender, uint Value, bytes Data);
event Received(address Sender, uint Value);

Raffle raffle;
HelperConfig helperConfig;
Expand Down Expand Up @@ -82,7 +84,11 @@ contract RaffleTest is Test {
assertEq(addressFromRaffle, PlayerAddress);
}

function testEmitsEventOnEntrance() public M_startPrankPlayer M_enterRaffle {
function testEmitsEventOnEntrance()
public
M_startPrankPlayer
M_enterRaffle
{
vm.expectEmit(true, false, false, false, address(raffle));
emit EnterRaffle(PlayerAddress);
raffle.enterRaffle{value: entranceFee}();
Expand Down Expand Up @@ -293,6 +299,14 @@ contract RaffleTest is Test {
assert(winnerBalance == startingBalance + prize);
assert(endingTimeStamp > startingTimeStamp);
}

receive() external payable {
emit Received(msg.sender, msg.value);
}

fallback() external payable {
emit fallbackCalled(msg.sender, msg.value, msg.data);
}
}

contract ToolTest is Test {
Expand Down

0 comments on commit 6862776

Please sign in to comment.