Skip to content

MichiMich/NftWithWhitelist

Repository files navigation

Nft with whitelist

looksrare seems to create a png or img file out of the svg which can lead to loose of characters in the png file (svg to img/png converter have problems with specific signs), the metadata and created svg looks like the one above and is correct

Short description

Creating two contracts.

  1. A nft contract including the ERC721 standard which will create different AsciiFaces fully onchain
  2. An AccessControl contract which defines which adddress can mint what number of elements of the nft contract given in 1.

Details

fully onchain

Creating fully onchain generated AsciiFaces using base64 encoding and svg creation - no need for storing the picture/image/svg on any decentralized/centralized storage.

random and all mint combinations

Defining all possible mint combinations during deployment of the contract. Combination of a choosen number at mint and the clearing of the used mint combinations to generate one of its kind nfts only - all "random" created - no duplicates. its no full randomness, if you want a true unbiased randomness you should go for chainlink VRF

Realization of a whitelist

The whitelist is realized by linking the nft contract with the AccessControl contract and vice versa. This ensures that the mint function of the nft contract can only be accessed by addresses which are granted access from the AccessControl access during non-public mint.

Prerequisites

  • Nodejs and npm You'll know you've installed nodejs right if you can run:
    node --version
    

    and get an ouput like: vx.x.x

  • hardhat You'll know you've installed hardhat right if you can run:
    npx hardhat --version
    

    and get an ouput like: 2.9.3

    A webbrowser, since you can read this here I should not have to mention it^^
    Basic understand of js, hardhat and solidity. If you want to get basic understanding up to expert I highly recommend the man, the myth, the legend: Patrick Collins
    Some rinkeby eth if you deploying to rinkeby testnet, you could grap some here

dependencies

install dependencies:

npm install --save-dev @openzeppelin/contracts @nomiclabs/hardhat-etherscan @nomiclabs/hardhat-waffle chai

For the fast runners

clone repository

fire up the git clone command:

git clone https://github.com/MichiMich/NftWithWhitelist

cd into it

cd NftWithWhitelist

and deploy/mint it:

a) to local hardhat:

npx hardhat run scripts/deploy_NftWithWhitelist.js

b) rinkeby: never share your private keys with anyone! I highly recommend you to create a new wallet only for testing contracts, dont use your wallets with actual money on it!! Please friend be save, better save than sorry! If you want to push your data on github, add the secrets.json at the .gitignore file

I used 3 wallets for the deploy script, so you can add the private keys at secrets.json or adapt the scripts/deploy_NftWithWhitelist.js file to only use one account, then you would only need one private key

fill in your alchemy url and private keys from your wallet at the secrets.json file and deploy it on rinkeby with

npx hardhat run scripts/deploy_NftWithWhitelist.js --network rinkeby

About

NFT and AccessControl contract including tests

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published