Week6 @ Polygon Fellowship

This week wasn't exactly the best, especially given that i had to travel back to Chennai and was down with Covid/ recovering from it for the most of it. Regardless this week was earmarked as the NFT week, where we get to learn everything. Starting from the answer to the question Why NFTs? How do you mint them? and Where will they fit into the bigger picture of Web3.

The week kicked off with a session from an employee at NIBBL which started all the way from the very basics as to what an NFT is all the way to how he figured his way around the Web3 space.

To give a brief introduction about NFTs, it stands for a Non Fungible Token ( ERC721 ). This is fundamentally different than ERC20s or as they are called native tokens to a blockchain. The Non-fungibility aspect of the token refers to it's unique qualities and traits that make it completely standalone and non -replicable from other assets.

Through the reading material provided i got to know about a bunch of new things such as Fractionalised ownership of NFTs.

Fractionalised Ownership of NFTs

Utility-vise it seems like such a no brainer, especially given the exorbitant prices of some of the really popular NFTs. It would only make sense that a bunch of wallet addresses could jointly own an NFT and use it for various benifits associated with it.

This works by locking the original NFT in a vault and a smart contract issues a limited supply of fungible tokens that represent ownership over that NFT.These fungible tokens can be bought on fractional NFT platforms and can even be traded on secondary markets like Uniswap.

GameFi

Play to Earn or P2E games are something that sort of blew my mind since they are just games, where you can actually make a return if you play it enough ( unlike some of the other pseudo P2E web2 alternatives ). NFTs play an extremely important role in the existence of these platforms, some of which include StepN, Splinterlands and Aavegotchi.

Coding!

After a bunch of superficial context about NFTs and their usecases the material introduced us to some code, using Openzeppelin's contracts ( of course they did ). It introduced me to some best practices of abstracting away the fetching of environment variables into a function hence increasing readability.

export const env = (key: string): string {
  const value = process.env[key];
  if(value === undefined) {
    throw `${key} is undefined`;
   }
  return value;
}

It seems awfully simple but it's something that blew me away with how much easier it made handling environment variables. Following the tutorial taught me how to mint ERC721 tokens and setup a wonderful workflow with hardhat.

Minting My Own NFT Collection

This was the first assignment of two for this week and was relatively simple given that i've worked with smart contracts that mint and handle marketplaces for those NFTs as well, all hail Nader Dabit.

After writing a simple smart contract and a few tasks to run on hardhat i was able to upload the following ipfs link as an NFT's metadata. As part of the task we also had to make sure that:

  • We set a max limit of 3000 NFTs
  • NFT image can be changed by the owner alone, pretty simple using the onlyOwner modifier from Openzeppelin

I was finally able to upload the following image as part of the metadata: image.png uncle roger FTW, yeah you heard me

What's next for NFTs

This was a fun video to watch as it gave an over view of some upcoming projects in this space such as LivePeer and the many ways that NFTs will blowup in the future.