/nft-solidity-vault

NFT Vault is a Smart Contract that holds NFTs from other users.

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

Solidity - NFT Vault

I used the last Hardhat Toolbox release with many of the commons plugins such as:

  • ethers.js
  • hardhat-ethers
  • mocha and mocha-as-promised
  • solidity-coverage
  • typechain for TypeScript
  • hardhat-etherscan
  • hardhat-gas-reporter

RUN this Project

Create and .env file based in .env.example. Remember to run:

# install dependencies
npm install

Try running some of the following tasks:

npx hardhat help
npx hardhat test
npx hardhat coverage
GAS_REPORT=true npx hardhat test
npx hardhat node
# npx hardhat run scripts/deploy.ts

Solution

First of all, I created a NFT Token (GameItem) with mandatories contracts/interfaces to handle the ERC-721 Token using @openzeppelin. After, I created a script to deploy the GameItem.sol and mint NFT's. So, I could run this script each time I want make a test for example.

I tested almost all the flow and the coverage print is appended bellow

I needed to implement an AccessControl.sol to handle with ADMIN and USER requirements. I thought that it would be better than use an Ownable contract. So, We can GRANT and REVOKE access to NFTVault.sol.

NFTVault.sol

NFTVault

AccessControl.sol

AccessControl

Coverage

coverage