@croptop/core-v6 0.0.49 → 0.0.51

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@croptop/core-v6",
3
- "version": "0.0.49",
3
+ "version": "0.0.51",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,17 +29,17 @@
29
29
  "artifacts": "source ./.env && npx sphinx artifacts --org-id 'ea165b21-7cdc-4d7b-be59-ecdd4c26bee4' --project-name 'croptop-core-v6'"
30
30
  },
31
31
  "dependencies": {
32
- "@bananapus/721-hook-v6": "^0.0.51",
33
- "@bananapus/core-v6": "^0.0.54",
34
- "@bananapus/ownable-v6": "^0.0.25",
32
+ "@bananapus/721-hook-v6": "^0.0.52",
33
+ "@bananapus/core-v6": "^0.0.55",
34
+ "@bananapus/ownable-v6": "^0.0.26",
35
35
  "@bananapus/permission-ids-v6": "^0.0.25",
36
- "@bananapus/router-terminal-v6": "^0.0.44",
37
- "@bananapus/suckers-v6": "^0.0.47",
36
+ "@bananapus/router-terminal-v6": "^0.0.45",
37
+ "@bananapus/suckers-v6": "^0.0.48",
38
38
  "@openzeppelin/contracts": "5.6.1",
39
- "@rev-net/core-v6": "^0.0.56"
39
+ "@rev-net/core-v6": "^0.0.58"
40
40
  },
41
41
  "devDependencies": {
42
- "@bananapus/address-registry-v6": "^0.0.25",
42
+ "@bananapus/address-registry-v6": "^0.0.26",
43
43
  "@sphinx-labs/plugins": "0.33.3"
44
44
  }
45
45
  }
@@ -8,18 +8,18 @@ import {
8
8
  RouterTerminalDeployment,
9
9
  RouterTerminalDeploymentLib
10
10
  } from "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
11
- import {
12
- RevnetCoreDeployment,
13
- RevnetCoreDeploymentLib
14
- } from "@rev-net/core-v6/script/helpers/RevnetCoreDeploymentLib.sol";
15
11
  import {CroptopDeployment, CroptopDeploymentLib} from "./helpers/CroptopDeploymentLib.sol";
16
12
 
13
+ import {SphinxConstants, NetworkInfo} from "@sphinx-labs/contracts/contracts/foundry/SphinxConstants.sol";
17
14
  import {Sphinx} from "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
18
- import {Script} from "forge-std/Script.sol";
15
+ import {Script, stdJson} from "forge-std/Script.sol";
16
+ import {Vm} from "forge-std/Vm.sol";
19
17
 
18
+ import {IJB721TiersHook} from "@bananapus/721-hook-v6/src/interfaces/IJB721TiersHook.sol";
20
19
  import {IJB721TokenUriResolver} from "@bananapus/721-hook-v6/src/interfaces/IJB721TokenUriResolver.sol";
21
20
  import {JB721InitTiersConfig} from "@bananapus/721-hook-v6/src/structs/JB721InitTiersConfig.sol";
22
21
  import {JB721TierConfig} from "@bananapus/721-hook-v6/src/structs/JB721TierConfig.sol";
22
+ import {IJBDirectory} from "@bananapus/core-v6/src/interfaces/IJBDirectory.sol";
23
23
  import {IJBSplitHook} from "@bananapus/core-v6/src/interfaces/IJBSplitHook.sol";
24
24
  import {IJBTerminal} from "@bananapus/core-v6/src/interfaces/IJBTerminal.sol";
25
25
  import {JBAccountingContext} from "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
@@ -47,6 +47,74 @@ struct FeeProjectConfig {
47
47
  REVCroptopAllowedPost[] allowedPosts;
48
48
  }
49
49
 
50
+ interface IREVDeployerForCroptopFeeProject {
51
+ function DIRECTORY() external view returns (IJBDirectory);
52
+
53
+ function deployFor(
54
+ uint256 revnetId,
55
+ REVConfig memory configuration,
56
+ JBTerminalConfig[] memory terminalConfigurations,
57
+ REVSuckerDeploymentConfig memory suckerDeploymentConfiguration,
58
+ REVDeploy721TiersHookConfig memory tiered721HookConfiguration,
59
+ REVCroptopAllowedPost[] memory allowedPosts
60
+ )
61
+ external
62
+ returns (uint256, IJB721TiersHook hook);
63
+ }
64
+
65
+ struct RevnetCoreDeployment {
66
+ IREVDeployerForCroptopFeeProject basicDeployer;
67
+ }
68
+
69
+ library RevnetCoreDeploymentLib {
70
+ address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code"))));
71
+ // forge-lint: disable-next-line(screaming-snake-case-const)
72
+ Vm internal constant vm = Vm(VM_ADDRESS);
73
+
74
+ function getDeployment(string memory path) internal returns (RevnetCoreDeployment memory deployment) {
75
+ uint256 chainId = block.chainid;
76
+ SphinxConstants sphinxConstants = new SphinxConstants();
77
+ NetworkInfo[] memory networks = sphinxConstants.getNetworkInfoArray();
78
+
79
+ for (uint256 i; i < networks.length; i++) {
80
+ if (networks[i].chainId == chainId) return getDeployment({path: path, networkName: networks[i].name});
81
+ }
82
+
83
+ revert("ChainID is not (currently) supported by Sphinx.");
84
+ }
85
+
86
+ function getDeployment(
87
+ string memory path,
88
+ string memory networkName
89
+ )
90
+ internal
91
+ view
92
+ returns (RevnetCoreDeployment memory deployment)
93
+ {
94
+ deployment.basicDeployer = IREVDeployerForCroptopFeeProject(
95
+ _getDeploymentAddress({
96
+ path: path, projectName: "revnet-core-v6", networkName: networkName, contractName: "REVDeployer"
97
+ })
98
+ );
99
+ }
100
+
101
+ function _getDeploymentAddress(
102
+ string memory path,
103
+ string memory projectName,
104
+ string memory networkName,
105
+ string memory contractName
106
+ )
107
+ private
108
+ view
109
+ returns (address)
110
+ {
111
+ string memory deploymentJson =
112
+ // forge-lint: disable-next-line(unsafe-cheatcode)
113
+ vm.readFile(string.concat(path, projectName, "/", networkName, "/", contractName, ".json"));
114
+ return stdJson.readAddress({json: deploymentJson, key: ".address"});
115
+ }
116
+ }
117
+
50
118
  contract ConfigureFeeProjectScript is Script, Sphinx {
51
119
  /// @notice tracks the deployment of the core contracts for the chain we are deploying to.
52
120
  CoreDeployment core;
@@ -118,7 +186,7 @@ contract ConfigureFeeProjectScript is Script, Sphinx {
118
186
  );
119
187
 
120
188
  // We do a quick sanity check to make sure revnet and croptop use the same juicebox core contracts.
121
- require(revnet.basic_deployer.DIRECTORY() == croptop.publisher.DIRECTORY());
189
+ require(revnet.basicDeployer.DIRECTORY() == croptop.publisher.DIRECTORY());
122
190
 
123
191
  // Set the operator address to be the multisig.
124
192
  operator = safeAddress();
@@ -338,10 +406,10 @@ contract ConfigureFeeProjectScript is Script, Sphinx {
338
406
  // Only deploy if the project hasn't already been configured (restart-safe).
339
407
  if (address(core.directory.controllerOf(feeProjectId)) == address(0)) {
340
408
  // Approve the basic deployer to configure the project and transfer it.
341
- core.projects.approve({to: address(revnet.basic_deployer), tokenId: feeProjectId});
409
+ core.projects.approve({to: address(revnet.basicDeployer), tokenId: feeProjectId});
342
410
 
343
411
  // Deploy the NANA fee project.
344
- revnet.basic_deployer
412
+ revnet.basicDeployer
345
413
  .deployFor({
346
414
  revnetId: feeProjectId,
347
415
  configuration: feeProjectConfig.configuration,
@@ -90,7 +90,7 @@ contract DeployScript is Script, Sphinx {
90
90
  salt: _DEPLOYER_SALT,
91
91
  creationCode: type(CTDeployer).creationCode,
92
92
  arguments: abi.encode(
93
- core.permissions, core.projects, hook.hook_deployer, publisher, suckers.registry, trustedForwarder
93
+ core.permissions, core.projects, hook.hookDeployer, publisher, suckers.registry, trustedForwarder
94
94
  )
95
95
  });
96
96
 
@@ -99,7 +99,7 @@ contract DeployScript is Script, Sphinx {
99
99
  ? new CTDeployer{salt: _DEPLOYER_SALT}({
100
100
  permissions: core.permissions,
101
101
  projects: core.projects,
102
- deployer: hook.hook_deployer,
102
+ deployer: hook.hookDeployer,
103
103
  publisher: publisher,
104
104
  suckerRegistry: suckers.registry,
105
105
  trustedForwarder: trustedForwarder
@@ -131,7 +131,7 @@ contract CTDeployer is ERC2771Context, JBPermissioned, IJBRulesetDataHook, IERC7
131
131
  /// @param hook The hook to claim ownership of.
132
132
  function claimCollectionOwnershipOf(IJB721TiersHook hook) external override {
133
133
  // Get the project ID of the hook.
134
- uint256 projectId = hook.PROJECT_ID();
134
+ uint256 projectId = hook.projectId();
135
135
 
136
136
  // Keep a reference to the caller.
137
137
  address caller = _msgSender();
@@ -136,7 +136,7 @@ contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
136
136
  // Enforce permissions.
137
137
  _requirePermissionFrom({
138
138
  account: JBOwnable(allowedPost.hook).owner(),
139
- projectId: IJB721TiersHook(allowedPost.hook).PROJECT_ID(),
139
+ projectId: IJB721TiersHook(allowedPost.hook).projectId(),
140
140
  permissionId: JBPermissionIds.ADJUST_721_TIERS
141
141
  });
142
142
 
@@ -214,7 +214,7 @@ contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
214
214
  bytes memory mintMetadata;
215
215
 
216
216
  // Keep a reference to the project's ID.
217
- uint256 projectId = hook.PROJECT_ID();
217
+ uint256 projectId = hook.projectId();
218
218
 
219
219
  {
220
220
  // Setup the posts.
@@ -487,7 +487,7 @@ contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
487
487
  store.tierOf({hook: address(hook), id: tierId, includeResolvedUri: false});
488
488
  if (
489
489
  store.isTierRemoved({hook: address(hook), tierId: tierId})
490
- || cachedTier.encodedIPFSUri != post.encodedIpfsUri
490
+ || cachedTier.encodedIpfsUri != post.encodedIpfsUri
491
491
  ) {
492
492
  delete tierIdForEncodedIpfsUriOf[address(hook)][post.encodedIpfsUri];
493
493
  } else {
@@ -559,7 +559,7 @@ contract CTPublisher is JBPermissioned, ERC2771Context, ICTPublisher {
559
559
  votingUnits: 0,
560
560
  reserveFrequency: 0,
561
561
  reserveBeneficiary: address(0),
562
- encodedIPFSUri: post.encodedIpfsUri,
562
+ encodedIpfsUri: post.encodedIpfsUri,
563
563
  category: post.category,
564
564
  discountPercent: 0,
565
565
  flags: JB721TierConfigFlags({