Skip to content
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

Add burn feature #2

Closed
wants to merge 2 commits into from
Closed

Add burn feature #2

wants to merge 2 commits into from

Conversation

hskang9
Copy link

@hskang9 hskang9 commented Jan 14, 2022

I tried to add burn feature for ERC721A contract. Currently address(0) is occupied for ownership inclusion, so I used address(1) for marking burned address.

Copy link
Contributor

@AndreiD AndreiD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@hskang9
Copy link
Author

hskang9 commented Jan 15, 2022

@chiru-labs Is there a concern for this change?

*/
function _safeBurn(
uint256 tokenId,
bytes memory _data
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a reason for this parameter not being used?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought this was needed for receiver, but feel free to remove if it is not needed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to ask for _safeMint function as well

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be kept; makes it easier for other implementations to pass/use arbitrary data, should they want to

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, I agree too, thanks for the clarification!

@cygaar
Copy link
Collaborator

cygaar commented Jan 18, 2022

Hey, thanks for the PR. We will have a more built out version of the repo soon after which we'll need you to write some tests for this. Stay tuned

@MrMcGoats
Copy link

Was just looking at this again, and it looks like _safeBurn(uint256) just calls itself

ERC721A.sol Outdated Show resolved Hide resolved
chiru-labs added a commit that referenced this pull request Jan 22, 2022
Co-authored-by: 2pmflow <2pmflow@chirulabs.com>
@hskang9
Copy link
Author

hskang9 commented Jan 23, 2022

Was just looking at this again, and it looks like _safeBurn(uint256) just calls itself

no @MrMcGoats, as you can see from @AndreiD, it has another function to cover implementation like _safeMint

@harry830622
Copy link

You should check tokenId+1 and update it accordingly just like transfer or the tokens after tokenId will be burnt as well.
Also using 0x0000...dead for burn address would be more intuitive IMO.

@harry830622
Copy link

In addition, most of the view functions need to be updated to consider the burnt tokens.

@hskang9
Copy link
Author

hskang9 commented Jan 24, 2022

You should check tokenId+1 and update it accordingly just like transfer or the tokens after tokenId will be burnt as well.
Also using 0x0000...dead for burn address would be more intuitive IMO.

This is true. I will add that

@hskang9
Copy link
Author

hskang9 commented Jan 24, 2022

In addition, most of the view functions need to be updated to consider the burnt tokens.

I am not sure if there is a view function to check burns in usual ERC721 though. For the backward compatibility, I will pass on this and let frontend handle.

@MrMcGoats
Copy link

MrMcGoats commented Jan 24, 2022

Was just looking at this again, and it looks like _safeBurn(uint256) just calls itself

no @MrMcGoats, as you can see from @AndreiD, it has another function to cover implementation like _safeMint

@hskang9
I'm not seeing any other function defined as _safeBurn(uint256) apart from the one on line 331. However, if that exists, I don't see the point in wrapping it with a function that has the exact same name and parameters.

As far as I can tell, this is not done with _safeMint(address,uint256). The only implementation of that function that I can find (line 350) calls _safeMint(address,uint256,bytes)

@hskang9
Copy link
Author

hskang9 commented Jan 29, 2022

My bad, after looking at the code again, I missed adding "" for bytes argument for _safeBurn impl func, so I changed the code. Thank you for finding this.

@ahbanavi
Copy link
Contributor

I think we should close this, cause #61 is more likely to be merged soon.

@cygaar
Copy link
Collaborator

cygaar commented Feb 16, 2022

Thanks for the contribution, closing this since we've merged in burn functionality

@cygaar cygaar closed this Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants