Skip to content

Commit

Permalink
Implement BurnExtension contract
Browse files Browse the repository at this point in the history
  • Loading branch information
AutoPR committed Apr 30, 2023
1 parent a59cf87 commit 931b3b8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion contracts/extensions/BurnExtension.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,21 @@ pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";

contract BurnExtension is ERC721Enumerable {
constructor(string memory _name, string memory _symbol) ERC721Enumerable(_name, _symbol) {}
uint256 private _maxSupply;

constructor(string memory _name, string memory _symbol, uint256 maxSupply) ERC721Enumerable(_name, _symbol) {
_maxSupply = maxSupply;
}

function burn(uint256 tokenId) public {
require(_exists(tokenId), "Token does not exist");
require(ownerOf(tokenId) == _msgSender(), "Not token owner");

_burn(tokenId);
_maxSupply--;
}

function maxSupply() public view returns (uint256) {
return _maxSupply;
}
}

0 comments on commit 931b3b8

Please sign in to comment.