_mintTicket
```remix-solidity
/**
MintTicket: Mint tickets to a specified recipient for a given event and access level.
@param _tokenId: The token ID representing the ticket.
@param _to: The address of the recipient to whom tickets are being minted.
@param _eventId: The unique identifier for the event associated with the ticket.
@param _amount: The number of tickets to be minted.
Format: eventId, to, tokenId, amount
*/
function _mintTicket(
string calldata _eventId,
address _to,
uint256 _tokenId,
uint256 _amount
) private {
// Check if the caller is an event manager for the specific event
if (checkIfCallerIsEventManager(_eventId, _msgSender())) {
// Mint tickets directly if the caller is an event manager
_mint(_to, _tokenId, _amount, "");
} else {
// Check if the access level requires whitelisting
if (!getWhitelistBooleanFromTokenId(_tokenId)) {
// Mint tickets directly if whitelisting is not required for the access level
_mint(_to, _tokenId, _amount, "");
} else {
// Check if the caller has sufficient minting approval for the token ID
if (getMintingApproval(_msgSender(), _tokenId) >= _amount) {
// Reduce the minting approval and mint tickets if approval is sufficient
s_tokenIdApprovals[_tokenId][_msgSender()] -= _amount;
_mint(_to, _tokenId, _amount, "");
} else {
// Revert if the caller does not have enough minting approval access
revert DecastGating__UserDoesNotHaveEnoughMintingApprovalAccess();
}
}
}
}
```Explanation:
Last updated