-
Notifications
You must be signed in to change notification settings - Fork 394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing walletOfOwner behavior with burned tokens #225
Conversation
Probable fix for walletOfOwner function when burning is enabled
Bracket was placed wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @tomvanleeuwennl, for this contribution.
It looks good to me, let me know what you think about the changes I requested (especially the one about the "burned" status). If you apply those, then I can test this implementation locally to ensure everything works as expected with a basic contract supporting the burning feature.
Fixed bracket position Removed redundant ownership burned check after _exists function
Added an extra line after a bracket
@liarco I've made the requested changes |
Why cant we use this line directly?
the token burning works properly using this Let me know if I am missing anything though... |
Yes you can use that burn function. This is something totally different. This has to do with retrieving the right tokens belonging to the address used as the _owner parameter in the walletofowner function. When you allow to burn tokens the current walletofowner function acts in the wrong way. Therefor this change is needed to act in the right way. |
The implementation seems to be fine now, I tested it with a dedicated project using the "burn" feature and the returned tokens were correct. @tomvanleeuwennl thank you for your contribution, please let me know if this works for you as well. |
@liarco Can you please explain why still this line is needed: if (ownership.addr != address(0)) { |
@tomvanleeuwennl
And this is how we can save so much gas when minting multiple tokens: we don't update the ownership data for all of the tokens, but just for the first one. P.S. the reason why you didn't need it in your previous implementation was because you were using |
So, just for my own validation... This is the start situation:
What happen to tokens 3, 5 and 6 when first token 2 is burned and token 4 is transferred to 0x123aaa? |
@tomvanleeuwennl the final situation should be the following:
This behavior is well documented here: https://github.com/chiru-labs/ERC721A/blob/f1f202c782930a74951b52574d53904972303ad1/contracts/ERC721A.sol#L485 |
Should be the following then I think. Because token 1 is untouched. But now I understand. Thank you!
|
@tomvanleeuwennl You are right, sorry. I read |
This is my proposal for the walletOfOwner function to act in the right way when having burned tokens.
Fixes #128