@croptop/core-v6 0.0.39 → 0.0.41
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/package.json +1 -1
- package/src/CTDeployer.sol +18 -10
- package/src/CTProjectOwner.sol +7 -5
- package/src/CTPublisher.sol +17 -7
- package/src/interfaces/ICTDeployer.sol +1 -1
- package/src/interfaces/ICTPublisher.sol +1 -1
- package/src/structs/CTPost.sol +2 -2
- package/src/structs/CTProjectConfig.sol +7 -6
package/package.json
CHANGED
package/src/CTDeployer.sol
CHANGED
|
@@ -36,7 +36,11 @@ import {CTDeployerAllowedPost} from "./structs/CTDeployerAllowedPost.sol";
|
|
|
36
36
|
import {CTProjectConfig} from "./structs/CTProjectConfig.sol";
|
|
37
37
|
import {CTSuckerDeploymentConfig} from "./structs/CTSuckerDeploymentConfig.sol";
|
|
38
38
|
|
|
39
|
-
/// @notice
|
|
39
|
+
/// @notice Deploys Juicebox projects pre-configured for Croptop — a permissionless NFT publishing system. Each
|
|
40
|
+
/// deployed project gets a tiered 721 hook (for minting posted NFTs), an optional set of cross-chain suckers, and this
|
|
41
|
+
/// contract set as the data hook so suckers get 0% cash-out tax and mint permission. The hook initially remains owned
|
|
42
|
+
/// by this deployer (allowing the publisher to add tiers); the project owner can later claim full hook ownership via
|
|
43
|
+
/// `claimCollectionOwnershipOf`.
|
|
40
44
|
contract CTDeployer is ERC2771Context, JBPermissioned, IJBRulesetDataHook, IERC721Receiver, ICTDeployer {
|
|
41
45
|
//*********************************************************************//
|
|
42
46
|
// --------------------------- custom errors ------------------------- //
|
|
@@ -59,7 +63,7 @@ contract CTDeployer is ERC2771Context, JBPermissioned, IJBRulesetDataHook, IERC7
|
|
|
59
63
|
/// @notice Mints ERC-721s that represent Juicebox project ownership and transfers.
|
|
60
64
|
IJBProjects public immutable override PROJECTS;
|
|
61
65
|
|
|
62
|
-
/// @notice The Croptop publisher.
|
|
66
|
+
/// @notice The Croptop publisher contract that manages post allowances and content rules.
|
|
63
67
|
ICTPublisher public immutable override PUBLISHER;
|
|
64
68
|
|
|
65
69
|
/// @notice Deploys and tracks suckers for projects.
|
|
@@ -291,8 +295,10 @@ contract CTDeployer is ERC2771Context, JBPermissioned, IJBRulesetDataHook, IERC7
|
|
|
291
295
|
// ------------------------- external views -------------------------- //
|
|
292
296
|
//*********************************************************************//
|
|
293
297
|
|
|
294
|
-
/// @notice
|
|
295
|
-
///
|
|
298
|
+
/// @notice Called before a cash out is recorded. Grants suckers 0% tax so bridged tokens redeem at full value.
|
|
299
|
+
/// For non-sucker holders, delegates to the project's stored data hook (if any) or passes through the original
|
|
300
|
+
/// context values.
|
|
301
|
+
/// @dev Part of `IJBRulesetDataHook`.
|
|
296
302
|
/// @param context Standard Juicebox cash out context. See `JBBeforeCashOutRecordedContext`.
|
|
297
303
|
/// @return cashOutTaxRate The cash out tax rate, which influences the amount of terminal tokens which get cashed
|
|
298
304
|
/// out.
|
|
@@ -332,13 +338,14 @@ contract CTDeployer is ERC2771Context, JBPermissioned, IJBRulesetDataHook, IERC7
|
|
|
332
338
|
return hook.beforeCashOutRecordedWith(context);
|
|
333
339
|
}
|
|
334
340
|
|
|
335
|
-
/// @notice
|
|
336
|
-
///
|
|
341
|
+
/// @notice Called before a payment is recorded. Delegates to the project's stored data hook (the 721 hook) so NFT
|
|
342
|
+
/// tier minting logic runs. If no hook is set, passes through the original weight.
|
|
343
|
+
/// @dev Part of `IJBRulesetDataHook`.
|
|
337
344
|
/// @param context Standard Juicebox payment context. See `JBBeforePayRecordedContext`.
|
|
338
345
|
/// @return weight The weight which project tokens are minted relative to. This can be used to customize how many
|
|
339
346
|
/// tokens get minted by a payment.
|
|
340
|
-
/// @return hookSpecifications Amounts (out of what's
|
|
341
|
-
///
|
|
347
|
+
/// @return hookSpecifications Amounts (out of what's paid in) to send to pay hooks instead of adding to the
|
|
348
|
+
/// project. Useful for automatically routing funds from a treasury as payments come in.
|
|
342
349
|
function beforePayRecordedWith(JBBeforePayRecordedContext calldata context)
|
|
343
350
|
external
|
|
344
351
|
view
|
|
@@ -355,8 +362,9 @@ contract CTDeployer is ERC2771Context, JBPermissioned, IJBRulesetDataHook, IERC7
|
|
|
355
362
|
return hook.beforePayRecordedWith(context);
|
|
356
363
|
}
|
|
357
364
|
|
|
358
|
-
/// @notice
|
|
359
|
-
///
|
|
365
|
+
/// @notice Returns whether an address may mint a project's tokens on-demand. Only suckers get this permission, so
|
|
366
|
+
/// bridged tokens can be minted on the destination chain.
|
|
367
|
+
/// @dev Part of `IJBRulesetDataHook`.
|
|
360
368
|
/// @param projectId The ID of the project whose token can be minted.
|
|
361
369
|
/// @param addr The address to check the token minting permission of.
|
|
362
370
|
/// @return flag A flag indicating whether the address has permission to mint the project's tokens on-demand.
|
package/src/CTProjectOwner.sol
CHANGED
|
@@ -10,10 +10,12 @@ import {JBPermissionIds} from "@bananapus/permission-ids-v6/src/JBPermissionIds.
|
|
|
10
10
|
import {ICTProjectOwner} from "./interfaces/ICTProjectOwner.sol";
|
|
11
11
|
import {ICTPublisher} from "./interfaces/ICTPublisher.sol";
|
|
12
12
|
|
|
13
|
-
/// @notice A
|
|
14
|
-
///
|
|
15
|
-
///
|
|
16
|
-
///
|
|
13
|
+
/// @notice A dead-end owner for Juicebox projects that locks ownership while preserving Croptop posting. When a project
|
|
14
|
+
/// NFT is transferred to this contract via `safeTransferFrom`, it automatically grants the Croptop publisher
|
|
15
|
+
/// `ADJUST_721_TIERS` permission so posts can continue. The project can never be transferred out again — effectively
|
|
16
|
+
/// burning ownership while keeping the collection alive.
|
|
17
|
+
/// @dev This contract does not expose any function to reconfigure posting criteria. Criteria are set before
|
|
18
|
+
/// transferring the project here and become immutable once ownership is transferred.
|
|
17
19
|
contract CTProjectOwner is IERC721Receiver, ICTProjectOwner {
|
|
18
20
|
//*********************************************************************//
|
|
19
21
|
// ---------------- public immutable stored properties --------------- //
|
|
@@ -25,7 +27,7 @@ contract CTProjectOwner is IERC721Receiver, ICTProjectOwner {
|
|
|
25
27
|
/// @notice The contract from which project are minted.
|
|
26
28
|
IJBProjects public immutable override PROJECTS;
|
|
27
29
|
|
|
28
|
-
/// @notice The Croptop publisher.
|
|
30
|
+
/// @notice The Croptop publisher contract that manages post allowances and content rules.
|
|
29
31
|
ICTPublisher public immutable override PUBLISHER;
|
|
30
32
|
|
|
31
33
|
//*********************************************************************//
|
package/src/CTPublisher.sol
CHANGED
|
@@ -21,7 +21,11 @@ import {ICTPublisher} from "./interfaces/ICTPublisher.sol";
|
|
|
21
21
|
import {CTAllowedPost} from "./structs/CTAllowedPost.sol";
|
|
22
22
|
import {CTPost} from "./structs/CTPost.sol";
|
|
23
23
|
|
|
24
|
-
/// @notice
|
|
24
|
+
/// @notice The Croptop publishing engine. Allows anyone to publish NFT posts to a Juicebox project's 721 hook, subject
|
|
25
|
+
/// to per-category posting criteria set by the collection owner (minimum price, supply bounds, allowlist, max split
|
|
26
|
+
/// percent). On each mint, the publisher creates new 721 tiers, routes a 5% fee to the fee project, and pays the
|
|
27
|
+
/// remainder into the project's terminal. Duplicate IPFS URIs are tracked so subsequent mints of the same content reuse
|
|
28
|
+
/// the existing tier rather than creating a new one.
|
|
25
29
|
contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
|
|
26
30
|
//*********************************************************************//
|
|
27
31
|
// --------------------------- custom errors ------------------------- //
|
|
@@ -54,7 +58,7 @@ contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
|
|
|
54
58
|
// ---------------- public immutable stored properties --------------- //
|
|
55
59
|
//*********************************************************************//
|
|
56
60
|
|
|
57
|
-
/// @notice The directory that contains the projects
|
|
61
|
+
/// @notice The directory that contains the projects to post to.
|
|
58
62
|
IJBDirectory public immutable override DIRECTORY;
|
|
59
63
|
|
|
60
64
|
/// @notice The ID of the project to which fees will be routed.
|
|
@@ -88,7 +92,7 @@ contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
|
|
|
88
92
|
// -------------------------- constructor ---------------------------- //
|
|
89
93
|
//*********************************************************************//
|
|
90
94
|
|
|
91
|
-
/// @param directory The directory that contains the projects
|
|
95
|
+
/// @param directory The directory that contains the projects to post to.
|
|
92
96
|
/// @param permissions A contract storing permissions.
|
|
93
97
|
/// @param feeProjectId The ID of the project to which fees will be routed.
|
|
94
98
|
/// @param trustedForwarder The trusted forwarder for the ERC2771Context.
|
|
@@ -109,7 +113,10 @@ contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
|
|
|
109
113
|
// ---------------------- external transactions ---------------------- //
|
|
110
114
|
//*********************************************************************//
|
|
111
115
|
|
|
112
|
-
/// @notice
|
|
116
|
+
/// @notice Lets collection owners define the rules for what can be posted in each category — minimum price,
|
|
117
|
+
/// supply
|
|
118
|
+
/// bounds, maximum split percent, and an optional allowlist of addresses. Each call replaces the existing criteria
|
|
119
|
+
/// for the specified categories.
|
|
113
120
|
/// @param allowedPosts An array of criteria for allowed posts.
|
|
114
121
|
// Categories cannot be fully disabled after creation. This is by design — once a category is
|
|
115
122
|
// created, removing posting would break expectations for existing posters. Projects can set restrictive
|
|
@@ -171,8 +178,11 @@ contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
|
|
|
171
178
|
}
|
|
172
179
|
}
|
|
173
180
|
|
|
174
|
-
/// @notice Publish
|
|
175
|
-
///
|
|
181
|
+
/// @notice Publish one or more NFT posts to a project's 721 hook and mint a first copy of each. For each new post,
|
|
182
|
+
/// a tier is created on the hook. A 5% fee (1/FEE_DIVISOR) is taken from the total tier prices and routed to the
|
|
183
|
+
/// fee
|
|
184
|
+
/// project; the remainder is paid into the project's terminal, minting NFTs for the beneficiary.
|
|
185
|
+
/// @dev Reverts if any post violates the category's configured allowance (price, supply, split, allowlist).
|
|
176
186
|
/// @param hook The hook to mint from.
|
|
177
187
|
/// @param posts An array of posts that should be published as NFTs to the specified project.
|
|
178
188
|
/// @param nftBeneficiary The beneficiary of the NFT mints.
|
|
@@ -422,7 +432,7 @@ contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
|
|
|
422
432
|
/// @param posts An array of posts that should be published as NFTs to the specified project.
|
|
423
433
|
/// @return tiersToAdd The tiers that will be created to represent the posts.
|
|
424
434
|
/// @return tierIdsToMint The tier IDs of the posts that should be minted once published.
|
|
425
|
-
/// @return totalPrice The total price
|
|
435
|
+
/// @return totalPrice The total price to pay.
|
|
426
436
|
function _setupPosts(
|
|
427
437
|
IJB721TiersHook hook,
|
|
428
438
|
CTPost[] memory posts
|
|
@@ -19,7 +19,7 @@ interface ICTDeployer {
|
|
|
19
19
|
/// @return The projects contract.
|
|
20
20
|
function PROJECTS() external view returns (IJBProjects);
|
|
21
21
|
|
|
22
|
-
/// @notice The
|
|
22
|
+
/// @notice The CTPublisher contract used to mint NFTs from submitted posts.
|
|
23
23
|
/// @return The publisher contract.
|
|
24
24
|
function PUBLISHER() external view returns (ICTPublisher);
|
|
25
25
|
|
|
@@ -57,7 +57,7 @@ interface ICTPublisher {
|
|
|
57
57
|
address[] memory allowedAddresses
|
|
58
58
|
);
|
|
59
59
|
|
|
60
|
-
/// @notice The directory that contains the projects
|
|
60
|
+
/// @notice The directory that contains the projects to post to.
|
|
61
61
|
/// @return The directory contract.
|
|
62
62
|
function DIRECTORY() external view returns (IJBDirectory);
|
|
63
63
|
|
package/src/structs/CTPost.sol
CHANGED
|
@@ -4,10 +4,10 @@ pragma solidity ^0.8.0;
|
|
|
4
4
|
import {JBSplit} from "@bananapus/core-v6/src/structs/JBSplit.sol";
|
|
5
5
|
|
|
6
6
|
/// @notice A post to be published.
|
|
7
|
-
/// @custom:member encodedIPFSUri The encoded IPFS URI of the post
|
|
7
|
+
/// @custom:member encodedIPFSUri The encoded IPFS URI of the post to publish.
|
|
8
8
|
/// @custom:member totalSupply The number of NFTs that should be made available, including the 1 that will be minted
|
|
9
9
|
/// alongside this transaction.
|
|
10
|
-
/// @custom:member price The price
|
|
10
|
+
/// @custom:member price The price to pay for buying the post.
|
|
11
11
|
/// @custom:member category The category that the post should be published in.
|
|
12
12
|
/// @custom:member splitPercent The percent of the tier's price to route to the splits (out of
|
|
13
13
|
/// JBConstants.SPLITS_TOTAL_PERCENT).
|
|
@@ -4,13 +4,14 @@ pragma solidity ^0.8.0;
|
|
|
4
4
|
import {JBTerminalConfig} from "@bananapus/core-v6/src/structs/JBTerminalConfig.sol";
|
|
5
5
|
import {CTDeployerAllowedPost} from "../structs/CTDeployerAllowedPost.sol";
|
|
6
6
|
|
|
7
|
-
/// @
|
|
7
|
+
/// @notice Configuration for deploying a new Croptop project via CTDeployer.
|
|
8
|
+
/// @param terminalConfigurations The terminals that the project uses to accept payments through.
|
|
8
9
|
/// @param projectUri The metadata URI containing project info.
|
|
9
|
-
/// @param allowedPosts The
|
|
10
|
-
/// @param contractUri A link to the collection's metadata.
|
|
11
|
-
/// @param name The name of the collection where posts will
|
|
12
|
-
/// @param symbol The symbol of the collection where posts will
|
|
13
|
-
/// @param salt A salt
|
|
10
|
+
/// @param allowedPosts The posting criteria that define what kinds of NFTs can be published to each category.
|
|
11
|
+
/// @param contractUri A link to the 721 collection's metadata (e.g. OpenSea-compatible contract-level metadata).
|
|
12
|
+
/// @param name The name of the 721 collection where posts will be minted.
|
|
13
|
+
/// @param symbol The symbol of the 721 collection where posts will be minted.
|
|
14
|
+
/// @param salt A salt for deterministic deployment of the 721 hook (includes msg.sender for replay protection).
|
|
14
15
|
struct CTProjectConfig {
|
|
15
16
|
JBTerminalConfig[] terminalConfigurations;
|
|
16
17
|
string projectUri;
|