I've been reviewing some of the recent NFT smart contracts as I work on my own, and it's awesome to see the evolution from one version to the next and the little innovations each team puts in. Here's a thread of my favorite contract tricks.
1/ First, I reviewed the following NFT projects, listed in order of their contract launch:
- BAYC
- The Alien Boy
- Wicked Craniums
- My Fucking Pickles
- Cool Cats
- Bulls on the Block
- Forgotten Runes Wizard Cult
- Sewer Rat Social Club
- Lucky Manki
- Degenz
2/ I also wanted to review @MadCatMilitia and @DeadHeadsNFT, but they did not upload their source code to Etherscan and unfortunately I don't like to read decompiled byte code. Will revisit them if they update!
So, starting with BAYC, which is my "genesis" contract.
3/ The @BoredApeYC code is short and sweet. They have some code in here about the starting index but it's not enforced in the contract, which means they did some special association logic in their custom API for launch, and then switched to an IPFS backend later.
4/ @TheAlienBoyNFT is the first contract I reviewed with a custom comment header, which I love. Shows me the developers take pride in their work. They added a birthdate to the tokens, and emitted some events that BAYC didn't do.
5/ Also they left me a little "Fuck you nerd!" message which I appreciate. TAB also started using Enumerable, but I don't see any Enumeration in the contract so not sure what that's for.
6/ @WickedCraniums is identical to BAYC, except they stripped all the extra stuff about starting indexes and provenance setting. At 56 lines of code this comes in as the shortest contract of them all.
7/ @MyFuckingPickle looks like a custom job, not cloned from BAYC. Short and sweet, they added functionality to select the Golden Pickle. Randomization was block.timestamp + block.difficulty which is OKAY, but using Chainlink would have been so much cooler.
8/ @CoolCatsNFT did something cool that I immediately borrowed: they hardcoded the public addresses of the team members and made their withdraw function automatically split between the team.
9/ It's such a neat idea because it allows trustless collaboration, and also there's a record of the team right there in the contract. Very cool, @CoolCatsNFT.
10/ @BullsOnTheBlock is a pretty faithful clone of BAYC. One innovation is they used the blockhash function in their randomization techniques which is pretty cool and I haven't seen it before. Not sure how random it is but at least it's new!
11/ @ForgottenRunes is my favorite contract I've read. Sometimes code makes your heart pound in a good way and this one did. Starting with their sick comment header, and followed up with a secret phrase:
12/ "It is not our part to master all the tides of the world, but to do what is in us for the succour of those years wherein we are set, uprooting the evil in the fields that we know, so that those who live after may have clean earth to till."
13/ FRWC did a couple of things I love, first they added a forwardERC20s function, so if their contract receives any tokens they're able to withdraw them to the owner. They also demonstrated how to store data on-chain without using contract state. Very slick.
14/ @SewerRats_NFT is pretty simple, at only 85 lines, and looks to be hand-coded not cloned. They added some new functionality to give away the first 200 rats for free by changing the price depending on the current token id. A clean little solution to that problem.
15/ @LuckyManekiNFT is a total outlier. Probably hand-coded or cloned from an older contract, it uses the oldest Solidity and OpenZeppelin versions. They have a provable raffle contract in here (didn't read that one) and some functionality for naming your cat.
16/ And finally we've got @DegenzNFT. At just 82 lines it's the second shortest contract. A direct clone of BAYC, also with the starting index functionality stripped out.
17/ Would have been as short as Wicked Craniums but they decided to leave the provenance hash setting functionality in there.
18/ Based on this review, here are my top 3 in order of awesome: 1. Forgotten Runes Wizard Cult — Because their shit is sick. 2. Cool Cats — Because they took care of their team. 3. Wicked Craniums — Because they used the least code.
If you got this far then thanks for reading!
19/ As soon as I go live with my own @mystoners contract I will post a writeup and compare it to these guys as well. Follow me for more smart contract reviews!
• • •
Missing some Tweet in this thread? You can try to
force a refresh
Several people asked me yesterday how to read the code for NFT smart contracts, so here's a brief thread on how I do it.
1/ First go to @opensea and find an NFT you want to review and click into its details section. In there you'll find a link to the contract on Etherscan.
2/ Click that link and you'll land on the Contract Overview page. Find the tab that says "Contract", and if it's got a green check mark you can get excited because it means the developers uploaded code for you to read.