PatrickAlphaC / hardhat-smartcontract-lottery-fcc

MIT License
118 stars 182 forks source link

DeclarationError: Identifier not found or not unique for msg.sender #86

Closed ParkerZA closed 2 years ago

ParkerZA commented 2 years ago

My code is pretty much the same as Patrick's at this point in the video (timestamp). Except his code compiles and mine throws the error: "DeclarationError: Identifier not found or not unique" pointing to "event RaffleEnter(msg.sender);" with ^^^^ under msg.sender.

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.7;

import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";

error Raffle__NotEnoughETHEntered();

contract Raffle is VRFConsumerBaseV2 {
    /* State Variables */
    uint256 private immutable i_entranceFee;
    address payable[] private s_players;

    /*Events*/
    event RaffleEnter(msg.sender);

    constructor(address vrfCoordinatorV2, uint256 entranceFee) VRFConsumerBaseV2(vrfCoordinatorV2) {
        i_entranceFee = entranceFee;
    }

    function enterRaffle() public payable {
        if (msg.value < i_entranceFee) {
            revert Raffle__NotEnoughETHEntered();
        }
        s_players.push(payable(msg.sender));
        emit RaffleEnter(msg.sender);
    }

    function requestRandomWinner() external {}

    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {

    }

    function getEntranceFee() public view returns (uint256) {
        return i_entranceFee;
    }

    function getPlayer(uint256 index) public view returns (address) {
        return s_players[index];
    }
}