DApp & Smart Contract — Research Funding Club NFT

 

Project Description

The NFT project dedicated to becoming the largest donor to research institutions studying the world's deadliest diseases.

We're donating 90% of our first drop revenue to the American Cancer Society and American Heart Association.

 

Role:

  • Smart Contract Developer.

  • Web3 Integration / Frontend.

  • Consultant.

Deliverables:

  • NFT Minting Dapp with 15+ Wallet Integration.

  • ERC721A Minting smart contract with multi-drop functionality.

Story / Experience

March 15, 2022 - Present

While I was working as a freelancer on Upwork. I received an offer to work at Research Funding Club as a Smart Contract and Web3 Developer. I was tasked with building a smart contract that was efficient and gas effective during mint as well as integrating web3 into the existing web application with the help of a designer who worked on the frontend.

Overall, this project took about a month with a lot of experimentation with the smart contract which allowed me to bring the average mint gas fee from 200K to 85K GWEI. Furthermore, I also worked as a consultant for my client by providing details about the marketing strategy, launch target, community building, etc.

Currently, the project has raised over $2000 and has pledged to donate about 90% to the Charity. I hope to work with this team in the future for their future endeavors.

More details about the Smart Contract and web3 integration below.

Smart Contract

(TL;DR) Lowered Gas cost from 221k ($15 - $30) to 68K ($3 to $7)

This project had a unique requirement which was to have a functionality for multi-drops. The user simply wanted to launch the contract only once and then use the existing contract for new NFT drops without having to deploy a new smart contract.

In my opinion, this was a challenge that had an existing naive solution — using the ERC721URIStorage to hold multiple collection's baseURI. However, in the Solidity community, ERC721URIStorage is infamous for its high gas fees since it is directly written into the storage for each mint.

The average gas fee per mint was about 221K which will be over $20 per mint.

 

This turned out to be a very gas expensive mint which would have turned most users away. Thus, I began looking into specific ways to lower gas fees:

 

1) ERC721A and code optimizations.

ERC721 which is the token standard for NFTs was slow and had inefficiencies, thus, I utilized the ERC721A contract developed by Chiru Labs and integrated that into our mint contract. Along with that, I made sure that the number of calls to storage for data reads was as fewer as possible and implemented more efficient ways of checking (using revert, instead of require).

2) Custom URIStorage (sort of)

Instead of using ERC721URIStorage which was gas inefficient (221K per mint), I implemented a simple struct within the contract which stored NFT collection-specific BaseURIs which allowed the contract to have multi-drop mint capabilities.

Essentially, this allowed the contract to store and call different URI data based on different collections. One could mint different collections of NFT from a single contract.

The owner could just launch the collection on IPFS, update the supply and a new collection mint would be on its way. NFT degens could just mint an NFT without any hassle or crazy gas fees.

 

Gas Saving statistics

Key takeaways:

  • Mint gas cost went from 221K to 68K.

  • Reveal gas cost went from 28K to 23K.

  • NewDrop gas cost went from 57K to 75K.

    • The owner writes to the custom URI storage, which is less frequent thus, the increase in gas is not costly.

  • Reveal gas cost went from 28K to 100K.

    • The owner writes to the custom URI storage, which is less frequent thus, the increase in gas is not costly.

(LEFT (BEFORE): ERC721 and ERC721URIStorage RIGHT (AFTER): ERC721A and Custom StorageURI)

 

Web3 Integration

After deploying the smart contract on the Ethereum Blockchain through the owner, I integrated the web3 into the existing frontend to be able to access the mint functionality. Furthermore, I added over 15+ wallet supports so a hugely diverse group of users can mint without any hassle.

 
 
 
 
 
 

In the end, the project was successfully deployed and raised over $2000. The owner has pledged to donate over 90% so people have faith in the project. On my end, my task was executed successfully, I learned a lot in terms of smart contract optimizations and as a consultant too. I hope to find more clients in the future where I can learn as well as complete my task fully and efficiently.

 
Previous
Previous

Web Platform - NFTFever

Next
Next

Smart Contract & DApp - Metanomads