- Renowned NFT creator ben.eth suffered a financial setback due to a logic error in his latest NFT contract.
- The error was caused by a programming oversight in the contract’s code, specifically related to the “maxSupply” variable.
- The oversight led to a loss of approximately 100 ETH in potential profits for ben.eth.
In a surprising turn of events, renowned NFT creator ben.eth has suffered a significant financial setback due to a crucial logic error in his latest NFT contract. The oversight resulted in the unintended capping of the collection size to 9,000 tokens instead of the intended 10,000, causing him to miss approximately 100 ETH in profits.
There is a huge logic error in ben.eth’s latest NFT contract that capped the collection size to 9k instead of the 10k he intended it to be lmao.
He effectively lost out on 100 ETH of profits because of one line of code 🤦♂️.
Here’s an explanation of the bug: pic.twitter.com/YvMONlFJAO
— cygaar (@0xCygaar) June 1, 2023
The issue stems from a single line of code within the contract, specifically about the “maxSupply” variable. Initially set to 10,000, this variable was meant to represent the supply cap for the collection.
However, upon examining line 46 of the contract, it becomes evident that the variable “available supply” determines the number of mints available to the public. Consequently, the team was allocated 1,000 mints, resulting in the “available supply” value being set to 9,000.
The problem escalates when examining L61 of the contract, which checks that the total number of NFTs minted is at most 10,000. Regrettably, the contract owner had already minted 1,000 NFTs immediately after deployment, increasing the “total supply” to 1,000. Due to this alteration, the maximum available supply for users was limited to 8,000 rather than the intended 9,000.
Now if we go to L61, there’s a check to make sure that the total number of NFTs minted doesn’t exceed 10k.
This is where the problems arise. You see, the contract owner minted 1000 NFTs immediately after deployment. By doing so, they increased the value of totalSupply() to 1000. pic.twitter.com/IdxHJbb9kv
— cygaar (@0xCygaar) June 1, 2023
The issue arises because the cap should have been set to the original value of 10,000, given that the owner minted first. Instead, the oversight caused the collection to be capped at 9,000 tokens.
To rectify this issue, L61 should have been programmed to compare “totalSupply” with “maxSupply,” rather than “availableMaxSupply.” The latter variable would have been relevant only if public and owner mints coincided.
Due to this programming error, ben.eth has experienced a substantial financial loss, missing an estimated 100 ETH in potential profits. The incident is a stark reminder of the critical importance of thorough code review and meticulous testing, especially in the rapidly evolving world of non-fungible tokens.
While the error has undoubtedly been a setback for ben.eth, it also emphasizes the need for increased diligence among NFT creators and developers to ensure the integrity and functionality of their contracts.
As the NFT market expands, such oversights can have significant financial implications, underscoring the necessity for comprehensive quality assurance processes.
Ben.eth is expected to address the issue promptly and provide a resolution for affected users. In the meantime, this incident serves as a valuable lesson for both creators and consumers of NFTs, highlighting the importance of vigilance and due diligence in the rapidly evolving digital asset landscape.