@croptop/core-v6 0.0.39 → 0.0.40
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 +15 -7
- package/src/CTProjectOwner.sol +6 -4
- package/src/CTPublisher.sol +14 -4
- 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 ------------------------- //
|
|
@@ -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,8 +338,9 @@ 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.
|
|
@@ -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 --------------- //
|
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 ------------------------- //
|
|
@@ -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.
|
|
@@ -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;
|