Skip to content

Commit 401447a

Browse files
authored
Update Solidity version and refactor ContractMetadata
Signed-off-by: sonnyquinn24 <227287527+sonnyquinn24@users.noreply.github.com>
1 parent 0da770f commit 401447a

File tree

1 file changed

+15
-38
lines changed

1 file changed

+15
-38
lines changed
Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,25 @@
11
// SPDX-License-Identifier: Apache-2.0
2-
pragma solidity ^0.8.0;
2+
pragma solidity ^0.8.19;
33

4-
/// @author thirdweb
4+
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
5+
import "@openzeppelin/contracts/access/Ownable.sol";
6+
import "./ContractMetadata.sol";
57

6-
import "./interface/IContractMetadata.sol";
8+
contract RebelByNature is ERC721URIStorage, Ownable, ContractMetadata {
9+
uint256 public nextTokenId;
710

8-
/**
9-
* @title Contract Metadata
10-
* @notice Thirdweb's `ContractMetadata` is a contract extension for any base contracts. It lets you set a metadata URI
11-
* for you contract.
12-
* Additionally, `ContractMetadata` is necessary for NFT contracts that want royalties to get distributed on OpenSea.
13-
*/
11+
event TributeMinted(uint256 tokenId, address recipient, uint256 timestamp);
1412

15-
abstract contract ContractMetadata is IContractMetadata {
16-
/// @dev The sender is not authorized to perform the action
17-
error ContractMetadataUnauthorized();
13+
constructor() ERC721("Rebel By Nature", "SEQREB") {}
1814

19-
/// @notice Returns the contract metadata URI.
20-
string public override contractURI;
21-
22-
/**
23-
* @notice Lets a contract admin set the URI for contract-level metadata.
24-
* @dev Caller should be authorized to setup contractURI, e.g. contract admin.
25-
* See {_canSetContractURI}.
26-
* Emits {ContractURIUpdated Event}.
27-
*
28-
* @param _uri keccak256 hash of the role. e.g. keccak256("TRANSFER_ROLE")
29-
*/
30-
function setContractURI(string memory _uri) external override {
31-
if (!_canSetContractURI()) {
32-
revert ContractMetadataUnauthorized();
33-
}
34-
35-
_setupContractURI(_uri);
15+
function mintTribute(address recipient) external onlyOwner {
16+
uint256 tokenId = nextTokenId++;
17+
_mint(recipient, tokenId);
18+
_setTokenURI(tokenId, contractURI);
19+
emit TributeMinted(tokenId, recipient, block.timestamp);
3620
}
3721

38-
/// @dev Lets a contract admin set the URI for contract-level metadata.
39-
function _setupContractURI(string memory _uri) internal {
40-
string memory prevURI = contractURI;
41-
contractURI = _uri;
42-
43-
emit ContractURIUpdated(prevURI, _uri);
22+
function _canSetContractURI() internal view override returns (bool) {
23+
return msg.sender == owner();
4424
}
45-
46-
/// @dev Returns whether contract metadata can be set in the given execution context.
47-
function _canSetContractURI() internal view virtual returns (bool);
4825
}

0 commit comments

Comments
 (0)