1 points · by MuratCanYuksel · 2y ago · 1 comment
How does that whitelisting actually occurs? How is it structured in solidity?
Almost always, the addressess that purchase the NFT will be added into a mapping. According to alchemy a mapping is a hash table in Solidity that stores data as key-value pairs. They are defined like:
mapping(address => bool) public whitelistedAddresses;
You see, the idea here is simple: When someone purchases one of your NFTs, you take their address, and put a truthy statement to it. That's what a bool is, it's a boolean. True, or false. If they have not purchased your NFT, their addresses will not be in the mapping anyway, so it will not be a truthy statement. When they do purchase, on inquiry their addresses will return a truthy statement and you'll know that they are whitelisted.Then, you can basically do whatever you want with this whitelistedAddresses mapping. You can use it as a guard to certain functions and only whitelisted people can do such and such.