👋 Hello world! This is Santhosh Reddy, a 17 year old developer and a curious web3 learner. I keep building projects on blockchain like Dapps and smart contracts which reflects the real world use cases.
Intro... 🙋♂️
Back again with a new web3 project, NFTify - A simple NFT minting dapp. I completed working with IPFS data storage, commerce related smart contracts in UMart & Web3Drive as well as DAO like smart contracts in Smart City Government & Car Insurance Company, but never had an experience in working with ERC721 and ERC20 contracts which are very important in web3 development.
So, I decided to complete two projects on ERC20 and ERC721. In a span of two days I completed building an NFT minter - NFTify and deployed on netlift.
Visit : NFTify
Code : Github Repo
Tech Stack... 🧑💻
ReactJS (fronted UI)
Web3JS (interact with smart contract)
Solidity (create the erc721 smart contract)
ERC721 Contract... 📋
I created the erc721 contract using OpenZeppelin and deployed to the Rinkeby Testnet through Remix IDE.
Here is the code of the contracts.
// SPDX-License-Identifier: MIT
pragma solidity ^ 0.8.0;
import "github.com/OpenZeppelin/openzeppelin-contracts/contracts/utils/Counters.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";
import "github.com/OpenZeppelin/openzeppelin-contracts/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
contract NFTify is ERC721URIStorage {
using Counters for Counters.Counter;
Counters.Counter private tokenIds;
constructor() ERC721("NFTify", "NFY") { }
function mintNFT(string memory tokenURI) public returns (uint) {
tokenIds.increment();
uint256 newItemId = tokenIds.current();
_mint(msg.sender, newItemId);
_setTokenURI(newItemId, tokenURI);
return newItemId;
}
function currentID() public view returns (uint) {
return tokenIds.current();
}
}
Here I imported counters.sol
to safely increment the value of the tokenIds, ERC721.sol
to mint the NFT and ERC721URIStorage.sol
to store the url of the metadata of the NFT in the contract's storage.
Final Thoughts... 🙂
Reached the end... Finally, I completed my 1st target project and should start working on a ERC20 project.
Taking a leave for now... 👋 Bye!