@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,265 @@
1
+ # IJB721TiersHookStore
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/interfaces/IJB721TiersHookStore.sol)
3
+
4
+
5
+ ## Functions
6
+ ### balanceOf
7
+
8
+
9
+ ```solidity
10
+ function balanceOf(address hook, address owner) external view returns (uint256);
11
+ ```
12
+
13
+ ### cashOutWeightOf
14
+
15
+
16
+ ```solidity
17
+ function cashOutWeightOf(address hook, uint256[] calldata tokenIds) external view returns (uint256 weight);
18
+ ```
19
+
20
+ ### defaultReserveBeneficiaryOf
21
+
22
+
23
+ ```solidity
24
+ function defaultReserveBeneficiaryOf(address hook) external view returns (address);
25
+ ```
26
+
27
+ ### encodedIPFSUriOf
28
+
29
+
30
+ ```solidity
31
+ function encodedIPFSUriOf(address hook, uint256 tierId) external view returns (bytes32);
32
+ ```
33
+
34
+ ### encodedTierIPFSUriOf
35
+
36
+
37
+ ```solidity
38
+ function encodedTierIPFSUriOf(address hook, uint256 tokenId) external view returns (bytes32);
39
+ ```
40
+
41
+ ### flagsOf
42
+
43
+
44
+ ```solidity
45
+ function flagsOf(address hook) external view returns (JB721TiersHookFlags memory);
46
+ ```
47
+
48
+ ### isTierRemoved
49
+
50
+
51
+ ```solidity
52
+ function isTierRemoved(address hook, uint256 tierId) external view returns (bool);
53
+ ```
54
+
55
+ ### maxTierIdOf
56
+
57
+
58
+ ```solidity
59
+ function maxTierIdOf(address hook) external view returns (uint256);
60
+ ```
61
+
62
+ ### numberOfBurnedFor
63
+
64
+
65
+ ```solidity
66
+ function numberOfBurnedFor(address hook, uint256 tierId) external view returns (uint256);
67
+ ```
68
+
69
+ ### numberOfPendingReservesFor
70
+
71
+
72
+ ```solidity
73
+ function numberOfPendingReservesFor(address hook, uint256 tierId) external view returns (uint256);
74
+ ```
75
+
76
+ ### numberOfReservesMintedFor
77
+
78
+
79
+ ```solidity
80
+ function numberOfReservesMintedFor(address hook, uint256 tierId) external view returns (uint256);
81
+ ```
82
+
83
+ ### reserveBeneficiaryOf
84
+
85
+
86
+ ```solidity
87
+ function reserveBeneficiaryOf(address hook, uint256 tierId) external view returns (address);
88
+ ```
89
+
90
+ ### tierBalanceOf
91
+
92
+
93
+ ```solidity
94
+ function tierBalanceOf(address hook, address owner, uint256 tier) external view returns (uint256);
95
+ ```
96
+
97
+ ### tierIdOfToken
98
+
99
+
100
+ ```solidity
101
+ function tierIdOfToken(uint256 tokenId) external pure returns (uint256);
102
+ ```
103
+
104
+ ### tierOf
105
+
106
+
107
+ ```solidity
108
+ function tierOf(address hook, uint256 id, bool includeResolvedUri) external view returns (JB721Tier memory tier);
109
+ ```
110
+
111
+ ### tierOfTokenId
112
+
113
+
114
+ ```solidity
115
+ function tierOfTokenId(
116
+ address hook,
117
+ uint256 tokenId,
118
+ bool includeResolvedUri
119
+ )
120
+ external
121
+ view
122
+ returns (JB721Tier memory tier);
123
+ ```
124
+
125
+ ### tiersOf
126
+
127
+
128
+ ```solidity
129
+ function tiersOf(
130
+ address hook,
131
+ uint256[] calldata categories,
132
+ bool includeResolvedUri,
133
+ uint256 startingSortIndex,
134
+ uint256 size
135
+ )
136
+ external
137
+ view
138
+ returns (JB721Tier[] memory tiers);
139
+ ```
140
+
141
+ ### tierVotingUnitsOf
142
+
143
+
144
+ ```solidity
145
+ function tierVotingUnitsOf(address hook, address account, uint256 tierId) external view returns (uint256 units);
146
+ ```
147
+
148
+ ### tokenUriResolverOf
149
+
150
+
151
+ ```solidity
152
+ function tokenUriResolverOf(address hook) external view returns (IJB721TokenUriResolver);
153
+ ```
154
+
155
+ ### totalCashOutWeight
156
+
157
+
158
+ ```solidity
159
+ function totalCashOutWeight(address hook) external view returns (uint256 weight);
160
+ ```
161
+
162
+ ### totalSupplyOf
163
+
164
+
165
+ ```solidity
166
+ function totalSupplyOf(address hook) external view returns (uint256);
167
+ ```
168
+
169
+ ### votingUnitsOf
170
+
171
+
172
+ ```solidity
173
+ function votingUnitsOf(address hook, address account) external view returns (uint256 units);
174
+ ```
175
+
176
+ ### cleanTiers
177
+
178
+
179
+ ```solidity
180
+ function cleanTiers(address hook) external;
181
+ ```
182
+
183
+ ### recordAddTiers
184
+
185
+
186
+ ```solidity
187
+ function recordAddTiers(JB721TierConfig[] calldata tierData) external returns (uint256[] memory tierIds);
188
+ ```
189
+
190
+ ### recordBurn
191
+
192
+
193
+ ```solidity
194
+ function recordBurn(uint256[] calldata tokenIds) external;
195
+ ```
196
+
197
+ ### recordFlags
198
+
199
+
200
+ ```solidity
201
+ function recordFlags(JB721TiersHookFlags calldata flag) external;
202
+ ```
203
+
204
+ ### recordMint
205
+
206
+
207
+ ```solidity
208
+ function recordMint(
209
+ uint256 amount,
210
+ uint16[] calldata tierIds,
211
+ bool isOwnerMint
212
+ )
213
+ external
214
+ returns (uint256[] memory tokenIds, uint256 leftoverAmount);
215
+ ```
216
+
217
+ ### recordMintReservesFor
218
+
219
+
220
+ ```solidity
221
+ function recordMintReservesFor(uint256 tierId, uint256 count) external returns (uint256[] memory tokenIds);
222
+ ```
223
+
224
+ ### recordRemoveTierIds
225
+
226
+
227
+ ```solidity
228
+ function recordRemoveTierIds(uint256[] calldata tierIds) external;
229
+ ```
230
+
231
+ ### recordSetEncodedIPFSUriOf
232
+
233
+
234
+ ```solidity
235
+ function recordSetEncodedIPFSUriOf(uint256 tierId, bytes32 encodedIPFSUri) external;
236
+ ```
237
+
238
+ ### recordSetDiscountPercentOf
239
+
240
+
241
+ ```solidity
242
+ function recordSetDiscountPercentOf(uint256 tierId, uint256 discountPercent) external;
243
+ ```
244
+
245
+ ### recordSetTokenUriResolver
246
+
247
+
248
+ ```solidity
249
+ function recordSetTokenUriResolver(IJB721TokenUriResolver resolver) external;
250
+ ```
251
+
252
+ ### recordTransferForTier
253
+
254
+
255
+ ```solidity
256
+ function recordTransferForTier(uint256 tierId, address from, address to) external;
257
+ ```
258
+
259
+ ## Events
260
+ ### CleanTiers
261
+
262
+ ```solidity
263
+ event CleanTiers(address indexed hook, address caller);
264
+ ```
265
+
@@ -0,0 +1,12 @@
1
+ # IJB721TokenUriResolver
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/interfaces/IJB721TokenUriResolver.sol)
3
+
4
+
5
+ ## Functions
6
+ ### tokenUriOf
7
+
8
+
9
+ ```solidity
10
+ function tokenUriOf(address nft, uint256 tokenId) external view returns (string memory tokenUri);
11
+ ```
12
+
@@ -0,0 +1,9 @@
1
+
2
+
3
+ # Contents
4
+ - [IJB721Hook](IJB721Hook.sol/interface.IJB721Hook.md)
5
+ - [IJB721TiersHook](IJB721TiersHook.sol/interface.IJB721TiersHook.md)
6
+ - [IJB721TiersHookDeployer](IJB721TiersHookDeployer.sol/interface.IJB721TiersHookDeployer.md)
7
+ - [IJB721TiersHookProjectDeployer](IJB721TiersHookProjectDeployer.sol/interface.IJB721TiersHookProjectDeployer.md)
8
+ - [IJB721TiersHookStore](IJB721TiersHookStore.sol/interface.IJB721TiersHookStore.md)
9
+ - [IJB721TokenUriResolver](IJB721TokenUriResolver.sol/interface.IJB721TokenUriResolver.md)
@@ -0,0 +1,14 @@
1
+ # JB721Constants
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/libraries/JB721Constants.sol)
3
+
4
+ Global constants used across 721 hook contracts.
5
+
6
+
7
+ ## State Variables
8
+ ### MAX_DISCOUNT_PERCENT
9
+
10
+ ```solidity
11
+ uint16 public constant MAX_DISCOUNT_PERCENT = 200;
12
+ ```
13
+
14
+
@@ -0,0 +1,68 @@
1
+ # JB721TiersRulesetMetadataResolver
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/libraries/JB721TiersRulesetMetadataResolver.sol)
3
+
4
+ Utility library to parse and store ruleset metadata associated for the tiered 721 hook.
5
+
6
+ *This library parses the `metadata` member of the `JBRulesetMetadata` struct.*
7
+
8
+
9
+ ## Functions
10
+ ### transfersPaused
11
+
12
+
13
+ ```solidity
14
+ function transfersPaused(uint256 data) internal pure returns (bool);
15
+ ```
16
+
17
+ ### mintPendingReservesPaused
18
+
19
+
20
+ ```solidity
21
+ function mintPendingReservesPaused(uint256 data) internal pure returns (bool);
22
+ ```
23
+
24
+ ### pack721TiersRulesetMetadata
25
+
26
+ Pack the ruleset metadata for the 721 hook into a single `uint256`.
27
+
28
+
29
+ ```solidity
30
+ function pack721TiersRulesetMetadata(JB721TiersRulesetMetadata memory metadata)
31
+ internal
32
+ pure
33
+ returns (uint256 packed);
34
+ ```
35
+ **Parameters**
36
+
37
+ |Name|Type|Description|
38
+ |----|----|-----------|
39
+ |`metadata`|`JB721TiersRulesetMetadata`|The metadata to validate and pack.|
40
+
41
+ **Returns**
42
+
43
+ |Name|Type|Description|
44
+ |----|----|-----------|
45
+ |`packed`|`uint256`|A `uint256` containing the packed metadata for the 721 hook.|
46
+
47
+
48
+ ### expandMetadata
49
+
50
+ Expand packed ruleset metadata for the 721 hook.
51
+
52
+
53
+ ```solidity
54
+ function expandMetadata(uint16 packedMetadata) internal pure returns (JB721TiersRulesetMetadata memory metadata);
55
+ ```
56
+ **Parameters**
57
+
58
+ |Name|Type|Description|
59
+ |----|----|-----------|
60
+ |`packedMetadata`|`uint16`|The packed metadata to expand.|
61
+
62
+ **Returns**
63
+
64
+ |Name|Type|Description|
65
+ |----|----|-----------|
66
+ |`metadata`|`JB721TiersRulesetMetadata`|The metadata as a `JB721TiersRulesetMetadata` struct.|
67
+
68
+
@@ -0,0 +1,82 @@
1
+ # JBBitmap
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/libraries/JBBitmap.sol)
3
+
4
+ Utilities to manage a bool bitmap. Used for storing inactive tiers.
5
+
6
+
7
+ ## Functions
8
+ ### readId
9
+
10
+ Initialize a `JBBitmapWord` struct based on a mapping storage pointer and an index.
11
+
12
+
13
+ ```solidity
14
+ function readId(mapping(uint256 => uint256) storage self, uint256 index) internal view returns (JBBitmapWord memory);
15
+ ```
16
+
17
+ ### isTierIdRemoved
18
+
19
+ Get the status of the specified bit within the `JBBitmapWord` struct.
20
+
21
+ *The `index` is the index that the bit would have if the bitmap were reshaped to a 1*n matrix.*
22
+
23
+
24
+ ```solidity
25
+ function isTierIdRemoved(JBBitmapWord memory self, uint256 index) internal pure returns (bool);
26
+ ```
27
+ **Returns**
28
+
29
+ |Name|Type|Description|
30
+ |----|----|-----------|
31
+ |`<none>`|`bool`|The boolean value at the specified index, which indicates whether the corresponding tier has been removed.|
32
+
33
+
34
+ ### isTierIdRemoved
35
+
36
+ Get the status of the specified bit within the `JBBitmapWord` struct.
37
+
38
+ *The `index` is the index that the bit would have if the bitmap were reshaped to a 1*n matrix.*
39
+
40
+
41
+ ```solidity
42
+ function isTierIdRemoved(mapping(uint256 => uint256) storage self, uint256 index) internal view returns (bool);
43
+ ```
44
+
45
+ ### removeTier
46
+
47
+ Set the bit at the given index to true, indicating that the corresponding tier has been removed.
48
+
49
+ *This is a one-way operation.*
50
+
51
+
52
+ ```solidity
53
+ function removeTier(mapping(uint256 => uint256) storage self, uint256 index) internal;
54
+ ```
55
+
56
+ ### refreshBitmapNeeded
57
+
58
+ Check if the specified index is at a different depth than than the current depth of the `JBBitmapWord`
59
+ struct.
60
+
61
+ *If the depth is different, the bitmap's current depth needs to be updated.*
62
+
63
+
64
+ ```solidity
65
+ function refreshBitmapNeeded(JBBitmapWord memory self, uint256 index) internal pure returns (bool);
66
+ ```
67
+ **Returns**
68
+
69
+ |Name|Type|Description|
70
+ |----|----|-----------|
71
+ |`<none>`|`bool`|Whether the bitmap needs to be refreshed.|
72
+
73
+
74
+ ### _retrieveDepth
75
+
76
+ Return the line number (depth) of a given index within the bitmap matrix.
77
+
78
+
79
+ ```solidity
80
+ function _retrieveDepth(uint256 index) internal pure returns (uint256);
81
+ ```
82
+
@@ -0,0 +1,61 @@
1
+ # JBIpfsDecoder
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/libraries/JBIpfsDecoder.sol)
3
+
4
+ Utilities to decode an IPFS hash.
5
+
6
+ *This is fairly gas intensive due to multiple nested loops. Onchain IPFS hash decoding is not advised –
7
+ storing them as a string *might* be more efficient for that use-case.*
8
+
9
+
10
+ ## State Variables
11
+ ### ALPHABET
12
+ Just a kind reminder to our readers.
13
+
14
+ *Used in `base58ToString`*
15
+
16
+
17
+ ```solidity
18
+ bytes internal constant ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
19
+ ```
20
+
21
+
22
+ ## Functions
23
+ ### decode
24
+
25
+
26
+ ```solidity
27
+ function decode(string memory baseUri, bytes32 hexString) internal pure returns (string memory);
28
+ ```
29
+
30
+ ### _toBase58
31
+
32
+ Convert a hex string to base58
33
+
34
+ Written by Martin Ludfall - Licence: MIT
35
+
36
+
37
+ ```solidity
38
+ function _toBase58(bytes memory source) private pure returns (string memory);
39
+ ```
40
+
41
+ ### _truncate
42
+
43
+
44
+ ```solidity
45
+ function _truncate(uint8[] memory array, uint8 length) private pure returns (uint8[] memory);
46
+ ```
47
+
48
+ ### _reverse
49
+
50
+
51
+ ```solidity
52
+ function _reverse(uint8[] memory input) private pure returns (uint8[] memory);
53
+ ```
54
+
55
+ ### _toAlphabet
56
+
57
+
58
+ ```solidity
59
+ function _toAlphabet(uint8[] memory indices) private pure returns (bytes memory);
60
+ ```
61
+
@@ -0,0 +1,7 @@
1
+
2
+
3
+ # Contents
4
+ - [JB721Constants](JB721Constants.sol/library.JB721Constants.md)
5
+ - [JB721TiersRulesetMetadataResolver](JB721TiersRulesetMetadataResolver.sol/library.JB721TiersRulesetMetadataResolver.md)
6
+ - [JBBitmap](JBBitmap.sol/library.JBBitmap.md)
7
+ - [JBIpfsDecoder](JBIpfsDecoder.sol/library.JBIpfsDecoder.md)
@@ -0,0 +1,27 @@
1
+ # JB721InitTiersConfig
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/structs/JB721InitTiersConfig.sol)
3
+
4
+ Config to initialize a `JB721TiersHook` with tiers and price data.
5
+
6
+ *The `tiers` must be sorted by price (from least to greatest).*
7
+
8
+ **Notes:**
9
+ - member: tiers The tiers to initialize the hook with.
10
+
11
+ - member: currency The currency that the tier prices are denoted in. See `JBPrices`.
12
+
13
+ - member: decimals The number of decimals in the fixed point tier prices.
14
+
15
+ - member: prices A contract that exposes price feeds that can be used to calculate prices in different
16
+ currencies. To only accept payments in `currency`, set `prices` to the zero address. See `JBPrices`.
17
+
18
+
19
+ ```solidity
20
+ struct JB721InitTiersConfig {
21
+ JB721TierConfig[] tiers;
22
+ uint32 currency;
23
+ uint8 decimals;
24
+ IJBPrices prices;
25
+ }
26
+ ```
27
+
@@ -0,0 +1,59 @@
1
+ # JB721Tier
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/structs/JB721Tier.sol)
3
+
4
+ **Notes:**
5
+ - member: id The tier's ID.
6
+
7
+ - member: price The price to buy an NFT in this tier, in terms of the currency in its `JBInitTiersConfig`.
8
+
9
+ - member: remainingSupply The remaining number of NFTs which can be minted from this tier.
10
+
11
+ - member: initialSupply The total number of NFTs which can be minted from this tier.
12
+
13
+ - member: votingUnits The number of votes that each NFT in this tier gets.
14
+
15
+ - member: reserveFrequency The frequency at which an extra NFT is minted for the `reserveBeneficiary` from this
16
+ tier. With a `reserveFrequency` of 5, an extra NFT will be minted for the `reserveBeneficiary` for every 5 NFTs
17
+ purchased.
18
+
19
+ - member: reserveBeneficiary The address which receives any reserve NFTs from this tier.
20
+
21
+ - member: encodedIPFSUri The IPFS URI to use for each NFT in this tier.
22
+
23
+ - member: category The category that NFTs in this tier belongs to. Used to group NFT tiers.
24
+
25
+ - member: discountPercent The discount that should be applied to the tier.
26
+
27
+ - member: allowOwnerMint A boolean indicating whether the contract's owner can mint NFTs from this tier
28
+ on-demand.
29
+
30
+ - member: cannotBeRemoved A boolean indicating whether attempts to remove this tier will revert.
31
+
32
+ - member: cannotIncreaseDiscountPercent If the tier cannot have its discount increased.
33
+
34
+ - member: transfersPausable A boolean indicating whether transfers for NFTs in tier can be paused.
35
+
36
+ - member: resolvedUri A resolved token URI for NFTs in this tier. Only available if the NFT this tier belongs
37
+ to has a resolver.
38
+
39
+
40
+ ```solidity
41
+ struct JB721Tier {
42
+ uint32 id;
43
+ uint104 price;
44
+ uint32 remainingSupply;
45
+ uint32 initialSupply;
46
+ uint104 votingUnits;
47
+ uint16 reserveFrequency;
48
+ address reserveBeneficiary;
49
+ bytes32 encodedIPFSUri;
50
+ uint24 category;
51
+ uint8 discountPercent;
52
+ bool allowOwnerMint;
53
+ bool transfersPausable;
54
+ bool cannotBeRemoved;
55
+ bool cannotIncreaseDiscountPercent;
56
+ string resolvedUri;
57
+ }
58
+ ```
59
+
@@ -0,0 +1,60 @@
1
+ # JB721TierConfig
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/structs/JB721TierConfig.sol)
3
+
4
+ Config for a single NFT tier within a `JB721TiersHook`.
5
+
6
+ **Notes:**
7
+ - member: price The price to buy an NFT in this tier, in terms of the currency in its `JBInitTiersConfig`.
8
+
9
+ - member: initialSupply The total number of NFTs which can be minted from this tier.
10
+
11
+ - member: votingUnits The number of votes that each NFT in this tier gets if `useVotingUnits` is true.
12
+
13
+ - member: reserveFrequency The frequency at which an extra NFT is minted for the `reserveBeneficiary` from this
14
+ tier. With a `reserveFrequency` of 5, an extra NFT will be minted for the `reserveBeneficiary` for every 5 NFTs
15
+ purchased.
16
+
17
+ - member: reserveBeneficiary The address which receives any reserve NFTs from this tier. Overrides the default
18
+ reserve beneficiary if one is set.
19
+
20
+ - member: encodedIPFSUri The IPFS URI to use for each NFT in this tier.
21
+
22
+ - member: category The category that NFTs in this tier belongs to. Used to group NFT tiers.
23
+
24
+ - member: discountPercent The discount that should be applied to the tier.
25
+
26
+ - member: allowOwnerMint A boolean indicating whether the contract's owner can mint NFTs from this tier
27
+ on-demand.
28
+
29
+ - member: useReserveBeneficiaryAsDefault A boolean indicating whether this tier's `reserveBeneficiary` should
30
+ be stored as the default beneficiary for all tiers.
31
+
32
+ - member: transfersPausable A boolean indicating whether transfers for NFTs in tier can be paused.
33
+
34
+ - member: useVotingUnits A boolean indicating whether the `votingUnits` should be used to calculate voting
35
+ power. If `useVotingUnits` is false, voting power is based on the tier's price.
36
+
37
+ - member: cannotBeRemoved If the tier cannot be removed once added.
38
+
39
+ - member: cannotIncreaseDiscount If the tier cannot have its discount increased.
40
+
41
+
42
+ ```solidity
43
+ struct JB721TierConfig {
44
+ uint104 price;
45
+ uint32 initialSupply;
46
+ uint32 votingUnits;
47
+ uint16 reserveFrequency;
48
+ address reserveBeneficiary;
49
+ bytes32 encodedIPFSUri;
50
+ uint24 category;
51
+ uint8 discountPercent;
52
+ bool allowOwnerMint;
53
+ bool useReserveBeneficiaryAsDefault;
54
+ bool transfersPausable;
55
+ bool useVotingUnits;
56
+ bool cannotBeRemoved;
57
+ bool cannotIncreaseDiscountPercent;
58
+ }
59
+ ```
60
+
@@ -0,0 +1,26 @@
1
+ # JB721TiersHookFlags
2
+ [Git Source](https://github.com/Bananapus/nana-721-hook/blob/e813fb5b7d17cd3d18023137d70a7b2f3911ad99/src/structs/JB721TiersHookFlags.sol)
3
+
4
+ **Notes:**
5
+ - member: noNewTiersWithReserves A boolean indicating whether attempts to add new tiers with a non-zero
6
+ `reserveFrequency` will revert.
7
+
8
+ - member: noNewTiersWithVotes A boolean indicating whether attempts to add new tiers with non-zero
9
+ `votingUnits` will revert.
10
+
11
+ - member: noNewTiersWithOwnerMinting A boolean indicating whether attempts to add new tiers with
12
+ `allowOwnerMint` set to true will revert.
13
+
14
+ - member: preventOverspending A boolean indicating whether payments attempting to spend more than the price of
15
+ the NFTs being minted will revert.
16
+
17
+
18
+ ```solidity
19
+ struct JB721TiersHookFlags {
20
+ bool noNewTiersWithReserves;
21
+ bool noNewTiersWithVotes;
22
+ bool noNewTiersWithOwnerMinting;
23
+ bool preventOverspending;
24
+ }
25
+ ```
26
+