gab0071 / nft-collection

NFT Collection for crypto devs!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NFT Collection 👷‍♂️

Badge showing project license type Badge showing the solidity version Badge showing the hardhat version Author

This is a Solidity contract for a non-fungible token (NFT) collection called "Crypto Devs". The contract implements the ERC721 and ERC721Enumerable interfaces, which define the standards for non-fungible tokens and for enumerating them, respectively. The contract also uses the Ownable contract from OpenZeppelin, which provides a basic access control mechanism for restricting certain functions to the contract owner.

The contract has several functions:

  • startPresale: This function allows the contract owner to start a presale for the NFT collection. The presale is only available to whitelisted addresses.

  • presaleMint: This function allows a user to mint one NFT during the presale. The user must be whitelisted and must send the correct amount of Ether with the transaction.

  • mint: This function allows a user to mint one NFT after the presale has ended. The user must send the correct amount of Ether with the transaction.

  • _baseURI: This function overrides the default implementation in the ERC721 contract and returns the base URI for the NFT collection.

The contract also has several variables:

  • _baseTokenURI: This variable stores the base URI for the NFT collection.

  • _price: This variable stores the price of one NFT in the collection.

  • _paused: This variable is used to pause the contract in case of an emergency.

  • maxTokenIds: This variable stores the maximum number of NFTs that can be minted in the collection.

  • tokenIds: This variable stores the total number of NFTs that have been minted in the collection.

  • whitelist: This variable stores an instance of the whitelist contract, which is used to check if a user is whitelisted.

  • presaleStarted: This variable is used to keep track of whether the presale has started or not.

  • presaleEnded: This variable stores the timestamp for when the presale will end.

The contract also has a modifier called onlyWhenNotPaused, which prevents certain functions from being called if the contract is paused.

It was a fun and very interesting project because we connected two contracts through the IWhitelist.sol (this allowed us to save gas and only access the function that we required for this project) and we developed more logic to work with NFTs.

The frontend code you can find it here.


Installing / Getting started

# Clone this project
$ git clone https://github.com/gab0071/nft-collection

# Access
$ cd nft-collection

# Install dependencies
$ npm install

Commands

  • $ npx hardhat compile
  • $ npx hardhat run scripts/deploy.js
  • $ npx hardhat verify --constructor-args args.js DEPLOYED_CONTRACT_ADDRESS --network goerli

Technologies / Built With

License

This project is under license from MIT. For more details, see the LICENSE file.

Contributing

Contributions are always welcome! Open a PR or an issue!

Linkedin - J.Gabriela Email - J.Gabriela
Made with ❤️ by catellaTech.

About

NFT Collection for crypto devs!

License:MIT License


Languages

Language:Solidity 67.8%Language:JavaScript 32.2%