This Smart Contract is written in Solidity and uses OpenZeppelin's libraries to generate EIP-721 compliant NFTs.
The Contract has a main function named mintCertificate that can be invoked only by the contract's owner. The contract's owner is defined at deployment, when the initialize function is called.
The Contract is upgradeable thanks to the OpenZeppelin's Upgrades libraries.
SUMilanCertificateUpgradeable contract extends these contracts:
- ERC721Upgradeable
- ERC721URIStorageUpgradeable
- ERC721EnumerableUpgradeable
- OwnableUpgradeable
- Initializable
- UUPSUpgradeable
All the methods of these contracts are available inside SUMilanCertificateUpgradeable instance.
mintCertificate(address to, string memory tokenUri, string memory eventId)Checks inside the _certificateOwners mapping if the to address already has a certificate with that eventId. If not, it mints the new certificate.
It's invokable only by the certificate owner.
| Name | Type | Required | Description |
|---|---|---|---|
to |
address | yes | Address receiving the minted certificate |
tokenUri |
string | yes | IPFS hash of the NFT JSON metadata (see ERC721 Metadata JSON Schema) |
eventId |
string | yes | Event ID for which the certificate is required |
tokenId(uint256): the token ID of the minted NFT (see Enumerable extension).
struct EventsOwned {
mapping (string => bool) eventIds;
}
mapping (address => EventsOwned) private _certificateOwners;Associates to every address the eventIds of which it has a certificate.