erc721r / ERC721R

An ERC721 base contract that mints tokens in a pseudo-random order. Because the token is revealed in the same transaction as the mint itself, this contract creates a fun but not fully secure experience.
MIT License
96 stars 22 forks source link

Always delete data at lastIndex. #7

Closed Roger-Wu closed 2 years ago

Roger-Wu commented 2 years ago

The current code will not delete _availableTokens[lastIndex], when indexToUse happens to be the same as lastIndex.

We fixed this issue with this commit.

RogerPodacter commented 2 years ago

Good call! The final value should always be zero at the end of the tx because it is forever-inaccessible due to the decrement of _numAvailableTokens!