Users are not incentivized to mint last tokens of any of the generations #921
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
duplicate-564
🤖_03_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-07-traitforge/blob/279b2887e3d38bc219a05d332cbcb0655b2dc644/contracts/TraitForgeNft/TraitForgeNft.sol#L345-L355
Vulnerability details
Impact
When a use tries to mint a TraitForgeNft, the calculateMintPrice() function is used to get the cost price of the NFT. We will easily note that first token of 1st gen costs 0.005 ETH, while last token of 1st gen costs 0.25 ETH, which means 50 times the cost of the first token with no guarantees of having better features. This happens because the function takes into account how many NFTs of this gen (up to 10000) have been minted to get the price for the next NFT.
The cost of 1st token of 2nd gen will be 0.005005 ETH, so the conclusion is that nobody will be willing to pay for last tokens of a generation and will wait for next generation to start to mint cheap NFTs, leading to a unexpected behaviour of the system or even reaching a locked situation.
Tools Used
Manual review.
Recommended Mitigation Steps
A good way to solve this problem would be to make that expensive tokens have better properties than cheap ones, but this looks complex as it would require to modify great part of the protocol.
The recommended way is to make tokens more and more expensive as they are minted, this way users will be incentivized to mint as soon as possible. Update startPrice to currentPrice when gen is about to be increased, so that next time
calculateMintPrice()
is called, the resulting price is higher:Assessed type
Payable
The text was updated successfully, but these errors were encountered: