Cool Cats launched a little over five weeks ago, although it feels like much longer. In that time I have spotted a few projects using the Cool Cats contract as a base for their NFT. As such, I feel that I should outline contract improvements that I would make.
Trimming the fat
In reviewing my own code, I spotted a silly mistake.
using Strings for uint256;
My code never uses Strings. In a previous version of my code, I used Strings to concatenate a tokenURI output, but my deployed contract doesn't do this.
This could safely be removed.
Add IPFS provenance?
A number of people have pointed out that Cool Cats doesn't include a provenance hash, and why didn't I add one?
The honest answer is — I forgot.
I should have added a variable to hold the final image directory hash. This would have been extremely simple to do. It would also give people peace of mind that we won't be changing the images. We never would, but people like the security.
Owner only buying capability during a pause
I have seen a number of new projects that required a minting pause during their drop.
During the pause, they needed to be able to mint some of their own tokens. The Cool Cats contract does not allow for this and this was by design.
I didn't want people to think that the owner could sneak in a few purchases during a pause. However, having witnessed a few projects falling fowl due to this limitation, I would now add that functionality.
Send vs Transfer when withdrawing
The current withdrawal function works but is not optimal. Rather than having to use a require coupled with send, I could have simply used transfer.
.send()returns a boolean result for success/failure.
.transfer()reverts on failure
There are other considerations when decided which function to use and under certain situations, one may pose a security risk — always do your own research
You will notice that I have not included a gist of the updated contract. Sorry, but you really should be putting some brainpower into creating your own contract or at least fully understand the code you are using.
The Cool Cats contract is very simple, but even a simple contract can carry too much fat, mistakes, and unoptimized functions.
Never assume a contract from an existing project is bulletproof or perfect.
Do your own due diligence, you own it to your potential holders/investors
Where to find us:
My Twitter: https://twitter.com/xtremetom
Cool Cats Team: https://twitter.com/coolcatsnft
Cool Cats Discord: discord.gg/coolcatsnft