Create ERC721(nft) that yield ERC20 token to nft holders each day automatically

Hi guys just started in solidity , I quit my dev. job in a gaming studio to create my own project.
Basically, is it possible to create a contract that have a supply of x NFT who people can mint (not reveal and reveal function) and after 24 hours that stack ERC20 custom token automatically to holder who hodl the ERC721 nft.

1 Like

Telegram :- @peterhere316

Did you figure it out?

It's possible enough.
You need to have an array of NFT owners and a withdrawal function.
Withdrawal function may look like as:

function withdraw() public nonReentrant {
     require(isNFTOwner(_msgSender()), "YourContract: msg.sender is not nft owner.");
     uint256 reward = rewardPerDay * ((block.timestamp - lastRewardedTime) / 1 days);
     IERC20(paymentToken).transfer(_msgSender(), reward);
     lastRewardedTime = block.timestamp;
}