Tuesday, May 24, 2022
HomeCould10 Ways BAYC Could have Improved Its Minting Mechanics and Land Sale...

10 Ways BAYC Could have Improved Its Minting Mechanics and Land Sale Contract

BAYC dropped the highly-anticipated metaverse project The Otherside two days ago. The Etherscan was smashed by the NFT drop. In total, NFT buyers forked out more than $157 million in Ethereum gas fees just to mint some of these exclusive land NFTs. Many people took to Twitter to discuss ways the BAYC team could have made the land sale contract and minting process more efficient, given the insane gas prices.


BAYC land sale contract needs a revamp.
Wait, did you mean gas optimization? Credit: Yuga Labs.

10 ways on how the BAYC team could have improved its land sale contract and minting mechanics

Needless to say, many agreed that the high gas fees are unnecessary, as the BAYC team could have simply optimized the land sale contract and minting mechanics with a few tweaks. We have collected a number of useful suggestions from top Web3 developers in this article. These suggestions include those from Twitter users like @CaptainDefi2 and @iamarkdev. Let’s have a look.

Optimize the BAYC land contract in ERC721 format


Remove safetransferfrom function from BAYC land sale contract.
“SafeTransferFrom” function on the BAYC land sale contract. Source: @CaptainDefi2.
  • Firstly, the BAYC team could just remove the “SafeTransferForm” function from the land contract. @CaptainDefi2 stated that since BAYC transfers funds back to the same contract they wouldn’t need this function. This would allow them to save a Call function for the same contract.

remove nonReentrant function from the BAYC land sale contract
“nonReentrant” function. Source: @CaptainDefi2.
  • Next, according to @CaptainDefi2, if all of the KYC addresses are not contracts, then the BAYC team could just remove the “nonReentrant” function. It can be changed to “msg.sender== tx.origin”.

“safeMint” function. Source: @CaptainDefi2.
  • Since we knew that the previous addresses are not contracts, BAYC could just remove the “safeMint” function as well. This would reduce the number of checks required to run the entire contract. @WillPapper says they can switch between _safeMint() and _mint().

Use unchecked sums on BAYC land sale contract.
Use unchecked sums on the BAYC land sale contract instead. Source: @CaptainDefi2.
  • If we know that the sum of a variable will always stay in the safe range, using unchecked sums would be enough. @CaptainDefi2 suggested that the BAYC land sales contract use an “unchecked” i ++” to reduce gas consumption.|@CaptainDefi2 proposed using “unchecked ++}”” on the BAYC Land Sale Contract to cut down on gas.|@CaptainDefi2 also suggested using unchecked i ++}” in the BAYC contract for land sales to save gas.|@CaptainDefi2 also suggested to use “unchecked ++}”” in order to save gas for each check.}
  • On the other hand, @iamarkdev suggested that the BAYC devs should avoid using ERC721Enumerable in the contract. This would help save around 70% of the gas fees.

Apply the ERC721A standard in the BAYC land sale contract


ERC-721 vs ERC-721A gas fees comparison.
ERC721 vs ERC721A gas fees comparison. Credit: @CaptainDefi2.
  • Now, using the ERC721A contract for minting would save us a ton of gas too. This ERC standard allows you to mint multiple NFTs at the same price as one single NFT. Based on the table above, we could save up to 86% in gas fees, when the number of mints increased up to 5 on an ERC721A contract.

ERC721a without ranges
Just take away the ranges. It’s a simple task! Credit: @CaptainDefi2.
  • However, in the original land sale contract, BAYC used ranges to distribute the land NFTs to BAYC and MAYC holders. For instance, plot# 0-9999 will go to BAYC holders, and plot# 10000-29999 will go to MAYC holders. Because of this, the ERC721A format was not suitable for the original smart contract. However, if the BAYC team did not use ranges they could save users tons of gas fees as per the table.

Better minting mechanics

  • According to @WillPapper from the Syndicate, gas optimization is just part of the equation. To avoid everyone minting simultaneously, the BAYC team will need to develop better minting techniques. Batch minting could be done by allowing only a limited number of wallet addresses to be used for NFTs.
  • According to @ether_dr, the BAYC team can also use the raffle method to avoid a large number of NFT buyers minting at the same time. This mechanism can ensure fair distribution to NFT buyers.
  • Lastly, @ether_dr also proposed limiting the number of mints using off-chain methods. It works like this: A secure, well-coded server will issue codes based upon specific mint rates. The server will then place you in a queue to get into the next minting position. The server will then pass these codes on to the smart contract with Merkleproof for verification.

Final thoughts

All in all, the BAYC team could have performed gas optimization in so many ways on its land sale contract. To avoid gas wars, the team could have used batch minting or allowlist.

But instead, the team put the blame on the lack of scalability of the Ethereum network and proposed to migrate APEcoin to its own blockchain. Rumours arose on Twitter that the smart contract that was poorly written was part of the plan to allow the team’s own blockchain. We will let you decide if this is true.


Are you tired of missing important NFT drops?

Just check out our NFT Calendar!

Receive the biggest NFT news of the day & recommendations in our Daily newsletter.


All investment/financial opinions expressed by NFTevening.com are not recommendations.

This article is educational material.

As always, make your own research prior to making any kind of investment.

Read More

Henry Hicks
Henry Hickshttps://nonfungibletalk.com
NFT and Crypto Enthusiast. Loves Travelling and Exploring the Metaverse!
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!

Please enter your name here

Subscribe to our newsletter

To be updated with all the latest news, offers and special announcements.

Most Popular