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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions ERC721A.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ contract ERC721A is
uint256 private currentIndex = 0;

uint256 internal immutable maxBatchSize;

address private burned = address(1);

// Token name
string private _name;
Expand Down Expand Up @@ -325,6 +327,25 @@ contract ERC721A is
function _exists(uint256 tokenId) internal view returns (bool) {
return tokenId < currentIndex;
}

function _safeBurn(uint256 tokenId) internal {
_safeBurn(tokenId);
hskang9 marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* @dev Burns a certain token from id.
*
* Emits a {Transfer} event.
*/
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!

) internal {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
_addressData[prevOwnership.addr].balance -= 1;
_ownerships[tokenId] = TokenOwnership(burned, uint64(block.timestamp));
emit Transfer(prevOwnership.addr, burned, tokenId);
}

function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, "");
Expand Down