Dependency | Version |
---|---|
NodeJS | v17.7.1 |
npm | 8.5.2 |
Solidity | ^0.8.0 |
The DBioContract implements ERC 1155, which allows for batch minting and batch transfers as well as "burning" the NFT to destroy it. The contract creates a "voucher" instead of the NFT first, which allows dBio to postpone any minting costs until after the patient claims the NFT. The minting cost is then bundled with the transfer cost that the patient covers. The idea for lazy minting came from the Lazy Minting tutorial.
The lib
directory includes the script from the Lazy Minting Tutorial mentioned above, slightly adjusted for this project.
The Smart Contract also uses EIP 712, to help with signing and hashing. The _hash
functioned is used inside the _verify
function to check that the signer of the the NFT voucher has the "MINTER_ROLE" that's required to mint the NFTs.
Since ERC 1155 requires the tokenURI to be set at the intitiation of the contract, the _setTokenUri
helper function was added as an override so that the URI of the token can be overwritten with each voucher/minting.
The contract has been deployed to the Rinkeby testnet using the deploy.js
script in the scripts
directory. The contract can be seen here.
Currently, the private key that was used for deployment to the testnet does not belong to dBio. This will need to change in the future.
The contracts can be tested and deployed locally using hardhat. To run, use the following commands:
npm i
npx hardhat compile
npx hardhat test