Ethereum NFT Contracts — The New Standard

The dawn of ERC721 (standard NFT contracts, like Bored Ape Yacht Club) featured contracts that prioritized safe and extensive functionality without much regard for anything else. What else is there to worry about when gas was 10%, even 5% of what it is today? Times have changed as gas on the Ethereum network has skyrocketed — now highly coveted projects are seeing gas prices in large excess of the price that goes to developers. As the conditions on the network has changed, so too must the contracts and developers change to facilitate gas prices that are not crippling for their intended audience.
In this article I hope to convince you about features that every ERC721 contract should employ as a service to their users. Even small changes in gas fees can have hugely impactful results for the consumers: 0.01 Eth may not be much, but between 10000 people it adds up to $325,000 USD based on today’s Ethereum price (1/13/2022).
The Trends
The last few months have featured a few different trends in contract creation. In September 2021, it seemed most people were content paying larger gas fees to ensure bots and contracts would not hoard a disproportionate number of mints from popular projects (RIP Sevens). October brought about the beginning of the whitelist meta, a trend that is surviving to this day. Quickly after that in November 2021 we had a season where the only thing that mattered in a project was staking or similar utility; I am looking at you Anonymice. After a short bear in the NFT market, we were saved by Wolf Game in December and ushered in an era of low-quality derivative P2E-style staking projects. We had a short few weeks of airdropped utility coins ($SOS, $GAS, $LOOKS, and $WTF). And then suddenly here we are in what I hope is a trend toward optimization led by Azuki’s extraordinary success yesterday during their public Dutch auction (sold out in 3 minutes at the highest price).
Optimization
In this section I will be addressing specific features of the contract that I believe are generally agreed upon by the community as largely beneficial and without much drawback. I will draw examples from projects that have been successful, my inclusion of project examples is not a reflection of my opinion of those project’s developers — they were created before a lot of these optimizations were popularized.

Low Gas Mint Function
The first and likely most important feature of an optimized contract: the mint function. Every user who buys the NFT from the developers will use this functionality so it is important it is the best it can be. OpenZeppelin provides copy and paste support for implementations like ERC721Enumerable which provides more utility to the NFT contract, but what we have learned over the past few months is the functionality comes at a steep gas price. It has become apparent that relying entirely on the copy/paste OpenZeppelin implementation is no longer adequate for users. Instead, look at implementations that design their contract around reducing these fees — implementations like Naomsa’s (https://twitter.com/naomsa666) on the Croodles project or Azuki’s (https://twitter.com/AzukiZen) on their project.
Example:
The Sevens: To mint 5 NFTs it used 640,000 gas units.
Azuki: To mint 5 NFTs it used 87,000 gas units.
New gas conscious contracts are vastly more efficient than the older implementations (implementations that are still used incredibly frequently today). If we assume the gas price is 500 gwei (a reasonable amount for a popular project), this feature alone saved the consumers 644 Eth, valued at $2 million USD today. Imagine that — 100 or so lines of customized code and the savings could be mind boggling.

OpenSea pre-authorization
Most people buying and selling NFTs use OpenSea as their marketplace. One unfortunate side effect of allowing OpenSea to transfer your NFT is that you must allow their contract to take it from your wallet. Unfortunately, this permission requires gas to be spent, but luckily the gas is generally much less than minting the NFT. Most users will spend 0.005 Eth to accomplish this permission change; this may seem like very little, but if each user in a 10000 NFT collection sends this transaction, the savings could be extraordinary.
Example: Crypto Coven (https://twitter.com/crypto_coven) was one of the first projects to popularize this methodology. Let us assume that 3000/10000 people decide to list on OpenSea, each paying 0.005 Eth. In less than 50 lines of code our users save 15 Eth, valued at roughly $50,000 today.
Rug Discouraging Withdrawal Functionality
Many first-time developers and non-developers are surprised to learn that withdrawing the funds from a contract is a functionality that must be handcrafted. Luckily, this provides developers and project managers tools to promote trust within the community. One such way to build trust is to design the contract such that a withdrawal from the contract by any team members evenly distributes the funds based on the equity or the roadmap. For example, it is one thing to say you are going to send 10% of the proceeds to a charity, but it another thing entirely to REQUIRE that all withdraws pay out 10% to the charity’s wallet. Furthermore, this is useful when some members of the team have intentions of a rug, while others are honest players (cough Frosties cough). This implementation has the potential to save most of the funds accrued for the project and largely disincentives rugging.
Example: Treasure Seeker (https://twitter.com/treasuresETH), a long-time developer in the NFT space, uses this functionality in his projects (namely Roaring Leaders) to add transparency and protection to the raised funds.

Merkle Tree Whitelist
As whitelists are still featured in almost every project, it is important to do them properly. If a whitelist does not adequately vet out users, it can cause great distress in the community. However, if the project stores every wallet individually in a simple data structure on the contract, it can cost as much as 4 Eth to store the necessary amount of wallets. A revived old technology is using a Merkle Tree to utilize the power of cryptography to safely verify if wallets are whitelist, while also saving the creators 4 Eth. This mitigates a substantial amount of risk for the creators of projects.
Pausable
The truth is that even experienced developers make mistakes or maybe something else in the NFT’s ecosystem is causing problems. Maybe the project managers want to save their consumer’s money or issue refunds, or any number of reasons. To give developers time to rectify mistakes or inaccuracies, pausable functions are key to saving users from exorbitant and unnecessary fees. Many of the P2E Wolf Game derivatives have had to quickly pause their games because somebody found an exploit that would effectively kill the project. For other contracts, maybe the developers want to lock trading until a certain time, or ensure everybody has the same opportunity for the beginning of a game. Pausable functionality on contracts allows developers huge leeway and provides a safety net that has consistently saved projects from complete destruction.
Example: Wolf Game (https://twitter.com/wolfdotgame) quickly realized it had exploits and paused the game in December. This saved the project and enabled them to boast a floor of 0.9 Eth at the time of writing. Px Quest (https://twitter.com/pxquest) had an error in their ERC20 coin that made OpenSea transfers cost more than 3 Eth — a mistake they quickly rectified after pausing transfers to save their users money.
Flexible Project Parameters
Ideally, every project I am a part of will sell out immediately at the decided upon price. But this obviously is not always true, many projects do not mint out and die a slow death after being unable to generate new sales. Selling out a project is hugely important to the success of the project and thus it is important to be flexible. Maybe after mint you realize that 0.15 Eth for a mint is a little excessive in cost or that 20k NFTs is too large of a size. Maybe you want to run a promotion allowing the next 200 mints to be free to generate some momentum. Creating project parameters (price, amount, etc.) such that they can be altered can take a dead project and bring it back to life. It allows flexibility in demand, promotional opportunities, and gives project managers and their community recourse if something does not go as planned. Many communities look very favorable at developers reducing the total supply of the collection.
Example: Marine Marauderz 2D (https://twitter.com/MarineMarauderz) started selling their project at 0.07 nearly two months ago. After the project did not sell out, they reduced the price and very quickly sold out afterwards allowing the project to continue development.

Closing Thoughts
Many of these functions directly benefit consumers by reducing their cost basis to enter a project. The others provide flexibility and reduce risk for contract creators. Both elements come together to improve the longevity and quality of any project. To anyone out there who loves buying NFTs, I encourage you to look for these elements as a sign of dedication and competency in the developing team. For any developers, I hope I showed you some of the benefits of these functions. And finally, to project managers, I hope you use this as a guide to evaluating developers to help on your project.
Special Thanks to Naomsa, Pineapple Crew, and DegenClubNFTs for teaching me so much.