NFT News

10 Ways BAYC Could Have Improved Its Land Sale Contract

BAYC land sale contract needs a revamp.


BAYC dropped its highly-anticipated metaverse project, The Otherside, two days ago. And the NFT drop crashed the Etherscan big time. In total, NFT buyers forked out more than $70 million in Ethereum gas fees just to mint some of these exclusive land NFTs. Looking at the crazy gas prices, many took to Twitter to share ways on how the BAYC team could have improved its land sale contract and minting mechanics.

Oh, wait, did you say 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. Hence, we have compiled several useful suggestions from the top devs on Web3 in this article. This includes proposals coming from Twitter users such as @CaptainDefi2, @iamarkdev, and more. Let’s take 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. According to @CaptainDefi2, since BAYC is transferring funds back to the same contract, they would not need this function at all. Thus, this would save them a Call function to 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. Revising it to “msg.sender == tx.origin” will do.
"safeMint" function on the BAYC land sale contract.
“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 multiple checks when running the entire contract. According to @WillPapper, they can also switch from _safeMint() to _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 also proposed to use “unchecked {i++}” on the BAYC land sale contract, to save gas on 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. With this type of ERC standard, you can mint multiple NFTs for the same cost as minting a 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. This is a no-brainer! 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. But if the BAYC team were to avoid using ranges, they could save users a ton of gas fees per the table above.

Better minting mechanics

  • According to @WillPapper from the Syndicate, gas optimization is just part of the equation. The BAYC team would also need to come up with better minting mechanics to avoid everyone minting at the same time. For instance, go for batch minting by allowlist a certain amount of wallet addresses to mint NFTs at a time.
  • 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. In fact, this mechanism can also ensure some sort of fair distribution to the NFT buyers.
  • Lastly, @ether_dr also proposed limiting the number of mints using off-chain methods. How it works is that a well-coded, secure server will issue codes based on specific rates of mints. Then, the server will queue you up into the next position to mint. Next, the server will pass these codes to the smart contract with Merkle proof for verification, before you mint the NFTs.

Final thoughts

All in all, the BAYC team could have performed gas optimization in so many ways on its land sale contract. Not to mention that the team could have used some sort of batch minting or allowlist to avoid gas wars.

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. Given that, speculations went rife on Twitter that the poorly written smart contract was part of the plan for the team to push out its own blockchain. Whether this is true or not, we will leave it to your discretion.


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.



Source link

Tagged

Leave a Reply

Your email address will not be published. Required fields are marked *