Lesson 9: Contract "Raffle" should be marked as abstract #5198
Answered
by
alymurtazamemon
parishill25
asked this question in
Q&A
-
|
Hi, Function has override specified but does not override anything.
--> contracts/Raffle.sol:35:16:
|
35 | ) internal override {}
| ^^^^^^^^
TypeError: Contract "Raffle" should be marked as abstract.
--> contracts/Raffle.sol:9:1:
|
9 | contract Raffle is VRFConsumerBaseV2 {
| ^ (Relevant source part starts here and spans across multiple lines).
Note: Missing implementation:
--> @chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol:122:3:
|
122 | function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error HH600: Compilation failedThis is my Raflle code : // SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity ^0.8.7;
error Raffle_notEnoughETHEntered();
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";
contract Raffle is VRFConsumerBaseV2 {
uint256 private immutable i_entranceFee;
address payable[] private s_players;
event RaffleEnter(address indexed player);
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 requestRandomWords() 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];
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
alymurtazamemon
Mar 31, 2023
Replies: 1 comment 3 replies
-
|
@parishill25 It looks correct, clean the files by running this command |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
parishill25
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@parishill25 It looks correct, clean the files by running this command
npx hardhat cleanand compile the code againnpx hardhat compile. It should fix the issue, if it still does not fix the issue then please leave your repo link so I can test it locally.