forked from Vectorized/closedsea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExampleERC721AUpgradeable.sol
69 lines (62 loc) · 2.07 KB
/
ExampleERC721AUpgradeable.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import {ERC721AUpgradeable} from "erc721a-upgradeable/ERC721AUpgradeable.sol";
import {OperatorFilterer} from "../../OperatorFilterer.sol";
import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/access/OwnableUpgradeable.sol";
/**
* @title ExampleERC721AUpgradeable
* @notice This example contract is configured to use the DefaultOperatorFilterer, which automatically registers the
* token and subscribes it to OpenSea's curated filters.
* Adding the onlyAllowedOperator modifier to the transferFrom and both safeTransferFrom methods ensures that
* the msg.sender (operator) is allowed by the OperatorFilterRegistry.
*/
abstract contract ExampleERC721AUpgradeable is
ERC721AUpgradeable,
OperatorFilterer,
OwnableUpgradeable
{
function initialize() public initializer initializerERC721A {
__ERC721A_init("Example", "EXAMPLE");
__Ownable_init();
_registerForOperatorFiltering();
}
function setApprovalForAll(address operator, bool approved)
public
override
onlyAllowedOperatorApproval(operator)
{
super.setApprovalForAll(operator, approved);
}
function approve(address operator, uint256 tokenId)
public
payable
override
onlyAllowedOperatorApproval(operator)
{
super.approve(operator, tokenId);
}
function transferFrom(address from, address to, uint256 tokenId)
public
payable
override
onlyAllowedOperator(from)
{
super.transferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId)
public
payable
override
onlyAllowedOperator(from)
{
super.safeTransferFrom(from, to, tokenId);
}
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data)
public
payable
override
onlyAllowedOperator(from)
{
super.safeTransferFrom(from, to, tokenId, data);
}
}