-
Notifications
You must be signed in to change notification settings - Fork 1
Smart‐Contract
On this page we will explain the ItemBlocks
smart-contract. Give a brief review of smart-contract structure and lead the reader to smart-smart contract for function documentation.
The contract is an extension of the ERC721 non-fungible token contract. We use the ERC721 contract as well as the Ownable contract by Openzeppelin as our foundation.
The ItemBlocks
smart contract contains nine functions.
safeMint
createPassport
updatePassport
isEligible
setCreator
updateOwnership
getUserHistory
getCreatedItemTokens
getPassport
It contains four variables.
One structure that represents the item passport.
struct Passport {
string name;
string desc;
string family;
string url;
string img;
}
and three hash-maps.
mapping (uint256 => Passport) public itemPassports;
mapping (uint256 => address[]) public allItemOwners;
mapping (address => uint256[]) public createdItems;
The contract contains an import section where the authors imported the openzeppelin
module.
import "openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";
import "openzeppelin-contracts/contracts/access/Ownable.sol";
We have written documentation for each function of the smart-contract. We provide a NatSpec (Natural Language Specification) way of commenting for each of the functions. You can read the documentation for the functions in the smart-contract here.