@artblocks/contracts 1.2.1 → 1.3.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 (71) hide show
  1. package/artifacts/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2_Web3Call.sol/BytecodeStorageReaderContractV2_Web3Call.json +201 -0
  2. package/artifacts/contracts/BytecodeStorageReaders/UniversalBytecodeStorageReader.sol/UniversalBytecodeStorageReader.json +2 -2
  3. package/artifacts/contracts/DependencyRegistryV0.sol/DependencyRegistryV0.json +42 -53
  4. package/artifacts/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol/GenArt721CoreV3_Engine_Flex.json +2 -2
  5. package/artifacts/contracts/generator/GenArt721GeneratorV0.sol/GenArt721GeneratorV0.json +2 -2
  6. package/artifacts/contracts/interfaces/v0.8.x/IDelegateRegistry.sol/IDelegateRegistry.json +820 -0
  7. package/artifacts/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol/IDependencyRegistryV0.json +13 -0
  8. package/artifacts/contracts/interfaces/v0.8.x/IPMPAugmentHook.sol/IPMPAugmentHook.json +83 -0
  9. package/artifacts/contracts/interfaces/v0.8.x/IPMPConfigureHook.sol/IPMPConfigureHook.json +80 -0
  10. package/artifacts/contracts/interfaces/v0.8.x/IPMPV0.sol/IPMPV0.json +402 -0
  11. package/artifacts/contracts/interfaces/v0.8.x/IUniversalBytecodeStorageReader.sol/IUniversalBytecodeStorageReader.json +13 -0
  12. package/artifacts/contracts/interfaces/v0.8.x/IWeb3Call.sol/IWeb3Call.json +47 -0
  13. package/artifacts/contracts/libs/integration-refs/delegation-registry/DelegateRegistry.sol/DelegateRegistry.json +846 -0
  14. package/artifacts/contracts/libs/integration-refs/delegation-registry/libraries/RegistryHashes.sol/RegistryHashes.json +10 -0
  15. package/artifacts/contracts/libs/integration-refs/delegation-registry/libraries/RegistryOps.sol/RegistryOps.json +10 -0
  16. package/artifacts/contracts/libs/integration-refs/delegation-registry/libraries/RegistryStorage.sol/RegistryStorage.json +10 -0
  17. package/artifacts/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol/DependencyRegistryStorageLib.json +2 -2
  18. package/artifacts/contracts/libs/v0.8.x/ImmutableStringArray.sol/ImmutableStringArray.json +10 -0
  19. package/artifacts/contracts/libs/v0.8.x/V3FlexLib.sol/V3FlexLib.json +2 -2
  20. package/artifacts/contracts/mock/ImmutableStringArrayMock.sol/ImmutableStringArrayMock.json +69 -0
  21. package/artifacts/contracts/mock/MockPMPAugmentHook.sol/MockPMPAugmentHook.json +214 -0
  22. package/artifacts/contracts/mock/MockPMPConfigureHook.sol/MockPMPConfigureHook.json +236 -0
  23. package/artifacts/contracts/web3call/PMPV0.sol/PMPV0.json +629 -0
  24. package/artifacts/contracts/web3call/Web3Call.sol/Web3Call.json +66 -0
  25. package/artifacts/contracts/web3call/augment-hooks/AbstractPMPAugmentHook.sol/AbstractPMPAugmentHook.json +83 -0
  26. package/artifacts/contracts/web3call/augment-hooks/InjectBaseGasFee.sol/InjectBaseGasFee.json +83 -0
  27. package/artifacts/contracts/web3call/augment-hooks/InjectChromieSquiggleFloorPrice.sol/IUniswapV2Pair.json +60 -0
  28. package/artifacts/contracts/web3call/augment-hooks/InjectChromieSquiggleFloorPrice.sol/InjectChromieSquiggleFloorPrice.json +107 -0
  29. package/artifacts/contracts/web3call/augment-hooks/InjectIsNounsDaoMember.sol/InjectIsNounsDaoMember.json +96 -0
  30. package/artifacts/contracts/web3call/augment-hooks/InjectIsProjectFullyMinted.sol/InjectIsProjectFullyMinted.json +83 -0
  31. package/artifacts/contracts/web3call/augment-hooks/InjectPolyptychTokenHash.sol/InjectPolyptychTokenHash.json +141 -0
  32. package/artifacts/contracts/web3call/augment-hooks/InjectTokenHashSeed.sol/InjectTokenHashSeed.json +99 -0
  33. package/artifacts/contracts/web3call/augment-hooks/InjectTokenOwner.sol/InjectTokenOwner.json +99 -0
  34. package/artifacts/contracts/web3call/augment-hooks/InjectTokenOwnerEthBalance.sol/InjectTokenOwnerEthBalance.json +83 -0
  35. package/artifacts/contracts/web3call/augment-hooks/InjectUSDCTotalSupply.sol/InjectUSDCTotalSupply.json +107 -0
  36. package/artifacts/contracts/web3call/configure-hooks/abstractPMPConfigureHook.sol/AbstractPMPConfigureHook.json +80 -0
  37. package/contracts/BytecodeStorageReaders/BytecodeStorageReaderContractV2_Web3Call.sol +128 -0
  38. package/contracts/DependencyRegistryV0.sol +67 -28
  39. package/contracts/engine/V3/GenArt721CoreV3_Engine_Flex.sol +7 -1
  40. package/contracts/generator/GenArt721GeneratorV0.sol +77 -8
  41. package/contracts/interfaces/v0.8.x/IDelegateRegistry.sol +318 -0
  42. package/contracts/interfaces/v0.8.x/IDependencyRegistryV0.sol +2 -0
  43. package/contracts/interfaces/v0.8.x/IPMPAugmentHook.sol +31 -0
  44. package/contracts/interfaces/v0.8.x/IPMPConfigureHook.sol +25 -0
  45. package/contracts/interfaces/v0.8.x/IPMPV0.sol +224 -0
  46. package/contracts/interfaces/v0.8.x/IUniversalBytecodeStorageReader.sol +5 -0
  47. package/contracts/interfaces/v0.8.x/IWeb3Call.sol +28 -0
  48. package/contracts/libs/integration-refs/delegation-registry/DelegateRegistry.sol +753 -0
  49. package/contracts/libs/integration-refs/delegation-registry/libraries/RegistryHashes.sol +359 -0
  50. package/contracts/libs/integration-refs/delegation-registry/libraries/RegistryOps.sol +31 -0
  51. package/contracts/libs/integration-refs/delegation-registry/libraries/RegistryStorage.sol +87 -0
  52. package/contracts/libs/v0.8.x/DependencyRegistryStorageLib.sol +3 -0
  53. package/contracts/libs/v0.8.x/ImmutableStringArray.sol +301 -0
  54. package/contracts/libs/v0.8.x/V3FlexLib.sol +7 -1
  55. package/contracts/mock/ImmutableStringArrayMock.sol +47 -0
  56. package/contracts/mock/MockPMPAugmentHook.sol +170 -0
  57. package/contracts/mock/MockPMPConfigureHook.sol +78 -0
  58. package/contracts/web3call/PMPV0.sol +1126 -0
  59. package/contracts/web3call/Web3Call.sol +25 -0
  60. package/contracts/web3call/augment-hooks/AbstractPMPAugmentHook.sol +46 -0
  61. package/contracts/web3call/augment-hooks/InjectBaseGasFee.sol +57 -0
  62. package/contracts/web3call/augment-hooks/InjectChromieSquiggleFloorPrice.sol +103 -0
  63. package/contracts/web3call/augment-hooks/InjectIsNounsDaoMember.sol +66 -0
  64. package/contracts/web3call/augment-hooks/InjectIsProjectFullyMinted.sol +73 -0
  65. package/contracts/web3call/augment-hooks/InjectPolyptychTokenHash.sol +88 -0
  66. package/contracts/web3call/augment-hooks/InjectTokenHashSeed.sol +62 -0
  67. package/contracts/web3call/augment-hooks/InjectTokenOwner.sol +60 -0
  68. package/contracts/web3call/augment-hooks/InjectTokenOwnerEthBalance.sol +61 -0
  69. package/contracts/web3call/augment-hooks/InjectUSDCTotalSupply.sol +69 -0
  70. package/contracts/web3call/configure-hooks/abstractPMPConfigureHook.sol +41 -0
  71. package/package.json +5 -5
@@ -0,0 +1,318 @@
1
+ // SPDX-License-Identifier: CC0-1.0
2
+ pragma solidity >=0.8.13;
3
+
4
+ /**
5
+ * @title IDelegateRegistry
6
+ * @custom:version 2.0
7
+ * @custom:author foobar (0xfoobar)
8
+ * @notice A standalone immutable registry storing delegated permissions from one address to another
9
+ */
10
+ interface IDelegateRegistry {
11
+ /// @notice Delegation type, NONE is used when a delegation does not exist or is revoked
12
+ enum DelegationType {
13
+ NONE,
14
+ ALL,
15
+ CONTRACT,
16
+ ERC721,
17
+ ERC20,
18
+ ERC1155
19
+ }
20
+
21
+ /// @notice Struct for returning delegations
22
+ struct Delegation {
23
+ DelegationType type_;
24
+ address to;
25
+ address from;
26
+ bytes32 rights;
27
+ address contract_;
28
+ uint256 tokenId;
29
+ uint256 amount;
30
+ }
31
+
32
+ /// @notice Emitted when an address delegates or revokes rights for their entire wallet
33
+ event DelegateAll(
34
+ address indexed from,
35
+ address indexed to,
36
+ bytes32 rights,
37
+ bool enable
38
+ );
39
+
40
+ /// @notice Emitted when an address delegates or revokes rights for a contract address
41
+ event DelegateContract(
42
+ address indexed from,
43
+ address indexed to,
44
+ address indexed contract_,
45
+ bytes32 rights,
46
+ bool enable
47
+ );
48
+
49
+ /// @notice Emitted when an address delegates or revokes rights for an ERC721 tokenId
50
+ event DelegateERC721(
51
+ address indexed from,
52
+ address indexed to,
53
+ address indexed contract_,
54
+ uint256 tokenId,
55
+ bytes32 rights,
56
+ bool enable
57
+ );
58
+
59
+ /// @notice Emitted when an address delegates or revokes rights for an amount of ERC20 tokens
60
+ event DelegateERC20(
61
+ address indexed from,
62
+ address indexed to,
63
+ address indexed contract_,
64
+ bytes32 rights,
65
+ uint256 amount
66
+ );
67
+
68
+ /// @notice Emitted when an address delegates or revokes rights for an amount of an ERC1155 tokenId
69
+ event DelegateERC1155(
70
+ address indexed from,
71
+ address indexed to,
72
+ address indexed contract_,
73
+ uint256 tokenId,
74
+ bytes32 rights,
75
+ uint256 amount
76
+ );
77
+
78
+ /// @notice Thrown if multicall calldata is malformed
79
+ error MulticallFailed();
80
+
81
+ /**
82
+ * ----------- WRITE -----------
83
+ */
84
+
85
+ /**
86
+ * @notice Call multiple functions in the current contract and return the data from all of them if they all succeed
87
+ * @param data The encoded function data for each of the calls to make to this contract
88
+ * @return results The results from each of the calls passed in via data
89
+ */
90
+ function multicall(
91
+ bytes[] calldata data
92
+ ) external payable returns (bytes[] memory results);
93
+
94
+ /**
95
+ * @notice Allow the delegate to act on behalf of `msg.sender` for all contracts
96
+ * @param to The address to act as delegate
97
+ * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights
98
+ * @param enable Whether to enable or disable this delegation, true delegates and false revokes
99
+ * @return delegationHash The unique identifier of the delegation
100
+ */
101
+ function delegateAll(
102
+ address to,
103
+ bytes32 rights,
104
+ bool enable
105
+ ) external payable returns (bytes32 delegationHash);
106
+
107
+ /**
108
+ * @notice Allow the delegate to act on behalf of `msg.sender` for a specific contract
109
+ * @param to The address to act as delegate
110
+ * @param contract_ The contract whose rights are being delegated
111
+ * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights
112
+ * @param enable Whether to enable or disable this delegation, true delegates and false revokes
113
+ * @return delegationHash The unique identifier of the delegation
114
+ */
115
+ function delegateContract(
116
+ address to,
117
+ address contract_,
118
+ bytes32 rights,
119
+ bool enable
120
+ ) external payable returns (bytes32 delegationHash);
121
+
122
+ /**
123
+ * @notice Allow the delegate to act on behalf of `msg.sender` for a specific ERC721 token
124
+ * @param to The address to act as delegate
125
+ * @param contract_ The contract whose rights are being delegated
126
+ * @param tokenId The token id to delegate
127
+ * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights
128
+ * @param enable Whether to enable or disable this delegation, true delegates and false revokes
129
+ * @return delegationHash The unique identifier of the delegation
130
+ */
131
+ function delegateERC721(
132
+ address to,
133
+ address contract_,
134
+ uint256 tokenId,
135
+ bytes32 rights,
136
+ bool enable
137
+ ) external payable returns (bytes32 delegationHash);
138
+
139
+ /**
140
+ * @notice Allow the delegate to act on behalf of `msg.sender` for a specific amount of ERC20 tokens
141
+ * @dev The actual amount is not encoded in the hash, just the existence of a amount (since it is an upper bound)
142
+ * @param to The address to act as delegate
143
+ * @param contract_ The address for the fungible token contract
144
+ * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights
145
+ * @param amount The amount to delegate, > 0 delegates and 0 revokes
146
+ * @return delegationHash The unique identifier of the delegation
147
+ */
148
+ function delegateERC20(
149
+ address to,
150
+ address contract_,
151
+ bytes32 rights,
152
+ uint256 amount
153
+ ) external payable returns (bytes32 delegationHash);
154
+
155
+ /**
156
+ * @notice Allow the delegate to act on behalf of `msg.sender` for a specific amount of ERC1155 tokens
157
+ * @dev The actual amount is not encoded in the hash, just the existence of a amount (since it is an upper bound)
158
+ * @param to The address to act as delegate
159
+ * @param contract_ The address of the contract that holds the token
160
+ * @param tokenId The token id to delegate
161
+ * @param rights Specific subdelegation rights granted to the delegate, pass an empty bytestring to encompass all rights
162
+ * @param amount The amount of that token id to delegate, > 0 delegates and 0 revokes
163
+ * @return delegationHash The unique identifier of the delegation
164
+ */
165
+ function delegateERC1155(
166
+ address to,
167
+ address contract_,
168
+ uint256 tokenId,
169
+ bytes32 rights,
170
+ uint256 amount
171
+ ) external payable returns (bytes32 delegationHash);
172
+
173
+ /**
174
+ * ----------- CHECKS -----------
175
+ */
176
+
177
+ /**
178
+ * @notice Check if `to` is a delegate of `from` for the entire wallet
179
+ * @param to The potential delegate address
180
+ * @param from The potential address who delegated rights
181
+ * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only
182
+ * @return valid Whether delegate is granted to act on the from's behalf
183
+ */
184
+ function checkDelegateForAll(
185
+ address to,
186
+ address from,
187
+ bytes32 rights
188
+ ) external view returns (bool);
189
+
190
+ /**
191
+ * @notice Check if `to` is a delegate of `from` for the specified `contract_` or the entire wallet
192
+ * @param to The delegated address to check
193
+ * @param contract_ The specific contract address being checked
194
+ * @param from The cold wallet who issued the delegation
195
+ * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only
196
+ * @return valid Whether delegate is granted to act on from's behalf for entire wallet or that specific contract
197
+ */
198
+ function checkDelegateForContract(
199
+ address to,
200
+ address from,
201
+ address contract_,
202
+ bytes32 rights
203
+ ) external view returns (bool);
204
+
205
+ /**
206
+ * @notice Check if `to` is a delegate of `from` for the specific `contract` and `tokenId`, the entire `contract_`, or the entire wallet
207
+ * @param to The delegated address to check
208
+ * @param contract_ The specific contract address being checked
209
+ * @param tokenId The token id for the token to delegating
210
+ * @param from The wallet that issued the delegation
211
+ * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only
212
+ * @return valid Whether delegate is granted to act on from's behalf for entire wallet, that contract, or that specific tokenId
213
+ */
214
+ function checkDelegateForERC721(
215
+ address to,
216
+ address from,
217
+ address contract_,
218
+ uint256 tokenId,
219
+ bytes32 rights
220
+ ) external view returns (bool);
221
+
222
+ /**
223
+ * @notice Returns the amount of ERC20 tokens the delegate is granted rights to act on the behalf of
224
+ * @param to The delegated address to check
225
+ * @param contract_ The address of the token contract
226
+ * @param from The cold wallet who issued the delegation
227
+ * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only
228
+ * @return balance The delegated balance, which will be 0 if the delegation does not exist
229
+ */
230
+ function checkDelegateForERC20(
231
+ address to,
232
+ address from,
233
+ address contract_,
234
+ bytes32 rights
235
+ ) external view returns (uint256);
236
+
237
+ /**
238
+ * @notice Returns the amount of a ERC1155 tokens the delegate is granted rights to act on the behalf of
239
+ * @param to The delegated address to check
240
+ * @param contract_ The address of the token contract
241
+ * @param tokenId The token id to check the delegated amount of
242
+ * @param from The cold wallet who issued the delegation
243
+ * @param rights Specific rights to check for, pass the zero value to ignore subdelegations and check full delegations only
244
+ * @return balance The delegated balance, which will be 0 if the delegation does not exist
245
+ */
246
+ function checkDelegateForERC1155(
247
+ address to,
248
+ address from,
249
+ address contract_,
250
+ uint256 tokenId,
251
+ bytes32 rights
252
+ ) external view returns (uint256);
253
+
254
+ /**
255
+ * ----------- ENUMERATIONS -----------
256
+ */
257
+
258
+ /**
259
+ * @notice Returns all enabled delegations a given delegate has received
260
+ * @param to The address to retrieve delegations for
261
+ * @return delegations Array of Delegation structs
262
+ */
263
+ function getIncomingDelegations(
264
+ address to
265
+ ) external view returns (Delegation[] memory delegations);
266
+
267
+ /**
268
+ * @notice Returns all enabled delegations an address has given out
269
+ * @param from The address to retrieve delegations for
270
+ * @return delegations Array of Delegation structs
271
+ */
272
+ function getOutgoingDelegations(
273
+ address from
274
+ ) external view returns (Delegation[] memory delegations);
275
+
276
+ /**
277
+ * @notice Returns all hashes associated with enabled delegations an address has received
278
+ * @param to The address to retrieve incoming delegation hashes for
279
+ * @return delegationHashes Array of delegation hashes
280
+ */
281
+ function getIncomingDelegationHashes(
282
+ address to
283
+ ) external view returns (bytes32[] memory delegationHashes);
284
+
285
+ /**
286
+ * @notice Returns all hashes associated with enabled delegations an address has given out
287
+ * @param from The address to retrieve outgoing delegation hashes for
288
+ * @return delegationHashes Array of delegation hashes
289
+ */
290
+ function getOutgoingDelegationHashes(
291
+ address from
292
+ ) external view returns (bytes32[] memory delegationHashes);
293
+
294
+ /**
295
+ * @notice Returns the delegations for a given array of delegation hashes
296
+ * @param delegationHashes is an array of hashes that correspond to delegations
297
+ * @return delegations Array of Delegation structs, return empty structs for nonexistent or revoked delegations
298
+ */
299
+ function getDelegationsFromHashes(
300
+ bytes32[] calldata delegationHashes
301
+ ) external view returns (Delegation[] memory delegations);
302
+
303
+ /**
304
+ * ----------- STORAGE ACCESS -----------
305
+ */
306
+
307
+ /**
308
+ * @notice Allows external contracts to read arbitrary storage slots
309
+ */
310
+ function readSlot(bytes32 location) external view returns (bytes32);
311
+
312
+ /**
313
+ * @notice Allows external contracts to read an arbitrary array of storage slots
314
+ */
315
+ function readSlots(
316
+ bytes32[] calldata locations
317
+ ) external view returns (bytes32[] memory);
318
+ }
@@ -85,6 +85,8 @@ interface IDependencyRegistryV0 {
85
85
 
86
86
  event CoreRegistryAddressUpdated(address indexed coreRegistryAddress);
87
87
 
88
+ event UniversalBytecodeStorageReaderUpdated(address indexed newReader);
89
+
88
90
  /**
89
91
  * @notice Returns the count of scripts for dependency `dependencyNameAndVersion`.
90
92
  * @param dependencyNameAndVersion Dependency type to be queried.
@@ -0,0 +1,31 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Creatd By: Art Blocks Inc.
3
+
4
+ pragma solidity ^0.8.0;
5
+
6
+ import {IPMPV0} from "./IPMPV0.sol";
7
+ import {IWeb3Call} from "./IWeb3Call.sol";
8
+
9
+ import {IERC165} from "@openzeppelin-5.0/contracts/interfaces/IERC165.sol";
10
+
11
+ interface IPMPAugmentHook is IERC165 {
12
+ /**
13
+ * @notice Augment the token parameters for a given token.
14
+ * @dev This hook is called when a token's PMPs are read.
15
+ * @dev This must return all desired tokenParams, not just additional data.
16
+ * @param coreContract The address of the core contract to call.
17
+ * @param tokenId The tokenId of the token to get data for.
18
+ * @param tokenParams The token parameters for the queried token.
19
+ * @return augmentedTokenParams The augmented token parameters.
20
+ */
21
+ function onTokenPMPReadAugmentation(
22
+ address coreContract,
23
+ uint256 tokenId,
24
+ IWeb3Call.TokenParam[] calldata tokenParams
25
+ )
26
+ external
27
+ view
28
+ returns (IWeb3Call.TokenParam[] memory augmentedTokenParams);
29
+
30
+ // @dev ERC156 function supportsInterface must be implemented and broadcast true for this interfaceId
31
+ }
@@ -0,0 +1,25 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Creatd By: Art Blocks Inc.
3
+
4
+ pragma solidity ^0.8.0;
5
+
6
+ import {IPMPV0} from "./IPMPV0.sol";
7
+
8
+ import {IERC165} from "@openzeppelin-5.0/contracts/interfaces/IERC165.sol";
9
+
10
+ interface IPMPConfigureHook is IERC165 {
11
+ /**
12
+ * @notice Execution logic to be executed when a token's PMP is configured.
13
+ * @dev This hook is executed after the PMP is configured.
14
+ * @param coreContract The address of the core contract that was configured.
15
+ * @param tokenId The tokenId of the token that was configured.
16
+ * @param pmpInput The PMP input that was used to successfully configure the token.
17
+ */
18
+ function onTokenPMPConfigure(
19
+ address coreContract,
20
+ uint256 tokenId,
21
+ IPMPV0.PMPInput calldata pmpInput
22
+ ) external;
23
+
24
+ // @dev ERC156 function supportsInterface must be implemented and broadcast true for this interfaceId
25
+ }
@@ -0,0 +1,224 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Created By: Art Blocks Inc.
3
+
4
+ pragma solidity ^0.8.0;
5
+
6
+ import {IPMPConfigureHook} from "./IPMPConfigureHook.sol";
7
+ import {IPMPAugmentHook} from "./IPMPAugmentHook.sol";
8
+ import {IWeb3Call} from "./IWeb3Call.sol";
9
+
10
+ import {ImmutableStringArray} from "../../libs/v0.8.x/ImmutableStringArray.sol";
11
+
12
+ /**
13
+ * @title Project Metadata Parameters (PMP) Interface, V0
14
+ * @author Art Blocks Inc.
15
+ * @notice Interface for the Project Metadata Parameters (PMP) contract that defines
16
+ * how projects can expose configurable parameters for tokens. This interface establishes
17
+ * the standard for parameter configuration, validation, and retrieval.
18
+ * @dev This interface extends the IWeb3Call interface to provide compatibility with
19
+ * existing Web3 infrastructure.
20
+ */
21
+ interface IPMPV0 is IWeb3Call {
22
+ /**
23
+ * @notice Emitted when project hooks are configured.
24
+ * @param coreContract The address of the core contract.
25
+ * @param projectId The project ID for which hooks were configured.
26
+ * @param tokenPMPPostConfigHook The hook to call after a token's PMP is configured.
27
+ * @param tokenPMPReadAugmentationHook The hook to call when reading a token's PMPs.
28
+ */
29
+ event ProjectHooksConfigured(
30
+ address coreContract,
31
+ uint256 projectId,
32
+ IPMPConfigureHook tokenPMPPostConfigHook,
33
+ IPMPAugmentHook tokenPMPReadAugmentationHook
34
+ );
35
+
36
+ /**
37
+ * @notice Emitted when a project's available parameters are configured.
38
+ * @param coreContract The address of the core contract.
39
+ * @param projectId The project ID for which parameters were configured.
40
+ * @param pmpInputConfigs Array of parameter configurations defining the available parameters.
41
+ * @param projectConfigNonce The nonce of the project configuration.
42
+ */
43
+ event ProjectConfigured(
44
+ address coreContract,
45
+ uint256 projectId,
46
+ PMPInputConfig[] pmpInputConfigs,
47
+ uint8 projectConfigNonce
48
+ );
49
+
50
+ /**
51
+ * @notice Emitted when a token's parameters are configured.
52
+ * @param coreContract The address of the core contract.
53
+ * @param tokenId The token ID for which parameters were configured.
54
+ * @param pmpInputs Array of parameter inputs that were configured.
55
+ */
56
+ event TokenParamsConfigured(
57
+ address coreContract,
58
+ uint256 tokenId,
59
+ PMPInput[] pmpInputs
60
+ );
61
+
62
+ /**
63
+ * @notice Emitted when the delegation registry is updated.
64
+ * @dev At the time of writing, the delegate.xyz v2 contract is the only
65
+ * delegate registry contract that is supported.
66
+ * @param delegationRegistry The address of the new delegation registry.
67
+ */
68
+ event DelegationRegistryUpdated(address delegationRegistry);
69
+
70
+ /**
71
+ * @notice Defines who can configure a parameter for a token.
72
+ * @dev Enum ordering is relied on (ArtistAndTokenOwnerAndAddress being last).
73
+ */
74
+ enum AuthOption {
75
+ Artist,
76
+ TokenOwner,
77
+ Address,
78
+ ArtistAndTokenOwner,
79
+ ArtistAndAddress,
80
+ TokenOwnerAndAddress,
81
+ ArtistAndTokenOwnerAndAddress
82
+ }
83
+
84
+ /**
85
+ * @notice Defines the type of parameter that can be configured.
86
+ * @dev Enum ordering is relied on (String being last).
87
+ */
88
+ enum ParamType {
89
+ Unconfigured, // @dev default value, used to check if PMP is configured
90
+ Select,
91
+ Bool,
92
+ Uint256Range,
93
+ Int256Range,
94
+ DecimalRange,
95
+ HexColor,
96
+ Timestamp,
97
+ String // utilizes string in PMP struct, all other param types utilize the generic bytes32 param
98
+ }
99
+
100
+ /**
101
+ * @notice Structure for a parameter configuration input.
102
+ * @dev Used when configuring a project's available parameters.
103
+ */
104
+ struct PMPInputConfig {
105
+ string key; // slot 0: 32 bytes
106
+ PMPConfig pmpConfig; // slot 1: 32 bytes
107
+ }
108
+
109
+ /**
110
+ * @notice Structure for a parameter configuration.
111
+ * @dev Defines the constraints and options for a parameter.
112
+ */
113
+ struct PMPConfig {
114
+ AuthOption authOption; // slot 0: 1 byte
115
+ ParamType paramType; // slot 0: 1 byte
116
+ uint48 pmpLockedAfterTimestamp; // slot 0: 6 bytes
117
+ address authAddress; // slot 0: 20 bytes
118
+ string[] selectOptions; // slot 1: 32 bytes
119
+ // @dev use bytes32 for all range types for SSTORE efficiency
120
+ // @dev minRange and maxRange cast to defined numeric type when verifying assigned PMP values
121
+ bytes32 minRange; // slot 2: 32 bytes
122
+ bytes32 maxRange; // slot 3: 32 bytes
123
+ }
124
+
125
+ /**
126
+ * @notice View structure for a parameter configuration.
127
+ * @dev Used when reading a project's available parameters.
128
+ * @dev any populated select options are loaded and returned as a string array
129
+ * instead of remaining as a pointer to a data contract
130
+ */
131
+ struct PMPConfigView {
132
+ uint8 highestConfigNonce;
133
+ AuthOption authOption;
134
+ ParamType paramType;
135
+ uint48 pmpLockedAfterTimestamp;
136
+ address authAddress;
137
+ uint8 selectOptionsLength;
138
+ string[] selectOptions;
139
+ bytes32 minRange;
140
+ bytes32 maxRange;
141
+ }
142
+
143
+ /**
144
+ * @notice Structure for a parameter input.
145
+ * @dev Used when configuring a token's parameters.
146
+ */
147
+ struct PMPInput {
148
+ string key; // slot 0: 32 bytes
149
+ ParamType configuredParamType;
150
+ // @dev store values as bytes32 for efficiency, cast appropriately when reading
151
+ bytes32 configuredValue;
152
+ bool configuringArtistString;
153
+ string configuredValueString;
154
+ }
155
+
156
+ /**
157
+ * @notice Storage structure for a configured parameter.
158
+ * @dev Includes both artist and non-artist configured string values.
159
+ */
160
+ struct PMPStorage {
161
+ ParamType configuredParamType; // slot 0: 1 byte
162
+ // @dev store values as bytes32 for efficiency, cast appropriately when reading
163
+ bytes32 configuredValue; // slot 1: 32 bytes
164
+ string artistConfiguredValueString; // slot 2: 32 bytes
165
+ string nonArtistConfiguredValueString; // slot 3: 32 bytes
166
+ }
167
+
168
+ /**
169
+ * @notice Configure the hooks for a project.
170
+ * @param coreContract The address of the core contract.
171
+ * @param projectId The project ID to configure hooks for.
172
+ * @param tokenPMPPostConfigHook The hook to call after a token's PMP is configured.
173
+ * @param tokenPMPReadAugmentationHook The hook to call when reading a token's PMPs.
174
+ */
175
+ function configureProjectHooks(
176
+ address coreContract,
177
+ uint256 projectId,
178
+ IPMPConfigureHook tokenPMPPostConfigHook,
179
+ IPMPAugmentHook tokenPMPReadAugmentationHook
180
+ ) external;
181
+
182
+ /**
183
+ * @notice Configure the available parameters for a project.
184
+ * @param coreContract The address of the core contract.
185
+ * @param projectId The project ID to configure parameters for.
186
+ * @param pmpInputConfigs Array of parameter configurations defining the available parameters.
187
+ */
188
+ function configureProject(
189
+ address coreContract,
190
+ uint256 projectId,
191
+ PMPInputConfig[] calldata pmpInputConfigs
192
+ ) external;
193
+
194
+ /**
195
+ * @notice Configure the parameters for a specific token.
196
+ * @param coreContract The address of the core contract.
197
+ * @param tokenId The token ID to configure parameters for.
198
+ * @param pmpInputs Array of parameter inputs to configure.
199
+ */
200
+ function configureTokenParams(
201
+ address coreContract,
202
+ uint256 tokenId,
203
+ PMPInput[] calldata pmpInputs
204
+ ) external;
205
+
206
+ /**
207
+ * @notice Checks if the given wallet has the owner role for the given token.
208
+ * It returns true if the wallet is the owner of the token or if the wallet
209
+ * is a delegate of the token owner; otherwise it returns false.
210
+ * Reverts if an invalid coreContract or tokenId is provided.
211
+ * Provided for convenience, as the same check is performed in the
212
+ * configureTokenParams function.
213
+ * @param wallet The wallet address to check.
214
+ * @param coreContract The address of the core contract to call.
215
+ * @param tokenId The tokenId of the token to check.
216
+ * @return isTokenOwnerOrDelegate True if the wallet is the owner or a delegate of the token,
217
+ * false otherwise.
218
+ */
219
+ function isTokenOwnerOrDelegate(
220
+ address wallet,
221
+ address coreContract,
222
+ uint256 tokenId
223
+ ) external view returns (bool);
224
+ }
@@ -25,4 +25,9 @@ interface IUniversalBytecodeStorageReader is IBytecodeStorageReader_Base {
25
25
  function updateBytecodeStorageReaderContract(
26
26
  IBytecodeStorageReader_Base newBytecodeStorageReaderContract
27
27
  ) external;
28
+
29
+ function activeBytecodeStorageReaderContract()
30
+ external
31
+ view
32
+ returns (IBytecodeStorageReader_Base);
28
33
  }
@@ -0,0 +1,28 @@
1
+ // SPDX-License-Identifier: LGPL-3.0-only
2
+ // Creatd By: Art Blocks Inc.
3
+
4
+ pragma solidity ^0.8.0;
5
+
6
+ interface IWeb3Call {
7
+ /**
8
+ * @notice TokenParam struct defines the parameters for a given token.
9
+ * @param key The key of the token parameter.
10
+ * @param value The value of the token parameter.
11
+ */
12
+ struct TokenParam {
13
+ string key;
14
+ string value;
15
+ }
16
+
17
+ /**
18
+ * @notice Get the token parameters for a given token.
19
+ * If none are configured, the tokenParams should be empty.
20
+ * @param coreContract The address of the core contract to call.
21
+ * @param tokenId The tokenId of the token to get data for.
22
+ * @return tokenParams An array of token parameters for the queried token.
23
+ */
24
+ function getTokenParams(
25
+ address coreContract,
26
+ uint256 tokenId
27
+ ) external view returns (TokenParam[] memory tokenParams);
28
+ }