@bananapus/721-hook-v6 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gas-snapshot +152 -0
- package/LICENSE +21 -0
- package/README.md +253 -0
- package/SKILLS.md +140 -0
- package/docs/book.css +13 -0
- package/docs/book.toml +12 -0
- package/docs/solidity.min.js +74 -0
- package/docs/src/README.md +253 -0
- package/docs/src/SUMMARY.md +38 -0
- package/docs/src/src/JB721TiersHook.sol/contract.JB721TiersHook.md +645 -0
- package/docs/src/src/JB721TiersHookDeployer.sol/contract.JB721TiersHookDeployer.md +99 -0
- package/docs/src/src/JB721TiersHookProjectDeployer.sol/contract.JB721TiersHookProjectDeployer.md +288 -0
- package/docs/src/src/JB721TiersHookStore.sol/contract.JB721TiersHookStore.md +1096 -0
- package/docs/src/src/README.md +11 -0
- package/docs/src/src/abstract/ERC721.sol/abstract.ERC721.md +430 -0
- package/docs/src/src/abstract/JB721Hook.sol/abstract.JB721Hook.md +309 -0
- package/docs/src/src/abstract/README.md +5 -0
- package/docs/src/src/interfaces/IJB721Hook.sol/interface.IJB721Hook.md +29 -0
- package/docs/src/src/interfaces/IJB721TiersHook.sol/interface.IJB721TiersHook.md +203 -0
- package/docs/src/src/interfaces/IJB721TiersHookDeployer.sol/interface.IJB721TiersHookDeployer.md +25 -0
- package/docs/src/src/interfaces/IJB721TiersHookProjectDeployer.sol/interface.IJB721TiersHookProjectDeployer.md +64 -0
- package/docs/src/src/interfaces/IJB721TiersHookStore.sol/interface.IJB721TiersHookStore.md +265 -0
- package/docs/src/src/interfaces/IJB721TokenUriResolver.sol/interface.IJB721TokenUriResolver.md +12 -0
- package/docs/src/src/interfaces/README.md +9 -0
- package/docs/src/src/libraries/JB721Constants.sol/library.JB721Constants.md +14 -0
- package/docs/src/src/libraries/JB721TiersRulesetMetadataResolver.sol/library.JB721TiersRulesetMetadataResolver.md +68 -0
- package/docs/src/src/libraries/JBBitmap.sol/library.JBBitmap.md +82 -0
- package/docs/src/src/libraries/JBIpfsDecoder.sol/library.JBIpfsDecoder.md +61 -0
- package/docs/src/src/libraries/README.md +7 -0
- package/docs/src/src/structs/JB721InitTiersConfig.sol/struct.JB721InitTiersConfig.md +27 -0
- package/docs/src/src/structs/JB721Tier.sol/struct.JB721Tier.md +59 -0
- package/docs/src/src/structs/JB721TierConfig.sol/struct.JB721TierConfig.md +60 -0
- package/docs/src/src/structs/JB721TiersHookFlags.sol/struct.JB721TiersHookFlags.md +26 -0
- package/docs/src/src/structs/JB721TiersMintReservesConfig.sol/struct.JB721TiersMintReservesConfig.md +16 -0
- package/docs/src/src/structs/JB721TiersRulesetMetadata.sol/struct.JB721TiersRulesetMetadata.md +20 -0
- package/docs/src/src/structs/JB721TiersSetDiscountPercentConfig.sol/struct.JB721TiersSetDiscountPercentConfig.md +16 -0
- package/docs/src/src/structs/JBBitmapWord.sol/struct.JBBitmapWord.md +19 -0
- package/docs/src/src/structs/JBDeploy721TiersHookConfig.sol/struct.JBDeploy721TiersHookConfig.md +34 -0
- package/docs/src/src/structs/JBLaunchProjectConfig.sol/struct.JBLaunchProjectConfig.md +23 -0
- package/docs/src/src/structs/JBLaunchRulesetsConfig.sol/struct.JBLaunchRulesetsConfig.md +22 -0
- package/docs/src/src/structs/JBPayDataHookRulesetConfig.sol/struct.JBPayDataHookRulesetConfig.md +51 -0
- package/docs/src/src/structs/JBPayDataHookRulesetMetadata.sol/struct.JBPayDataHookRulesetMetadata.md +66 -0
- package/docs/src/src/structs/JBQueueRulesetsConfig.sol/struct.JBQueueRulesetsConfig.md +21 -0
- package/docs/src/src/structs/JBStored721Tier.sol/struct.JBStored721Tier.md +42 -0
- package/docs/src/src/structs/README.md +18 -0
- package/foundry.lock +11 -0
- package/foundry.toml +22 -0
- package/package.json +31 -0
- package/remappings.txt +1 -0
- package/script/Deploy.s.sol +140 -0
- package/script/helpers/Hook721DeploymentLib.sol +81 -0
- package/slither-ci.config.json +10 -0
- package/sphinx.lock +476 -0
- package/src/JB721TiersHook.sol +765 -0
- package/src/JB721TiersHookDeployer.sol +114 -0
- package/src/JB721TiersHookProjectDeployer.sol +413 -0
- package/src/JB721TiersHookStore.sol +1195 -0
- package/src/abstract/ERC721.sol +484 -0
- package/src/abstract/JB721Hook.sol +279 -0
- package/src/interfaces/IJB721Hook.sol +21 -0
- package/src/interfaces/IJB721TiersHook.sol +135 -0
- package/src/interfaces/IJB721TiersHookDeployer.sol +22 -0
- package/src/interfaces/IJB721TiersHookProjectDeployer.sol +76 -0
- package/src/interfaces/IJB721TiersHookStore.sol +220 -0
- package/src/interfaces/IJB721TokenUriResolver.sol +10 -0
- package/src/libraries/JB721Constants.sol +7 -0
- package/src/libraries/JB721TiersRulesetMetadataResolver.sol +44 -0
- package/src/libraries/JBBitmap.sol +57 -0
- package/src/libraries/JBIpfsDecoder.sol +95 -0
- package/src/structs/JB721InitTiersConfig.sol +20 -0
- package/src/structs/JB721Tier.sol +39 -0
- package/src/structs/JB721TierConfig.sol +40 -0
- package/src/structs/JB721TiersHookFlags.sol +17 -0
- package/src/structs/JB721TiersMintReservesConfig.sol +9 -0
- package/src/structs/JB721TiersRulesetMetadata.sol +12 -0
- package/src/structs/JB721TiersSetDiscountPercentConfig.sol +9 -0
- package/src/structs/JBBitmapWord.sol +11 -0
- package/src/structs/JBDeploy721TiersHookConfig.sol +25 -0
- package/src/structs/JBLaunchProjectConfig.sol +18 -0
- package/src/structs/JBLaunchRulesetsConfig.sol +17 -0
- package/src/structs/JBPayDataHookRulesetConfig.sol +44 -0
- package/src/structs/JBPayDataHookRulesetMetadata.sol +46 -0
- package/src/structs/JBQueueRulesetsConfig.sol +13 -0
- package/src/structs/JBStored721Tier.sol +24 -0
- package/test/721HookAttacks.t.sol +396 -0
- package/test/E2E/Pay_Mint_Redeem_E2E.t.sol +944 -0
- package/test/invariants/TierLifecycleInvariant.t.sol +187 -0
- package/test/invariants/TieredHookStoreInvariant.t.sol +81 -0
- package/test/invariants/handlers/TierLifecycleHandler.sol +262 -0
- package/test/invariants/handlers/TierStoreHandler.sol +155 -0
- package/test/unit/JB721TiersRulesetMetadataResolver.t.sol +141 -0
- package/test/unit/JBBitmap.t.sol +169 -0
- package/test/unit/JBIpfsDecoder.t.sol +131 -0
- package/test/unit/M6_TierSupplyCheck.t.sol +220 -0
- package/test/unit/adjustTier_Unit.t.sol +1740 -0
- package/test/unit/deployer_Unit.t.sol +103 -0
- package/test/unit/getters_constructor_Unit.t.sol +548 -0
- package/test/unit/mintFor_mintReservesFor_Unit.t.sol +443 -0
- package/test/unit/pay_Unit.t.sol +1537 -0
- package/test/unit/redeem_Unit.t.sol +459 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
# Contents
|
|
4
|
+
- [abstract](/src/abstract)
|
|
5
|
+
- [interfaces](/src/interfaces)
|
|
6
|
+
- [libraries](/src/libraries)
|
|
7
|
+
- [structs](/src/structs)
|
|
8
|
+
- [JB721TiersHook](JB721TiersHook.sol/contract.JB721TiersHook.md)
|
|
9
|
+
- [JB721TiersHookDeployer](JB721TiersHookDeployer.sol/contract.JB721TiersHookDeployer.md)
|
|
10
|
+
- [JB721TiersHookProjectDeployer](JB721TiersHookProjectDeployer.sol/contract.JB721TiersHookProjectDeployer.md)
|
|
11
|
+
- [JB721TiersHookStore](JB721TiersHookStore.sol/contract.JB721TiersHookStore.md)
|
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
# ERC721
|
|
2
|
+
[Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/abstract/ERC721.sol)
|
|
3
|
+
|
|
4
|
+
**Inherits:**
|
|
5
|
+
Context, ERC165, IERC721, IERC721Metadata, IERC721Errors
|
|
6
|
+
|
|
7
|
+
*Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
|
|
8
|
+
the Metadata extension, but not including the Enumerable extension, which is available separately as
|
|
9
|
+
{ERC721Enumerable}.*
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
## State Variables
|
|
13
|
+
### _name
|
|
14
|
+
|
|
15
|
+
```solidity
|
|
16
|
+
string private _name;
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### _symbol
|
|
21
|
+
|
|
22
|
+
```solidity
|
|
23
|
+
string private _symbol;
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### _owners
|
|
28
|
+
|
|
29
|
+
```solidity
|
|
30
|
+
mapping(uint256 tokenId => address) internal _owners;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### _balances
|
|
35
|
+
|
|
36
|
+
```solidity
|
|
37
|
+
mapping(address owner => uint256) private _balances;
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### _tokenApprovals
|
|
42
|
+
|
|
43
|
+
```solidity
|
|
44
|
+
mapping(uint256 tokenId => address) private _tokenApprovals;
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
### _operatorApprovals
|
|
49
|
+
|
|
50
|
+
```solidity
|
|
51
|
+
mapping(address owner => mapping(address operator => bool)) private _operatorApprovals;
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Functions
|
|
56
|
+
### _initialize
|
|
57
|
+
|
|
58
|
+
*Initializes the contract by setting a `name` and a `symbol` to the token collection.*
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
```solidity
|
|
62
|
+
function _initialize(string memory name_, string memory symbol_) internal;
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### supportsInterface
|
|
66
|
+
|
|
67
|
+
*See [IERC165-supportsInterface](/src/abstract/JB721Hook.sol/abstract.JB721Hook.md#supportsinterface).*
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
```solidity
|
|
71
|
+
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool);
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### balanceOf
|
|
75
|
+
|
|
76
|
+
*See [IERC721-balanceOf](/src/JB721TiersHook.sol/contract.JB721TiersHook.md#balanceof).*
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
```solidity
|
|
80
|
+
function balanceOf(address owner) public view virtual returns (uint256);
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### ownerOf
|
|
84
|
+
|
|
85
|
+
*See [IERC721-ownerOf](/lib/forge-std/test/StdCheats.t.sol/contract.BarERC721.md#ownerof).*
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
```solidity
|
|
89
|
+
function ownerOf(uint256 tokenId) public view virtual returns (address);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### name
|
|
93
|
+
|
|
94
|
+
*See [IERC721Metadata-name](/lib/forge-std/src/interfaces/IERC20.sol/interface.IERC20.md#name).*
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
```solidity
|
|
98
|
+
function name() public view virtual returns (string memory);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### symbol
|
|
102
|
+
|
|
103
|
+
*See [IERC721Metadata-symbol](/lib/forge-std/src/interfaces/IERC20.sol/interface.IERC20.md#symbol).*
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
```solidity
|
|
107
|
+
function symbol() public view virtual returns (string memory);
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### tokenURI
|
|
111
|
+
|
|
112
|
+
*See [IERC721Metadata-tokenURI](/src/JB721TiersHook.sol/contract.JB721TiersHook.md#tokenuri).*
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
```solidity
|
|
116
|
+
function tokenURI(uint256 tokenId) public view virtual returns (string memory);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### _baseURI
|
|
120
|
+
|
|
121
|
+
*Base URI for computing [tokenURI](/src/abstract/ERC721.sol/abstract.ERC721.md#tokenuri). If set, the resulting URI for each
|
|
122
|
+
token will be the concatenation of the `baseURI` and the `tokenId`. Empty
|
|
123
|
+
by default, can be overridden in child contracts.*
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
```solidity
|
|
127
|
+
function _baseURI() internal view virtual returns (string memory);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### approve
|
|
131
|
+
|
|
132
|
+
*See [IERC721-approve](/lib/forge-std/src/mocks/MockERC20.sol/contract.MockERC20.md#approve).*
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
```solidity
|
|
136
|
+
function approve(address to, uint256 tokenId) public virtual;
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### getApproved
|
|
140
|
+
|
|
141
|
+
*See [IERC721-getApproved](/lib/forge-std/src/interfaces/IERC721.sol/interface.IERC721.md#getapproved).*
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
```solidity
|
|
145
|
+
function getApproved(uint256 tokenId) public view virtual returns (address);
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### setApprovalForAll
|
|
149
|
+
|
|
150
|
+
*See [IERC721-setApprovalForAll](/lib/forge-std/src/mocks/MockERC721.sol/contract.MockERC721.md#setapprovalforall).*
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
```solidity
|
|
154
|
+
function setApprovalForAll(address operator, bool approved) public virtual;
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### isApprovedForAll
|
|
158
|
+
|
|
159
|
+
*See [IERC721-isApprovedForAll](/lib/forge-std/src/interfaces/IERC1155.sol/interface.IERC1155.md#isapprovedforall).*
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
```solidity
|
|
163
|
+
function isApprovedForAll(address owner, address operator) public view virtual returns (bool);
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### transferFrom
|
|
167
|
+
|
|
168
|
+
*See [IERC721-transferFrom](/lib/forge-std/src/mocks/MockERC20.sol/contract.MockERC20.md#transferfrom).*
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
```solidity
|
|
172
|
+
function transferFrom(address from, address to, uint256 tokenId) public virtual;
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### safeTransferFrom
|
|
176
|
+
|
|
177
|
+
*See [IERC721-safeTransferFrom](/lib/forge-std/src/mocks/MockERC721.sol/contract.MockERC721.md#safetransferfrom).*
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
```solidity
|
|
181
|
+
function safeTransferFrom(address from, address to, uint256 tokenId) public;
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### safeTransferFrom
|
|
185
|
+
|
|
186
|
+
*See [IERC721-safeTransferFrom](/lib/forge-std/src/mocks/MockERC721.sol/contract.MockERC721.md#safetransferfrom).*
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
```solidity
|
|
190
|
+
function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual;
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### _ownerOf
|
|
194
|
+
|
|
195
|
+
*Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
|
|
196
|
+
IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
|
|
197
|
+
core ERC721 logic MUST be matched with the use of [_increaseBalance](/src/abstract/ERC721.sol/abstract.ERC721.md#_increasebalance) to keep balances
|
|
198
|
+
consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
|
|
199
|
+
`balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.*
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
```solidity
|
|
203
|
+
function _ownerOf(uint256 tokenId) internal view virtual returns (address);
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### _getApproved
|
|
207
|
+
|
|
208
|
+
*Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.*
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
```solidity
|
|
212
|
+
function _getApproved(uint256 tokenId) internal view virtual returns (address);
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### _isAuthorized
|
|
216
|
+
|
|
217
|
+
*Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
|
|
218
|
+
particular (ignoring whether it is owned by `owner`).
|
|
219
|
+
WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
|
|
220
|
+
assumption.*
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
```solidity
|
|
224
|
+
function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### _checkAuthorized
|
|
228
|
+
|
|
229
|
+
*Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
|
|
230
|
+
Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
|
|
231
|
+
the `spender` for the specific `tokenId`.
|
|
232
|
+
WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
|
|
233
|
+
assumption.*
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
```solidity
|
|
237
|
+
function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual;
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### _increaseBalance
|
|
241
|
+
|
|
242
|
+
*Unsafe write access to the balances, used by extensions that "mint" tokens using an [ownerOf](/src/abstract/ERC721.sol/abstract.ERC721.md#ownerof) override.
|
|
243
|
+
NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
|
|
244
|
+
a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
|
|
245
|
+
WARNING: Increasing an account's balance using this function tends to be paired with an override of the
|
|
246
|
+
{_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
|
|
247
|
+
remain consistent with one another.*
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
```solidity
|
|
251
|
+
function _increaseBalance(address account, uint128 value) internal virtual;
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### _update
|
|
255
|
+
|
|
256
|
+
*Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
|
|
257
|
+
(or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
|
|
258
|
+
The `auth` argument is optional. If the value passed is non 0, then this function will check that
|
|
259
|
+
`auth` is either the owner of the token, or approved to operate on the token (by the owner).
|
|
260
|
+
Emits a {Transfer} event.
|
|
261
|
+
NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.*
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
```solidity
|
|
265
|
+
function _update(address to, uint256 tokenId, address auth) internal virtual returns (address);
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### _mint
|
|
269
|
+
|
|
270
|
+
*Mints `tokenId` and transfers it to `to`.
|
|
271
|
+
WARNING: Usage of this method is discouraged, use [_safeMint](/src/abstract/ERC721.sol/abstract.ERC721.md#_safemint) whenever possible
|
|
272
|
+
Requirements:
|
|
273
|
+
- `tokenId` must not exist.
|
|
274
|
+
- `to` cannot be the zero address.
|
|
275
|
+
Emits a {Transfer} event.*
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
```solidity
|
|
279
|
+
function _mint(address to, uint256 tokenId) internal;
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### _safeMint
|
|
283
|
+
|
|
284
|
+
*Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
|
|
285
|
+
Requirements:
|
|
286
|
+
- `tokenId` must not exist.
|
|
287
|
+
- If `to` refers to a smart contract, it must implement [IERC721Receiver-onERC721Received](/lib/forge-std/test/mocks/MockERC721.t.sol/contract.ERC721Recipient.md#onerc721received), which is called upon
|
|
288
|
+
a safe transfer.
|
|
289
|
+
Emits a {Transfer} event.*
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
```solidity
|
|
293
|
+
function _safeMint(address to, uint256 tokenId) internal;
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### _safeMint
|
|
297
|
+
|
|
298
|
+
*Same as [`_safeMint`](/lib/forge-std/src/mocks/MockERC721.sol/contract.MockERC721.md#_safemint), with an additional `data` parameter which is
|
|
299
|
+
forwarded in {IERC721Receiver-onERC721Received} to contract recipients.*
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
```solidity
|
|
303
|
+
function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual;
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### _burn
|
|
307
|
+
|
|
308
|
+
*Destroys `tokenId`.
|
|
309
|
+
The approval is cleared when the token is burned.
|
|
310
|
+
This is an internal function that does not check if the sender is authorized to operate on the token.
|
|
311
|
+
Requirements:
|
|
312
|
+
- `tokenId` must exist.
|
|
313
|
+
Emits a {Transfer} event.*
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
```solidity
|
|
317
|
+
function _burn(uint256 tokenId) internal;
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### _transfer
|
|
321
|
+
|
|
322
|
+
*Transfers `tokenId` from `from` to `to`.
|
|
323
|
+
As opposed to [transferFrom](/src/abstract/ERC721.sol/abstract.ERC721.md#transferfrom), this imposes no restrictions on msg.sender.
|
|
324
|
+
Requirements:
|
|
325
|
+
- `to` cannot be the zero address.
|
|
326
|
+
- `tokenId` token must be owned by `from`.
|
|
327
|
+
Emits a {Transfer} event.*
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
```solidity
|
|
331
|
+
function _transfer(address from, address to, uint256 tokenId) internal;
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### _safeTransfer
|
|
335
|
+
|
|
336
|
+
*Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
|
|
337
|
+
are aware of the ERC721 standard to prevent tokens from being forever locked.
|
|
338
|
+
`data` is additional data, it has no specified format and it is sent in call to `to`.
|
|
339
|
+
This internal function is like [safeTransferFrom](/src/abstract/ERC721.sol/abstract.ERC721.md#safetransferfrom) in the sense that it invokes
|
|
340
|
+
{IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
|
|
341
|
+
implement alternative mechanisms to perform token transfer, such as signature-based.
|
|
342
|
+
Requirements:
|
|
343
|
+
- `tokenId` token must exist and be owned by `from`.
|
|
344
|
+
- `to` cannot be the zero address.
|
|
345
|
+
- `from` cannot be the zero address.
|
|
346
|
+
- If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon
|
|
347
|
+
a safe transfer.
|
|
348
|
+
Emits a {Transfer} event.*
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
```solidity
|
|
352
|
+
function _safeTransfer(address from, address to, uint256 tokenId) internal;
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### _safeTransfer
|
|
356
|
+
|
|
357
|
+
*Same as [`_safeTransfer`](/node_modules/@arbitrum/token-bridge-contracts/node_modules/@openzeppelin/contracts/token/ERC721/ERC721.sol/contract.ERC721.md#_safetransfer), with an additional `data`
|
|
358
|
+
parameter which is
|
|
359
|
+
forwarded in {IERC721Receiver-onERC721Received} to contract recipients.*
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
```solidity
|
|
363
|
+
function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual;
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### _approve
|
|
367
|
+
|
|
368
|
+
*Approve `to` to operate on `tokenId`
|
|
369
|
+
The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
|
|
370
|
+
either the owner of the token, or approved to operate on all tokens held by this owner.
|
|
371
|
+
Emits an {Approval} event.
|
|
372
|
+
Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.*
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
```solidity
|
|
376
|
+
function _approve(address to, uint256 tokenId, address auth) internal;
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### _approve
|
|
380
|
+
|
|
381
|
+
*Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
|
|
382
|
+
emitted in the context of transfers.*
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
```solidity
|
|
386
|
+
function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual;
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
### _setApprovalForAll
|
|
390
|
+
|
|
391
|
+
*Approve `operator` to operate on all of `owner` tokens
|
|
392
|
+
Requirements:
|
|
393
|
+
- operator can't be the address zero.
|
|
394
|
+
Emits an {ApprovalForAll} event.*
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
```solidity
|
|
398
|
+
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual;
|
|
399
|
+
```
|
|
400
|
+
|
|
401
|
+
### _requireOwned
|
|
402
|
+
|
|
403
|
+
*Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
|
|
404
|
+
Returns the owner.
|
|
405
|
+
Overrides to ownership logic should be done to [_ownerOf](/src/abstract/ERC721.sol/abstract.ERC721.md#_ownerof).*
|
|
406
|
+
|
|
407
|
+
|
|
408
|
+
```solidity
|
|
409
|
+
function _requireOwned(uint256 tokenId) internal view returns (address);
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
### _checkOnERC721Received
|
|
413
|
+
|
|
414
|
+
*Private function to invoke [IERC721Receiver-onERC721Received](/lib/forge-std/test/mocks/MockERC721.t.sol/contract.ERC721Recipient.md#onerc721received) on a target address. This will revert if the
|
|
415
|
+
recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract.*
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
```solidity
|
|
419
|
+
function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private;
|
|
420
|
+
```
|
|
421
|
+
**Parameters**
|
|
422
|
+
|
|
423
|
+
|Name|Type|Description|
|
|
424
|
+
|----|----|-----------|
|
|
425
|
+
|`from`|`address`|address representing the previous owner of the given token ID|
|
|
426
|
+
|`to`|`address`|target address that will receive the tokens|
|
|
427
|
+
|`tokenId`|`uint256`|uint256 ID of the token to be transferred|
|
|
428
|
+
|`data`|`bytes`|bytes optional data to send along with the call|
|
|
429
|
+
|
|
430
|
+
|