An analysis of the functionality in Penelope’s Key contract that goes beyond the standard ERC721 functionality:
- Active Session Management (
ActiveSession
,activeSession
): The contract introduces the concept of "active sessions," which can be one of four states (NONE
,ALLOWLIST
,WAITLIST
,PUBLIC
). This is a mechanism for managing different phases or stages of the token minting process. - Ticket-Based Minting (
mintWithTicket
): In addition to the standardmint
function, the contract provides amintWithTicket
function that allows users to mint tokens using tickets. Each ticket includes a ticket number and a signature, which are verified by theverifyTicket
function. This function uses theallowListSigner
address to recover a signed message and compare it with the expected message. - Ticket Claiming and Management (
claimTicket
,verifyTicket
,getTicket
): These functions handle the claiming and validation of tickets in the contract.claimTicket
marks a ticket as claimed (i.e., already used to mint a token),verifyTicket
checks the validity of a ticket, andgetTicket
generates the expected message for a ticket. - Custom URI Management (
setBaseURI
,setUnrevealedURI
,tokenURI
): The contract allows the owner to set a base URI and an "unrevealed" URI for the tokens. ThetokenURI
function then uses these URIs to generate the URI for each token. If theisRevealed
state variable isfalse
, theunrevealedURI
is used as the token URI. - Admin Role Management (
onlyAdmin
,addAdmin
,removeAdmin
): The contract introduces an "admin" role that has certain privileges. TheaddAdmin
andremoveAdmin
functions allow the contract owner to manage who has the admin role. - Burn Functionality (
burn
): The contract includes aburn
function that allows admins to burn (i.e., permanently destroy) tokens. - Leveling System (
Level
,_tokenLevels
,levelUp
,getTokenLevel
): The contract includes a leveling system for tokens, where each token has an associated level and timestamp. ThelevelUp
function allows an admin to increase the level of a token, and thegetTokenLevel
function allows anyone to view the level and timestamp of a token. - Withdraw Functionality (
withdraw
,setWithdrawAddress
): The contract includes awithdraw
function that allows the contract to send its Ether balance to a specified address. ThesetWithdrawAddress
function allows the owner to set this address. - Price and Supply Management (
mintPrice
,maxSupply
,setMintPrice
,reduceMaxSupplyBy
): The contract maintains amintPrice
(the cost to mint a token) and amaxSupply
(the maximum number of tokens that can be minted). The owner can change the mint price and reduce the max supply with thesetMintPrice
andreduceMaxSupplyBy
functions, respectively.
These are the main features of the PenelopesKey
contract that extend beyond the standard ERC721 functionality.