The widely-used OpenZeplin implementation of IERC721Enumerable includes redundant storage of each token’s metadata. This denormalized approach optimizes for read functions at a significant cost to write functions, which isn’t ideal, given that users are much less likely to pay for read functions. Additionally, the fact that our tokens are serially numbered, starting from 0, lets us remove some redundant storage from the base implementation. We strongly suggest that all new launches examine this file closely if they are looking for a large win.

We have taken a deep look at a variety of ways to minimize the cost of minting our collection via optimization of our development practices. It’s you, the minter that is paying the crazy gas fees to obtain a collections token. If gas can be optimized with no impact to the minter/holder, then the project has the responsibility to ensure they pass that value to their token holders.

illogics did just that. We looked at the successes and failures of other projects, determining where we believe we are implementing a set of practices that bring value to the community. As a result, we were able to drastically reduce the cost of mint amongst other enhancements, while maintaining the same level of security.

Optimization #1

Enabling the optimizer is something that is straightforward and saves the minter, as well as the overall community, ETH. It’s a very simple configuration and is a staple in many documents, yet it is often not enabled. So yes, we’ve enabled it.

Optimization #2

Almost all projects leverage the OpenZepplin ERC721Enumarable as a means to enumerate a collection. The contract provides a load of built-in functionality, which is great for development teams, as it makes the development process easier. The downfall of this, however, is that it is inefficiently using on-chain storage (redundant/unneeded), passing the costs off to token holders (minters/buyers/sellers). Our goal was to minimize the required writes by removing redundant or inefficient use of storage, while managing/handling increasingly large loops. As a result of these efforts, you will notice that our tokens are serially numbered starting from index 0.

Optimization #3

We removed >= and <= in many of the functions where it makes sense, in turn, choosing to increase the base variable to avoid the costly evaluation. Ethereum gas has 2 main components: amount and cost. The amount of gas required is a function of the cost to execute logic. As such, it makes little sense to write >= 10 and incur the execution cost when you can write < 11. It is so insignificant, yet it saves you money.

Optimization #4

The cost of emitting an event log is incurred by the caller of the function. In the case of a mint, that's you, the minter. Many projects over-utilize event logging, as it does not affect their revenue. The ERC721 _transfer function emits an event that is part of the interface. Many projects emit custom events on a variety of different functions. We took special care to ensure we minimize logging to only the required minimum.

Optimization #5

Removing the OpenSea listing fees is again, a simple, yet highly effective method to reduce costs to the holder. When you list a token for sale on OpenSea, a state change does not occur. The contract just needs to know that the transaction is from a verified proxy account. In this case it’s OpenSea, and if it is then approved the transaction otherwise continue with the default logic.

Much of the optimization in our contract(s) is a direct result of following other projects and being lovers of reviewing code. We would like to shout out the following projects (Nuclear nerds, Azuki, SVS, Bit monsters). These projects have been innovators in the space, and we hop to bring further innovation for the many other project that will come after us.


← PREV: 100% Fair / Transparent Launch

NEXT →: OpenSea Listing Fee