I am new to ethereum I building a course page where you would get an NFT if you complete the course. Any idea on how to implement it.
1 Answer
you need to have mapping to get track of whether an address is completed the course or not eg: mapping(address => bool) public isCompleted
you can updtae this mapping if specefic address completed the course.
you also need a function called getReward
then in the function you should check the mapping, you can implement it like this :
function getreward() public{
bool courseCompleted = isCompleted[msg.sender];
require(courseCompleted,"not completed the course");
// if require get passed then the code to transfer or mint the NFT goes here
}