lesson-9 solidity error
#2227
-
Hi there! I can't compile since there is an error. anyone knows about this? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 27 replies
-
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Hey @MasterofBlockchain you mostly get this error if you are inheriting a contract and you haven't implemented some functions contained in the contract you are have inherited. For example, if your contract has inherited an interface that has a |
Beta Was this translation helpful? Give feedback.
-
after uncommenting it ..still i have an error
|
Beta Was this translation helpful? Give feedback.
-
Hey @MasterofBlockchain you failed to include the input parameters for the
Checkout |
Beta Was this translation helpful? Give feedback.
-
The error occurs when you inherit a contract (class) but do not use its functions (state). Refer abstraction, an OOP concept. |
Beta Was this translation helpful? Give feedback.
-
@MasterofBlockchain @othaime-en
I'm having 2 errors. The second error is as below, but I think it has something to do with the first one. Compilation Error;TypeError: Function has override specified but does not override anything.
--> contracts/Raffle.sol:54:91:
|
54 | function fulfillRandonWords(uint256 requestId, uint256[] memory randomWords) internal override {
| ^^^^^^^^
TypeError: Contract "Raffle" should be marked as abstract.
--> contracts/Raffle.sol:18:1:
|
18 | 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 failed While researching, I have seen that this can be caused by functions you need to implement in your contract from an inherited contract, but they are undefined in your contract. You need to include them somewhere. The only other function I see in the Tutorial timetamp;
|
Beta Was this translation helpful? Give feedback.
Hey @MasterofBlockchain you failed to include the input parameters for the
fulfillRandomWords()
function. Add these as input parameters in that functionuint256 requestId, uint256[] memory randomWords
The function should therefore be:
Checkout
14.13.30
You missed it.