@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.
Files changed (100) hide show
  1. package/.gas-snapshot +152 -0
  2. package/LICENSE +21 -0
  3. package/README.md +253 -0
  4. package/SKILLS.md +140 -0
  5. package/docs/book.css +13 -0
  6. package/docs/book.toml +12 -0
  7. package/docs/solidity.min.js +74 -0
  8. package/docs/src/README.md +253 -0
  9. package/docs/src/SUMMARY.md +38 -0
  10. package/docs/src/src/JB721TiersHook.sol/contract.JB721TiersHook.md +645 -0
  11. package/docs/src/src/JB721TiersHookDeployer.sol/contract.JB721TiersHookDeployer.md +99 -0
  12. package/docs/src/src/JB721TiersHookProjectDeployer.sol/contract.JB721TiersHookProjectDeployer.md +288 -0
  13. package/docs/src/src/JB721TiersHookStore.sol/contract.JB721TiersHookStore.md +1096 -0
  14. package/docs/src/src/README.md +11 -0
  15. package/docs/src/src/abstract/ERC721.sol/abstract.ERC721.md +430 -0
  16. package/docs/src/src/abstract/JB721Hook.sol/abstract.JB721Hook.md +309 -0
  17. package/docs/src/src/abstract/README.md +5 -0
  18. package/docs/src/src/interfaces/IJB721Hook.sol/interface.IJB721Hook.md +29 -0
  19. package/docs/src/src/interfaces/IJB721TiersHook.sol/interface.IJB721TiersHook.md +203 -0
  20. package/docs/src/src/interfaces/IJB721TiersHookDeployer.sol/interface.IJB721TiersHookDeployer.md +25 -0
  21. package/docs/src/src/interfaces/IJB721TiersHookProjectDeployer.sol/interface.IJB721TiersHookProjectDeployer.md +64 -0
  22. package/docs/src/src/interfaces/IJB721TiersHookStore.sol/interface.IJB721TiersHookStore.md +265 -0
  23. package/docs/src/src/interfaces/IJB721TokenUriResolver.sol/interface.IJB721TokenUriResolver.md +12 -0
  24. package/docs/src/src/interfaces/README.md +9 -0
  25. package/docs/src/src/libraries/JB721Constants.sol/library.JB721Constants.md +14 -0
  26. package/docs/src/src/libraries/JB721TiersRulesetMetadataResolver.sol/library.JB721TiersRulesetMetadataResolver.md +68 -0
  27. package/docs/src/src/libraries/JBBitmap.sol/library.JBBitmap.md +82 -0
  28. package/docs/src/src/libraries/JBIpfsDecoder.sol/library.JBIpfsDecoder.md +61 -0
  29. package/docs/src/src/libraries/README.md +7 -0
  30. package/docs/src/src/structs/JB721InitTiersConfig.sol/struct.JB721InitTiersConfig.md +27 -0
  31. package/docs/src/src/structs/JB721Tier.sol/struct.JB721Tier.md +59 -0
  32. package/docs/src/src/structs/JB721TierConfig.sol/struct.JB721TierConfig.md +60 -0
  33. package/docs/src/src/structs/JB721TiersHookFlags.sol/struct.JB721TiersHookFlags.md +26 -0
  34. package/docs/src/src/structs/JB721TiersMintReservesConfig.sol/struct.JB721TiersMintReservesConfig.md +16 -0
  35. package/docs/src/src/structs/JB721TiersRulesetMetadata.sol/struct.JB721TiersRulesetMetadata.md +20 -0
  36. package/docs/src/src/structs/JB721TiersSetDiscountPercentConfig.sol/struct.JB721TiersSetDiscountPercentConfig.md +16 -0
  37. package/docs/src/src/structs/JBBitmapWord.sol/struct.JBBitmapWord.md +19 -0
  38. package/docs/src/src/structs/JBDeploy721TiersHookConfig.sol/struct.JBDeploy721TiersHookConfig.md +34 -0
  39. package/docs/src/src/structs/JBLaunchProjectConfig.sol/struct.JBLaunchProjectConfig.md +23 -0
  40. package/docs/src/src/structs/JBLaunchRulesetsConfig.sol/struct.JBLaunchRulesetsConfig.md +22 -0
  41. package/docs/src/src/structs/JBPayDataHookRulesetConfig.sol/struct.JBPayDataHookRulesetConfig.md +51 -0
  42. package/docs/src/src/structs/JBPayDataHookRulesetMetadata.sol/struct.JBPayDataHookRulesetMetadata.md +66 -0
  43. package/docs/src/src/structs/JBQueueRulesetsConfig.sol/struct.JBQueueRulesetsConfig.md +21 -0
  44. package/docs/src/src/structs/JBStored721Tier.sol/struct.JBStored721Tier.md +42 -0
  45. package/docs/src/src/structs/README.md +18 -0
  46. package/foundry.lock +11 -0
  47. package/foundry.toml +22 -0
  48. package/package.json +31 -0
  49. package/remappings.txt +1 -0
  50. package/script/Deploy.s.sol +140 -0
  51. package/script/helpers/Hook721DeploymentLib.sol +81 -0
  52. package/slither-ci.config.json +10 -0
  53. package/sphinx.lock +476 -0
  54. package/src/JB721TiersHook.sol +765 -0
  55. package/src/JB721TiersHookDeployer.sol +114 -0
  56. package/src/JB721TiersHookProjectDeployer.sol +413 -0
  57. package/src/JB721TiersHookStore.sol +1195 -0
  58. package/src/abstract/ERC721.sol +484 -0
  59. package/src/abstract/JB721Hook.sol +279 -0
  60. package/src/interfaces/IJB721Hook.sol +21 -0
  61. package/src/interfaces/IJB721TiersHook.sol +135 -0
  62. package/src/interfaces/IJB721TiersHookDeployer.sol +22 -0
  63. package/src/interfaces/IJB721TiersHookProjectDeployer.sol +76 -0
  64. package/src/interfaces/IJB721TiersHookStore.sol +220 -0
  65. package/src/interfaces/IJB721TokenUriResolver.sol +10 -0
  66. package/src/libraries/JB721Constants.sol +7 -0
  67. package/src/libraries/JB721TiersRulesetMetadataResolver.sol +44 -0
  68. package/src/libraries/JBBitmap.sol +57 -0
  69. package/src/libraries/JBIpfsDecoder.sol +95 -0
  70. package/src/structs/JB721InitTiersConfig.sol +20 -0
  71. package/src/structs/JB721Tier.sol +39 -0
  72. package/src/structs/JB721TierConfig.sol +40 -0
  73. package/src/structs/JB721TiersHookFlags.sol +17 -0
  74. package/src/structs/JB721TiersMintReservesConfig.sol +9 -0
  75. package/src/structs/JB721TiersRulesetMetadata.sol +12 -0
  76. package/src/structs/JB721TiersSetDiscountPercentConfig.sol +9 -0
  77. package/src/structs/JBBitmapWord.sol +11 -0
  78. package/src/structs/JBDeploy721TiersHookConfig.sol +25 -0
  79. package/src/structs/JBLaunchProjectConfig.sol +18 -0
  80. package/src/structs/JBLaunchRulesetsConfig.sol +17 -0
  81. package/src/structs/JBPayDataHookRulesetConfig.sol +44 -0
  82. package/src/structs/JBPayDataHookRulesetMetadata.sol +46 -0
  83. package/src/structs/JBQueueRulesetsConfig.sol +13 -0
  84. package/src/structs/JBStored721Tier.sol +24 -0
  85. package/test/721HookAttacks.t.sol +396 -0
  86. package/test/E2E/Pay_Mint_Redeem_E2E.t.sol +944 -0
  87. package/test/invariants/TierLifecycleInvariant.t.sol +187 -0
  88. package/test/invariants/TieredHookStoreInvariant.t.sol +81 -0
  89. package/test/invariants/handlers/TierLifecycleHandler.sol +262 -0
  90. package/test/invariants/handlers/TierStoreHandler.sol +155 -0
  91. package/test/unit/JB721TiersRulesetMetadataResolver.t.sol +141 -0
  92. package/test/unit/JBBitmap.t.sol +169 -0
  93. package/test/unit/JBIpfsDecoder.t.sol +131 -0
  94. package/test/unit/M6_TierSupplyCheck.t.sol +220 -0
  95. package/test/unit/adjustTier_Unit.t.sol +1740 -0
  96. package/test/unit/deployer_Unit.t.sol +103 -0
  97. package/test/unit/getters_constructor_Unit.t.sol +548 -0
  98. package/test/unit/mintFor_mintReservesFor_Unit.t.sol +443 -0
  99. package/test/unit/pay_Unit.t.sol +1537 -0
  100. package/test/unit/redeem_Unit.t.sol +459 -0
@@ -0,0 +1,645 @@
1
+ # JB721TiersHook
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/JB721TiersHook.sol)
3
+
4
+ **Inherits:**
5
+ JBOwnable, ERC2771Context, [JB721Hook](/src/abstract/JB721Hook.sol/abstract.JB721Hook.md), [IJB721TiersHook](/src/interfaces/IJB721TiersHook.sol/interface.IJB721TiersHook.md)
6
+
7
+ A Juicebox project can use this hook to sell tiered ERC-721 NFTs with different prices and metadata. When
8
+ the project is paid, the hook may mint NFTs to the payer, depending on the hook's setup, the amount paid, and
9
+ information specified by the payer. The project's owner can enable NFT cash outs through this hook, allowing
10
+ holders to burn their NFTs to reclaim funds from the project (in proportion to the NFT's price).
11
+
12
+
13
+ ## State Variables
14
+ ### RULESETS
15
+ The contract storing and managing project rulesets.
16
+
17
+
18
+ ```solidity
19
+ IJBRulesets public immutable override RULESETS;
20
+ ```
21
+
22
+
23
+ ### STORE
24
+ The contract that stores and manages data for this contract's NFTs.
25
+
26
+
27
+ ```solidity
28
+ IJB721TiersHookStore public immutable override STORE;
29
+ ```
30
+
31
+
32
+ ### baseURI
33
+ The base URI for the NFT `tokenUris`.
34
+
35
+
36
+ ```solidity
37
+ string public override baseURI;
38
+ ```
39
+
40
+
41
+ ### contractURI
42
+ This contract's metadata URI.
43
+
44
+
45
+ ```solidity
46
+ string public override contractURI;
47
+ ```
48
+
49
+
50
+ ### payCreditsOf
51
+ If an address pays more than the price of the NFT they received, the extra amount is stored as credits
52
+ which can be cashed out to mint NFTs.
53
+
54
+
55
+ ```solidity
56
+ mapping(address addr => uint256) public override payCreditsOf;
57
+ ```
58
+
59
+
60
+ ### _firstOwnerOf
61
+ The first owner of each token ID, stored on first transfer out.
62
+
63
+
64
+ ```solidity
65
+ mapping(uint256 tokenId => address) internal _firstOwnerOf;
66
+ ```
67
+
68
+
69
+ ### _packedPricingContext
70
+ Packed context for the pricing of this contract's tiers.
71
+
72
+ *Packed into a uint256:
73
+ - currency in bits 0-31 (32 bits),
74
+ - pricing decimals in bits 32-39 (8 bits), and
75
+ - prices contract in bits 40-199 (160 bits).*
76
+
77
+
78
+ ```solidity
79
+ uint256 internal _packedPricingContext;
80
+ ```
81
+
82
+
83
+ ## Functions
84
+ ### constructor
85
+
86
+
87
+ ```solidity
88
+ constructor(
89
+ IJBDirectory directory,
90
+ IJBPermissions permissions,
91
+ IJBRulesets rulesets,
92
+ IJB721TiersHookStore store,
93
+ address trustedForwarder
94
+ )
95
+ JBOwnable(permissions, directory.PROJECTS(), msg.sender, uint88(0))
96
+ JB721Hook(directory)
97
+ ERC2771Context(trustedForwarder);
98
+ ```
99
+ **Parameters**
100
+
101
+ |Name|Type|Description|
102
+ |----|----|-----------|
103
+ |`directory`|`IJBDirectory`|A directory of terminals and controllers for projects.|
104
+ |`permissions`|`IJBPermissions`|A contract storing permissions.|
105
+ |`rulesets`|`IJBRulesets`|A contract storing and managing project rulesets.|
106
+ |`store`|`IJB721TiersHookStore`|The contract which stores the NFT's data.|
107
+ |`trustedForwarder`|`address`|The trusted forwarder for the ERC2771Context.|
108
+
109
+
110
+ ### firstOwnerOf
111
+
112
+ The first owner of an NFT.
113
+
114
+ *This is generally the address which paid for the NFT.*
115
+
116
+
117
+ ```solidity
118
+ function firstOwnerOf(uint256 tokenId) external view override returns (address);
119
+ ```
120
+ **Parameters**
121
+
122
+ |Name|Type|Description|
123
+ |----|----|-----------|
124
+ |`tokenId`|`uint256`|The token ID of the NFT to get the first owner of.|
125
+
126
+ **Returns**
127
+
128
+ |Name|Type|Description|
129
+ |----|----|-----------|
130
+ |`<none>`|`address`|The address of the NFT's first owner.|
131
+
132
+
133
+ ### pricingContext
134
+
135
+ Context for the pricing of this hook's tiers.
136
+
137
+ *If the `prices` contract is the zero address, this contract only accepts payments in the `currency` token.*
138
+
139
+
140
+ ```solidity
141
+ function pricingContext() external view override returns (uint256 currency, uint256 decimals, IJBPrices prices);
142
+ ```
143
+ **Returns**
144
+
145
+ |Name|Type|Description|
146
+ |----|----|-----------|
147
+ |`currency`|`uint256`|The currency used for tier prices.|
148
+ |`decimals`|`uint256`|The amount of decimals being used in tier prices.|
149
+ |`prices`|`IJBPrices`|The prices contract used to resolve the value of payments in currencies other than `currency`.|
150
+
151
+
152
+ ### balanceOf
153
+
154
+ The total number of this hook's NFTs that an address holds (from all tiers).
155
+
156
+
157
+ ```solidity
158
+ function balanceOf(address owner) public view override returns (uint256 balance);
159
+ ```
160
+ **Parameters**
161
+
162
+ |Name|Type|Description|
163
+ |----|----|-----------|
164
+ |`owner`|`address`|The address to check the balance of.|
165
+
166
+ **Returns**
167
+
168
+ |Name|Type|Description|
169
+ |----|----|-----------|
170
+ |`balance`|`uint256`|The number of NFTs the address owns across this hook's tiers.|
171
+
172
+
173
+ ### initialize
174
+
175
+ Initializes a cloned copy of the original `JB721Hook` contract.
176
+
177
+
178
+ ```solidity
179
+ function initialize(
180
+ uint256 projectId,
181
+ string memory name,
182
+ string memory symbol,
183
+ string memory baseUri,
184
+ IJB721TokenUriResolver tokenUriResolver,
185
+ string memory contractUri,
186
+ JB721InitTiersConfig memory tiersConfig,
187
+ JB721TiersHookFlags memory flags
188
+ )
189
+ public
190
+ override;
191
+ ```
192
+ **Parameters**
193
+
194
+ |Name|Type|Description|
195
+ |----|----|-----------|
196
+ |`projectId`|`uint256`|The ID of the project this this hook is associated with.|
197
+ |`name`|`string`|The name of the NFT collection.|
198
+ |`symbol`|`string`|The symbol representing the NFT collection.|
199
+ |`baseUri`|`string`|The URI to use as a base for full NFT `tokenUri`s.|
200
+ |`tokenUriResolver`|`IJB721TokenUriResolver`|An optional contract responsible for resolving the token URI for each NFT's token ID.|
201
+ |`contractUri`|`string`|A URI where this contract's metadata can be found.|
202
+ |`tiersConfig`|`JB721InitTiersConfig`|The NFT tiers and pricing context to initialize the hook with. The tiers must be sorted by category (from least to greatest).|
203
+ |`flags`|`JB721TiersHookFlags`|A set of additional options which dictate how the hook behaves.|
204
+
205
+
206
+ ### cashOutWeightOf
207
+
208
+ The combined cash out weight of the NFTs with the specified token IDs.
209
+
210
+ *An NFT's cash out weight is its price.*
211
+
212
+ *To get their relative cash out weight, divide the result by the `totalCashOutWeight(...)`.*
213
+
214
+
215
+ ```solidity
216
+ function cashOutWeightOf(
217
+ uint256[] memory tokenIds,
218
+ JBBeforeCashOutRecordedContext calldata
219
+ )
220
+ public
221
+ view
222
+ virtual
223
+ override
224
+ returns (uint256);
225
+ ```
226
+ **Parameters**
227
+
228
+ |Name|Type|Description|
229
+ |----|----|-----------|
230
+ |`tokenIds`|`uint256[]`|The token IDs of the NFTs to get the cumulative cash out weight of.|
231
+ |`<none>`|`JBBeforeCashOutRecordedContext`||
232
+
233
+ **Returns**
234
+
235
+ |Name|Type|Description|
236
+ |----|----|-----------|
237
+ |`<none>`|`uint256`|weight The cash out weight of the tokenIds.|
238
+
239
+
240
+ ### supportsInterface
241
+
242
+ Indicates if this contract adheres to the specified interface.
243
+
244
+ *See [IERC165-supportsInterface](/lib/forge-std/src/mocks/MockERC721.sol/contract.MockERC721.md#supportsinterface).*
245
+
246
+
247
+ ```solidity
248
+ function supportsInterface(bytes4 interfaceId) public view override(IERC165, JB721Hook) returns (bool);
249
+ ```
250
+ **Parameters**
251
+
252
+ |Name|Type|Description|
253
+ |----|----|-----------|
254
+ |`interfaceId`|`bytes4`|The ID of the interface to check for adherence to.|
255
+
256
+
257
+ ### tokenURI
258
+
259
+ The metadata URI of the NFT with the specified token ID.
260
+
261
+ *Defers to the `tokenUriResolver` if it is set. Otherwise, use the `tokenUri` corresponding with the NFT's
262
+ tier.*
263
+
264
+
265
+ ```solidity
266
+ function tokenURI(uint256 tokenId) public view virtual override returns (string memory);
267
+ ```
268
+ **Parameters**
269
+
270
+ |Name|Type|Description|
271
+ |----|----|-----------|
272
+ |`tokenId`|`uint256`|The token ID of the NFT to get the metadata URI of.|
273
+
274
+ **Returns**
275
+
276
+ |Name|Type|Description|
277
+ |----|----|-----------|
278
+ |`<none>`|`string`|The token URI from the `tokenUriResolver` if it is set. If it isn't set, the token URI for the NFT's tier.|
279
+
280
+
281
+ ### totalCashOutWeight
282
+
283
+ The combined cash out weight of all outstanding NFTs.
284
+
285
+ *An NFT's cash out weight is its price.*
286
+
287
+
288
+ ```solidity
289
+ function totalCashOutWeight(JBBeforeCashOutRecordedContext calldata) public view virtual override returns (uint256);
290
+ ```
291
+ **Returns**
292
+
293
+ |Name|Type|Description|
294
+ |----|----|-----------|
295
+ |`<none>`|`uint256`|weight The total cash out weight.|
296
+
297
+
298
+ ### _contextSuffixLength
299
+
300
+ *ERC-2771 specifies the context as being a single address (20 bytes).*
301
+
302
+
303
+ ```solidity
304
+ function _contextSuffixLength() internal view virtual override(ERC2771Context, Context) returns (uint256);
305
+ ```
306
+
307
+ ### _currentRulesetOf
308
+
309
+ The project's current ruleset.
310
+
311
+
312
+ ```solidity
313
+ function _currentRulesetOf(uint256 projectId) internal view returns (JBRuleset memory);
314
+ ```
315
+ **Parameters**
316
+
317
+ |Name|Type|Description|
318
+ |----|----|-----------|
319
+ |`projectId`|`uint256`|The ID of the project to check.|
320
+
321
+ **Returns**
322
+
323
+ |Name|Type|Description|
324
+ |----|----|-----------|
325
+ |`<none>`|`JBRuleset`|The project's current ruleset.|
326
+
327
+
328
+ ### _msgData
329
+
330
+ Returns the calldata, prefered to use over `msg.data`
331
+
332
+
333
+ ```solidity
334
+ function _msgData() internal view override(ERC2771Context, Context) returns (bytes calldata);
335
+ ```
336
+ **Returns**
337
+
338
+ |Name|Type|Description|
339
+ |----|----|-----------|
340
+ |`<none>`|`bytes`|calldata the `msg.data` of this call|
341
+
342
+
343
+ ### _msgSender
344
+
345
+ Returns the sender, prefered to use over `msg.sender`
346
+
347
+
348
+ ```solidity
349
+ function _msgSender() internal view override(ERC2771Context, Context) returns (address sender);
350
+ ```
351
+ **Returns**
352
+
353
+ |Name|Type|Description|
354
+ |----|----|-----------|
355
+ |`sender`|`address`|the sender address of this call.|
356
+
357
+
358
+ ### adjustTiers
359
+
360
+ Add or delete tiers.
361
+
362
+ *Only the contract's owner or an operator with the `ADJUST_TIERS` permission from the owner can adjust the
363
+ tiers.*
364
+
365
+ *Any added tiers must adhere to this hook's `JB721TiersHookFlags`.*
366
+
367
+
368
+ ```solidity
369
+ function adjustTiers(JB721TierConfig[] calldata tiersToAdd, uint256[] calldata tierIdsToRemove) external override;
370
+ ```
371
+ **Parameters**
372
+
373
+ |Name|Type|Description|
374
+ |----|----|-----------|
375
+ |`tiersToAdd`|`JB721TierConfig[]`|The tiers to add, as an array of `JB721TierConfig` structs`.|
376
+ |`tierIdsToRemove`|`uint256[]`|The tiers to remove, as an array of tier IDs.|
377
+
378
+
379
+ ### mintFor
380
+
381
+ Manually mint NFTs from the provided tiers .
382
+
383
+
384
+ ```solidity
385
+ function mintFor(
386
+ uint16[] calldata tierIds,
387
+ address beneficiary
388
+ )
389
+ external
390
+ override
391
+ returns (uint256[] memory tokenIds);
392
+ ```
393
+ **Parameters**
394
+
395
+ |Name|Type|Description|
396
+ |----|----|-----------|
397
+ |`tierIds`|`uint16[]`|The IDs of the tiers to mint from.|
398
+ |`beneficiary`|`address`|The address to mint to.|
399
+
400
+ **Returns**
401
+
402
+ |Name|Type|Description|
403
+ |----|----|-----------|
404
+ |`tokenIds`|`uint256[]`|The IDs of the newly minted tokens.|
405
+
406
+
407
+ ### mintPendingReservesFor
408
+
409
+ Mint pending reserved NFTs based on the provided information.
410
+
411
+ *"Pending" means that the NFTs have been reserved, but have not been minted yet.*
412
+
413
+
414
+ ```solidity
415
+ function mintPendingReservesFor(JB721TiersMintReservesConfig[] calldata reserveMintConfigs) external override;
416
+ ```
417
+ **Parameters**
418
+
419
+ |Name|Type|Description|
420
+ |----|----|-----------|
421
+ |`reserveMintConfigs`|`JB721TiersMintReservesConfig[]`|Contains information about how many reserved tokens to mint for each tier.|
422
+
423
+
424
+ ### setDiscountPercentOf
425
+
426
+ Allows the collection's owner to set the discount for a tier, if the tier allows it.
427
+
428
+ *Only the contract's owner or an operator with the `SET_721_DISCOUNT_PERCENT` permission from the owner can
429
+ adjust the
430
+ tiers.*
431
+
432
+
433
+ ```solidity
434
+ function setDiscountPercentOf(uint256 tierId, uint256 discountPercent) external override;
435
+ ```
436
+ **Parameters**
437
+
438
+ |Name|Type|Description|
439
+ |----|----|-----------|
440
+ |`tierId`|`uint256`|The ID of the tier to set the discount of.|
441
+ |`discountPercent`|`uint256`|The discount percent to set.|
442
+
443
+
444
+ ### setDiscountPercentsOf
445
+
446
+ Allows the collection's owner to set the discount percent for multiple tiers.
447
+
448
+
449
+ ```solidity
450
+ function setDiscountPercentsOf(JB721TiersSetDiscountPercentConfig[] calldata configs) external override;
451
+ ```
452
+ **Parameters**
453
+
454
+ |Name|Type|Description|
455
+ |----|----|-----------|
456
+ |`configs`|`JB721TiersSetDiscountPercentConfig[]`|The configs to set the discount percent for.|
457
+
458
+
459
+ ### setMetadata
460
+
461
+ Update this hook's URI metadata properties.
462
+
463
+ *Only this contract's owner can set the metadata.*
464
+
465
+
466
+ ```solidity
467
+ function setMetadata(
468
+ string calldata baseUri,
469
+ string calldata contractUri,
470
+ IJB721TokenUriResolver tokenUriResolver,
471
+ uint256 encodedIPFSTUriTierId,
472
+ bytes32 encodedIPFSUri
473
+ )
474
+ external
475
+ override;
476
+ ```
477
+ **Parameters**
478
+
479
+ |Name|Type|Description|
480
+ |----|----|-----------|
481
+ |`baseUri`|`string`|The new base URI.|
482
+ |`contractUri`|`string`|The new contract URI.|
483
+ |`tokenUriResolver`|`IJB721TokenUriResolver`|The new URI resolver.|
484
+ |`encodedIPFSTUriTierId`|`uint256`|The ID of the tier to set the encoded IPFS URI of.|
485
+ |`encodedIPFSUri`|`bytes32`|The encoded IPFS URI to set.|
486
+
487
+
488
+ ### mintPendingReservesFor
489
+
490
+ Mint reserved pending reserved NFTs within the provided tier.
491
+
492
+ *"Pending" means that the NFTs have been reserved, but have not been minted yet.*
493
+
494
+
495
+ ```solidity
496
+ function mintPendingReservesFor(uint256 tierId, uint256 count) public override;
497
+ ```
498
+ **Parameters**
499
+
500
+ |Name|Type|Description|
501
+ |----|----|-----------|
502
+ |`tierId`|`uint256`|The ID of the tier to mint reserved NFTs from.|
503
+ |`count`|`uint256`|The number of reserved NFTs to mint.|
504
+
505
+
506
+ ### _didBurn
507
+
508
+ A function which gets called after NFTs have been cashed out and recorded by the terminal.
509
+
510
+
511
+ ```solidity
512
+ function _didBurn(uint256[] memory tokenIds) internal virtual override;
513
+ ```
514
+ **Parameters**
515
+
516
+ |Name|Type|Description|
517
+ |----|----|-----------|
518
+ |`tokenIds`|`uint256[]`|The token IDs of the NFTs that were burned.|
519
+
520
+
521
+ ### _mintAll
522
+
523
+ Mints one NFT from each of the specified tiers for the beneficiary.
524
+
525
+ *The same tier can be specified more than once.*
526
+
527
+
528
+ ```solidity
529
+ function _mintAll(
530
+ uint256 amount,
531
+ uint16[] memory mintTierIds,
532
+ address beneficiary
533
+ )
534
+ internal
535
+ returns (uint256 leftoverAmount);
536
+ ```
537
+ **Parameters**
538
+
539
+ |Name|Type|Description|
540
+ |----|----|-----------|
541
+ |`amount`|`uint256`|The amount to base the mints on. The total price of the NFTs being minted cannot be larger than this amount.|
542
+ |`mintTierIds`|`uint16[]`|An array of NFT tier IDs to be minted.|
543
+ |`beneficiary`|`address`|The address receiving the newly minted NFTs.|
544
+
545
+ **Returns**
546
+
547
+ |Name|Type|Description|
548
+ |----|----|-----------|
549
+ |`leftoverAmount`|`uint256`|The `amount` leftover after minting.|
550
+
551
+
552
+ ### _processPayment
553
+
554
+ Process a payment, minting NFTs and updating credits as necessary.
555
+
556
+
557
+ ```solidity
558
+ function _processPayment(JBAfterPayRecordedContext calldata context) internal virtual override;
559
+ ```
560
+ **Parameters**
561
+
562
+ |Name|Type|Description|
563
+ |----|----|-----------|
564
+ |`context`|`JBAfterPayRecordedContext`|Payment context provided by the terminal after it has recorded the payment in the terminal store.|
565
+
566
+
567
+ ### _recordSetTokenUriResolver
568
+
569
+ Record the setting of a new token URI resolver.
570
+
571
+
572
+ ```solidity
573
+ function _recordSetTokenUriResolver(IJB721TokenUriResolver tokenUriResolver) internal;
574
+ ```
575
+ **Parameters**
576
+
577
+ |Name|Type|Description|
578
+ |----|----|-----------|
579
+ |`tokenUriResolver`|`IJB721TokenUriResolver`|The new token URI resolver.|
580
+
581
+
582
+ ### _setDiscountPercentOf
583
+
584
+ Internal function to set the discount percent for a tier.
585
+
586
+
587
+ ```solidity
588
+ function _setDiscountPercentOf(uint256 tierId, uint256 discountPercent) internal;
589
+ ```
590
+ **Parameters**
591
+
592
+ |Name|Type|Description|
593
+ |----|----|-----------|
594
+ |`tierId`|`uint256`|The ID of the tier to set the discount percent for.|
595
+ |`discountPercent`|`uint256`|The discount percent to set for the tier.|
596
+
597
+
598
+ ### _update
599
+
600
+ Before transferring an NFT, register its first owner (if necessary).
601
+
602
+
603
+ ```solidity
604
+ function _update(address to, uint256 tokenId, address auth) internal virtual override returns (address from);
605
+ ```
606
+ **Parameters**
607
+
608
+ |Name|Type|Description|
609
+ |----|----|-----------|
610
+ |`to`|`address`|The address the NFT is being transferred to.|
611
+ |`tokenId`|`uint256`|The token ID of the NFT being transferred.|
612
+ |`auth`|`address`||
613
+
614
+
615
+ ## Errors
616
+ ### JB721TiersHook_AlreadyInitialized
617
+
618
+ ```solidity
619
+ error JB721TiersHook_AlreadyInitialized(uint256 projectId);
620
+ ```
621
+
622
+ ### JB721TiersHook_NoProjectId
623
+
624
+ ```solidity
625
+ error JB721TiersHook_NoProjectId();
626
+ ```
627
+
628
+ ### JB721TiersHook_Overspending
629
+
630
+ ```solidity
631
+ error JB721TiersHook_Overspending(uint256 leftoverAmount);
632
+ ```
633
+
634
+ ### JB721TiersHook_MintReserveNftsPaused
635
+
636
+ ```solidity
637
+ error JB721TiersHook_MintReserveNftsPaused();
638
+ ```
639
+
640
+ ### JB721TiersHook_TierTransfersPaused
641
+
642
+ ```solidity
643
+ error JB721TiersHook_TierTransfersPaused();
644
+ ```
645
+