@croptop/core-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.
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/SKILLS.md +88 -0
- package/deployments/croptop-core-v5/arbitrum/CTDeployer.json +1896 -0
- package/deployments/croptop-core-v5/arbitrum/CTProjectOwner.json +186 -0
- package/deployments/croptop-core-v5/arbitrum/CTPublisher.json +738 -0
- package/deployments/croptop-core-v5/arbitrum_sepolia/CTDeployer.json +1883 -0
- package/deployments/croptop-core-v5/arbitrum_sepolia/CTProjectOwner.json +186 -0
- package/deployments/croptop-core-v5/arbitrum_sepolia/CTPublisher.json +738 -0
- package/deployments/croptop-core-v5/base/CTDeployer.json +1908 -0
- package/deployments/croptop-core-v5/base/CTProjectOwner.json +190 -0
- package/deployments/croptop-core-v5/base/CTPublisher.json +741 -0
- package/deployments/croptop-core-v5/base_sepolia/CTDeployer.json +1894 -0
- package/deployments/croptop-core-v5/base_sepolia/CTProjectOwner.json +190 -0
- package/deployments/croptop-core-v5/base_sepolia/CTPublisher.json +741 -0
- package/deployments/croptop-core-v5/ethereum/CTDeployer.json +1894 -0
- package/deployments/croptop-core-v5/ethereum/CTProjectOwner.json +190 -0
- package/deployments/croptop-core-v5/ethereum/CTPublisher.json +741 -0
- package/deployments/croptop-core-v5/optimism/CTDeployer.json +1894 -0
- package/deployments/croptop-core-v5/optimism/CTProjectOwner.json +190 -0
- package/deployments/croptop-core-v5/optimism/CTPublisher.json +741 -0
- package/deployments/croptop-core-v5/optimism_sepolia/CTDeployer.json +1894 -0
- package/deployments/croptop-core-v5/optimism_sepolia/CTProjectOwner.json +190 -0
- package/deployments/croptop-core-v5/optimism_sepolia/CTPublisher.json +741 -0
- package/deployments/croptop-core-v5/sepolia/CTDeployer.json +1894 -0
- package/deployments/croptop-core-v5/sepolia/CTProjectOwner.json +190 -0
- package/deployments/croptop-core-v5/sepolia/CTPublisher.json +741 -0
- package/foundry.toml +25 -0
- package/package.json +31 -0
- package/remappings.txt +2 -0
- package/script/ConfigureFeeProject.s.sol +386 -0
- package/script/Deploy.s.sol +138 -0
- package/script/helpers/CroptopDeploymentLib.sol +75 -0
- package/slither-ci.config.json +10 -0
- package/sphinx.lock +507 -0
- package/src/CTDeployer.sol +425 -0
- package/src/CTProjectOwner.sol +78 -0
- package/src/CTPublisher.sol +540 -0
- package/src/interfaces/ICTDeployer.sol +56 -0
- package/src/interfaces/ICTProjectOwner.sol +24 -0
- package/src/interfaces/ICTPublisher.sol +91 -0
- package/src/structs/CTAllowedPost.sol +22 -0
- package/src/structs/CTDeployerAllowedPost.sol +20 -0
- package/src/structs/CTPost.sol +22 -0
- package/src/structs/CTProjectConfig.sol +22 -0
- package/src/structs/CTSuckerDeploymentConfig.sol +11 -0
- package/test/CTPublisher.t.sol +672 -0
- package/test/CroptopAttacks.t.sol +439 -0
- package/test/Fork.t.sol +114 -0
- package/test/Test_MetadataGeneration.t.sol +70 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import {IJB721TiersHook} from "@bananapus/721-hook-v6/src/interfaces/IJB721TiersHook.sol";
|
|
5
|
+
import {JB721Tier} from "@bananapus/721-hook-v6/src/structs/JB721Tier.sol";
|
|
6
|
+
import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
|
|
7
|
+
|
|
8
|
+
import {CTAllowedPost} from "../structs/CTAllowedPost.sol";
|
|
9
|
+
import {CTPost} from "../structs/CTPost.sol";
|
|
10
|
+
|
|
11
|
+
interface ICTPublisher {
|
|
12
|
+
event ConfigurePostingCriteria(address indexed hook, CTAllowedPost allowedPost, address caller);
|
|
13
|
+
event Mint(
|
|
14
|
+
uint256 indexed projectId,
|
|
15
|
+
IJB721TiersHook indexed hook,
|
|
16
|
+
address indexed nftBeneficiary,
|
|
17
|
+
address feeBeneficiary,
|
|
18
|
+
CTPost[] posts,
|
|
19
|
+
uint256 postValue,
|
|
20
|
+
uint256 txValue,
|
|
21
|
+
address caller
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
/// @notice The divisor that describes the fee percent. Equal to 100 divided by the fee percent.
|
|
25
|
+
/// @return The fee divisor.
|
|
26
|
+
function FEE_DIVISOR() external view returns (uint256);
|
|
27
|
+
|
|
28
|
+
/// @notice The directory that contains the projects being posted to.
|
|
29
|
+
/// @return The directory contract.
|
|
30
|
+
function DIRECTORY() external view returns (IJBDirectory);
|
|
31
|
+
|
|
32
|
+
/// @notice The ID of the project to which fees will be routed.
|
|
33
|
+
/// @return The fee project ID.
|
|
34
|
+
function FEE_PROJECT_ID() external view returns (uint256);
|
|
35
|
+
|
|
36
|
+
/// @notice The tier ID that an IPFS metadata URI has been saved to for a given hook.
|
|
37
|
+
/// @param hook The hook for which the tier ID applies.
|
|
38
|
+
/// @param encodedIPFSUri The encoded IPFS URI to look up.
|
|
39
|
+
/// @return The tier ID, or 0 if the URI has not been published.
|
|
40
|
+
function tierIdForEncodedIPFSUriOf(address hook, bytes32 encodedIPFSUri) external view returns (uint256);
|
|
41
|
+
|
|
42
|
+
/// @notice The post allowance for a particular category on a particular hook.
|
|
43
|
+
/// @param hook The hook contract for which this allowance applies.
|
|
44
|
+
/// @param category The category for which this allowance applies.
|
|
45
|
+
/// @return minimumPrice The minimum price a poster must pay to publish a new NFT.
|
|
46
|
+
/// @return minimumTotalSupply The minimum total supply a poster must set for a new NFT.
|
|
47
|
+
/// @return maximumTotalSupply The maximum total supply allowed for a new NFT. 0 means no limit.
|
|
48
|
+
/// @return allowedAddresses The addresses allowed to post. Empty if all addresses are allowed.
|
|
49
|
+
function allowanceFor(
|
|
50
|
+
address hook,
|
|
51
|
+
uint256 category
|
|
52
|
+
)
|
|
53
|
+
external
|
|
54
|
+
view
|
|
55
|
+
returns (
|
|
56
|
+
uint256 minimumPrice,
|
|
57
|
+
uint256 minimumTotalSupply,
|
|
58
|
+
uint256 maximumTotalSupply,
|
|
59
|
+
uint256 maximumSplitPercent,
|
|
60
|
+
address[] memory allowedAddresses
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
/// @notice Get the tiers for the provided encoded IPFS URIs.
|
|
64
|
+
/// @param hook The hook from which to get tiers.
|
|
65
|
+
/// @param encodedIPFSUris The URIs to get tiers of.
|
|
66
|
+
/// @return tiers The tiers that correspond to the provided encoded IPFS URIs. Empty tiers are returned for URIs
|
|
67
|
+
/// without a tier.
|
|
68
|
+
function tiersFor(address hook, bytes32[] memory encodedIPFSUris) external view returns (JB721Tier[] memory tiers);
|
|
69
|
+
|
|
70
|
+
/// @notice Configure the allowed criteria for publishing new NFTs to a hook.
|
|
71
|
+
/// @param allowedPosts An array of criteria for allowed posts.
|
|
72
|
+
function configurePostingCriteriaFor(CTAllowedPost[] memory allowedPosts) external;
|
|
73
|
+
|
|
74
|
+
/// @notice Publish NFT posts and mint a first copy of each. A fee is taken for the fee project.
|
|
75
|
+
/// @param hook The hook to mint from.
|
|
76
|
+
/// @param posts An array of posts to publish as NFTs.
|
|
77
|
+
/// @param nftBeneficiary The beneficiary of the NFT mints.
|
|
78
|
+
/// @param feeBeneficiary The beneficiary of the fee project's tokens.
|
|
79
|
+
/// @param additionalPayMetadata Extra metadata bytes to include in the payment.
|
|
80
|
+
/// @param feeMetadata Metadata to send alongside the fee payment.
|
|
81
|
+
function mintFrom(
|
|
82
|
+
IJB721TiersHook hook,
|
|
83
|
+
CTPost[] calldata posts,
|
|
84
|
+
address nftBeneficiary,
|
|
85
|
+
address feeBeneficiary,
|
|
86
|
+
bytes calldata additionalPayMetadata,
|
|
87
|
+
bytes calldata feeMetadata
|
|
88
|
+
)
|
|
89
|
+
external
|
|
90
|
+
payable;
|
|
91
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
/// @notice Criteria for allowed posts.
|
|
5
|
+
/// @custom:member hook The hook to which this allowance applies.
|
|
6
|
+
/// @custom:member category A category that should allow posts.
|
|
7
|
+
/// @custom:member minimumPrice The minimum price that a post to the specified category should cost.
|
|
8
|
+
/// @custom:member minimumTotalSupply The minimum total supply of NFTs that can be made available when minting.
|
|
9
|
+
/// @custom:member maxTotalSupply The max total supply of NFTs that can be made available when minting. Leave as 0 for
|
|
10
|
+
/// max.
|
|
11
|
+
/// @custom:member maximumSplitPercent The maximum split percent (out of JBConstants.SPLITS_TOTAL_PERCENT) that a
|
|
12
|
+
/// poster can set. 0 means splits are not allowed.
|
|
13
|
+
/// @custom:member allowedAddresses A list of addresses that are allowed to post on the category through Croptop.
|
|
14
|
+
struct CTAllowedPost {
|
|
15
|
+
address hook;
|
|
16
|
+
uint24 category;
|
|
17
|
+
uint104 minimumPrice;
|
|
18
|
+
uint32 minimumTotalSupply;
|
|
19
|
+
uint32 maximumTotalSupply;
|
|
20
|
+
uint32 maximumSplitPercent;
|
|
21
|
+
address[] allowedAddresses;
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
/// @notice Criteria for allowed posts.
|
|
5
|
+
/// @custom:member category A category that should allow posts.
|
|
6
|
+
/// @custom:member minimumPrice The minimum price that a post to the specified category should cost.
|
|
7
|
+
/// @custom:member minimumTotalSupply The minimum total supply of NFTs that can be made available when minting.
|
|
8
|
+
/// @custom:member maxTotalSupply The max total supply of NFTs that can be made available when minting. Leave as 0 for
|
|
9
|
+
/// max.
|
|
10
|
+
/// @custom:member maximumSplitPercent The maximum split percent (out of JBConstants.SPLITS_TOTAL_PERCENT) that a
|
|
11
|
+
/// poster can set. 0 means splits are not allowed.
|
|
12
|
+
/// @custom:member allowedAddresses A list of addresses that are allowed to post on the category through Croptop.
|
|
13
|
+
struct CTDeployerAllowedPost {
|
|
14
|
+
uint24 category;
|
|
15
|
+
uint104 minimumPrice;
|
|
16
|
+
uint32 minimumTotalSupply;
|
|
17
|
+
uint32 maximumTotalSupply;
|
|
18
|
+
uint32 maximumSplitPercent;
|
|
19
|
+
address[] allowedAddresses;
|
|
20
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import {JBSplit} from "@bananapus/core-v5/src/structs/JBSplit.sol";
|
|
5
|
+
|
|
6
|
+
/// @notice A post to be published.
|
|
7
|
+
/// @custom:member encodedIPFSUri The encoded IPFS URI of the post that is being published.
|
|
8
|
+
/// @custom:member totalSupply The number of NFTs that should be made available, including the 1 that will be minted
|
|
9
|
+
/// alongside this transaction.
|
|
10
|
+
/// @custom:member price The price being paid for buying the post that is being published.
|
|
11
|
+
/// @custom:member category The category that the post should be published in.
|
|
12
|
+
/// @custom:member splitPercent The percent of the tier's price to route to the splits (out of
|
|
13
|
+
/// JBConstants.SPLITS_TOTAL_PERCENT).
|
|
14
|
+
/// @custom:member splits The splits to route funds to when this tier is minted.
|
|
15
|
+
struct CTPost {
|
|
16
|
+
bytes32 encodedIPFSUri;
|
|
17
|
+
uint32 totalSupply;
|
|
18
|
+
uint104 price;
|
|
19
|
+
uint24 category;
|
|
20
|
+
uint32 splitPercent;
|
|
21
|
+
JBSplit[] splits;
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import {JBTerminalConfig} from "@bananapus/core-v6/src/structs/JBTerminalConfig.sol";
|
|
5
|
+
import {CTDeployerAllowedPost} from "../structs/CTDeployerAllowedPost.sol";
|
|
6
|
+
|
|
7
|
+
/// @param terminalConfigurations The terminals that the network uses to accept payments through.
|
|
8
|
+
/// @param projectUri The metadata URI containing project info.
|
|
9
|
+
/// @param allowedPosts The type of posts that the project should allow.
|
|
10
|
+
/// @param contractUri A link to the collection's metadata.
|
|
11
|
+
/// @param name The name of the collection where posts will go.
|
|
12
|
+
/// @param symbol The symbol of the collection where posts will go.
|
|
13
|
+
/// @param salt A salt to use for the deterministic deployment.
|
|
14
|
+
struct CTProjectConfig {
|
|
15
|
+
JBTerminalConfig[] terminalConfigurations;
|
|
16
|
+
string projectUri;
|
|
17
|
+
CTDeployerAllowedPost[] allowedPosts;
|
|
18
|
+
string contractUri;
|
|
19
|
+
string name;
|
|
20
|
+
string symbol;
|
|
21
|
+
bytes32 salt;
|
|
22
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity ^0.8.0;
|
|
3
|
+
|
|
4
|
+
import {JBSuckerDeployerConfig} from "@bananapus/suckers-v6/src/structs/JBSuckerDeployerConfig.sol";
|
|
5
|
+
|
|
6
|
+
/// @custom:member deployerConfigurations The information for how to suck tokens to other chains.
|
|
7
|
+
/// @custom:member salt The salt to use for creating suckers so that they use the same address across chains.
|
|
8
|
+
struct CTSuckerDeploymentConfig {
|
|
9
|
+
JBSuckerDeployerConfig[] deployerConfigurations;
|
|
10
|
+
bytes32 salt;
|
|
11
|
+
}
|