Skip to content
This repository was archived by the owner on Apr 6, 2022. It is now read-only.

Latest commit

 

History

History
46 lines (36 loc) · 2.81 KB

File metadata and controls

46 lines (36 loc) · 2.81 KB

SUMilanCertificateUpgradeable

This Smart Contract is written in Solidity and uses OpenZeppelin's libraries to generate EIP-721 compliant NFTs.

How it works

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.

API

SUMilanCertificateUpgradeable contract extends these contracts:

All the methods of these contracts are available inside SUMilanCertificateUpgradeable instance.

mintCertificate (public onlyOwner)

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.

Parameters:

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

Returns

_certificateOwners (private)

struct EventsOwned {
    mapping (string => bool) eventIds;
}

mapping (address => EventsOwned) private _certificateOwners;

Associates to every address the eventIds of which it has a certificate.