Skip to content

Smart Contract that dBio uses to mint NFTs and create NFT vouchers

License

Notifications You must be signed in to change notification settings

HES-Capstone-dBio/dbio-smartcontract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

dBio Smart Contract

License: MIT

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.

Access on Rinkeby Testnet

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.

Deploy Locally

The contracts can be tested and deployed locally using hardhat. To run, use the following commands:

npm i
npx hardhat compile
npx hardhat test

About

Smart Contract that dBio uses to mint NFTs and create NFT vouchers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published