@croptop/core-v6 0.0.57 → 0.0.59

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.57",
3
+ "version": "0.0.59",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -26,17 +26,17 @@
26
26
  "artifacts": "source ./.env && npx sphinx artifacts --org-id 'ea165b21-7cdc-4d7b-be59-ecdd4c26bee4' --project-name 'croptop-core-v6'"
27
27
  },
28
28
  "dependencies": {
29
- "@bananapus/721-hook-v6": "^0.0.55",
30
- "@bananapus/core-v6": "^0.0.60",
31
- "@bananapus/ownable-v6": "^0.0.28",
29
+ "@bananapus/721-hook-v6": "^0.0.57",
30
+ "@bananapus/core-v6": "^0.0.68",
31
+ "@bananapus/ownable-v6": "^0.0.31",
32
32
  "@bananapus/permission-ids-v6": "^0.0.27",
33
- "@bananapus/router-terminal-v6": "^0.0.49",
34
- "@bananapus/suckers-v6": "^0.0.52",
33
+ "@bananapus/router-terminal-v6": "^0.0.52",
34
+ "@bananapus/suckers-v6": "^0.0.58",
35
35
  "@openzeppelin/contracts": "5.6.1",
36
- "@rev-net/core-v6": "^0.0.67"
36
+ "@rev-net/core-v6": "^0.0.75"
37
37
  },
38
38
  "devDependencies": {
39
- "@bananapus/address-registry-v6": "^0.0.26",
39
+ "@bananapus/address-registry-v6": "^0.0.28",
40
40
  "@sphinx-labs/plugins": "0.33.3"
41
41
  }
42
42
  }
@@ -2,13 +2,13 @@
2
2
  pragma solidity 0.8.28;
3
3
 
4
4
  import {Hook721Deployment, Hook721DeploymentLib} from "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
5
- import {CoreDeployment, CoreDeploymentLib} from "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
6
5
  import {SuckerDeployment, SuckerDeploymentLib} from "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
7
6
  import {
8
7
  RouterTerminalDeployment,
9
8
  RouterTerminalDeploymentLib
10
9
  } from "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
11
10
  import {CroptopDeployment, CroptopDeploymentLib} from "./helpers/CroptopDeploymentLib.sol";
11
+ import {CoreDeployment, CoreDeploymentLib} from "./helpers/CoreDeploymentLib.sol";
12
12
 
13
13
  import {SphinxConstants, NetworkInfo} from "@sphinx-labs/contracts/contracts/foundry/SphinxConstants.sol";
14
14
  import {Sphinx} from "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
@@ -2,7 +2,6 @@
2
2
  pragma solidity 0.8.28;
3
3
 
4
4
  import {Hook721Deployment, Hook721DeploymentLib} from "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
5
- import {CoreDeployment, CoreDeploymentLib} from "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
6
5
  import {SuckerDeployment, SuckerDeploymentLib} from "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
7
6
 
8
7
  import {Sphinx} from "@sphinx-labs/contracts/contracts/foundry/SphinxPlugin.sol";
@@ -11,6 +10,7 @@ import {Script} from "forge-std/Script.sol";
11
10
  import {CTDeployer} from "./../src/CTDeployer.sol";
12
11
  import {CTProjectOwner} from "./../src/CTProjectOwner.sol";
13
12
  import {CTPublisher} from "./../src/CTPublisher.sol";
13
+ import {CoreDeployment, CoreDeploymentLib} from "./helpers/CoreDeploymentLib.sol";
14
14
 
15
15
  contract DeployScript is Script, Sphinx {
16
16
  /// @notice tracks the deployment of the core contracts for the chain we are deploying to.
@@ -0,0 +1,172 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity 0.8.28;
3
+
4
+ import {stdJson} from "forge-std/Script.sol";
5
+ import {Vm} from "forge-std/Vm.sol";
6
+
7
+ import {JBController} from "@bananapus/core-v6/src/JBController.sol";
8
+ import {JBDirectory} from "@bananapus/core-v6/src/JBDirectory.sol";
9
+ import {JBFeelessAddresses} from "@bananapus/core-v6/src/JBFeelessAddresses.sol";
10
+ import {JBFundAccessLimits} from "@bananapus/core-v6/src/JBFundAccessLimits.sol";
11
+ import {JBMultiTerminal} from "@bananapus/core-v6/src/JBMultiTerminal.sol";
12
+ import {JBPermissions} from "@bananapus/core-v6/src/JBPermissions.sol";
13
+ import {JBPrices} from "@bananapus/core-v6/src/JBPrices.sol";
14
+ import {JBProjects} from "@bananapus/core-v6/src/JBProjects.sol";
15
+ import {JBRulesets} from "@bananapus/core-v6/src/JBRulesets.sol";
16
+ import {JBSplits} from "@bananapus/core-v6/src/JBSplits.sol";
17
+ import {JBTerminalStore} from "@bananapus/core-v6/src/JBTerminalStore.sol";
18
+ import {JBTokens} from "@bananapus/core-v6/src/JBTokens.sol";
19
+
20
+ import {SphinxConstants, NetworkInfo} from "@sphinx-labs/contracts/contracts/foundry/SphinxConstants.sol";
21
+
22
+ struct CoreDeployment {
23
+ JBPermissions permissions;
24
+ JBProjects projects;
25
+ JBDirectory directory;
26
+ JBSplits splits;
27
+ JBRulesets rulesets;
28
+ JBController controller;
29
+ JBMultiTerminal terminal;
30
+ JBTerminalStore terminalStore;
31
+ JBPrices prices;
32
+ JBFeelessAddresses feeless;
33
+ JBFundAccessLimits fundAccess;
34
+ JBTokens tokens;
35
+ address trustedForwarder;
36
+ }
37
+
38
+ library CoreDeploymentLib {
39
+ address internal constant VM_ADDRESS = address(uint160(uint256(keccak256("hevm cheat code"))));
40
+ // forge-lint: disable-next-line(screaming-snake-case-const)
41
+ Vm internal constant vm = Vm(VM_ADDRESS);
42
+ string internal constant PROJECT_NAME = "nana-core-v6";
43
+
44
+ function getDeployment(string memory path) internal returns (CoreDeployment memory deployment) {
45
+ uint256 chainId = block.chainid;
46
+
47
+ SphinxConstants sphinxConstants = new SphinxConstants();
48
+ NetworkInfo[] memory networks = sphinxConstants.getNetworkInfoArray();
49
+
50
+ for (uint256 i; i < networks.length; i++) {
51
+ if (networks[i].chainId == chainId) return getDeployment({path: path, networkName: networks[i].name});
52
+ }
53
+
54
+ revert("ChainID is not (currently) supported by Sphinx.");
55
+ }
56
+
57
+ function getDeployment(
58
+ string memory path,
59
+ string memory networkName
60
+ )
61
+ internal
62
+ returns (CoreDeployment memory deployment)
63
+ {
64
+ deployment.permissions = JBPermissions(
65
+ _getDeploymentAddress({
66
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBPermissions"
67
+ })
68
+ );
69
+
70
+ deployment.projects = JBProjects(
71
+ _getDeploymentAddress({
72
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBProjects"
73
+ })
74
+ );
75
+
76
+ deployment.directory = JBDirectory(
77
+ _getDeploymentAddress({
78
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBDirectory"
79
+ })
80
+ );
81
+
82
+ deployment.splits = JBSplits(
83
+ _getDeploymentAddress({
84
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBSplits"
85
+ })
86
+ );
87
+
88
+ deployment.rulesets = JBRulesets(
89
+ _getDeploymentAddress({
90
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBRulesets"
91
+ })
92
+ );
93
+
94
+ deployment.controller = JBController(
95
+ _tryGetDeploymentAddress({
96
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBController"
97
+ })
98
+ );
99
+
100
+ deployment.terminal = JBMultiTerminal(
101
+ _getDeploymentAddress({
102
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBMultiTerminal"
103
+ })
104
+ );
105
+
106
+ deployment.terminalStore = JBTerminalStore(
107
+ _getDeploymentAddress({
108
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBTerminalStore"
109
+ })
110
+ );
111
+
112
+ deployment.prices = JBPrices(
113
+ _getDeploymentAddress({
114
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBPrices"
115
+ })
116
+ );
117
+
118
+ deployment.feeless = JBFeelessAddresses(
119
+ _getDeploymentAddress({
120
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBFeelessAddresses"
121
+ })
122
+ );
123
+
124
+ deployment.fundAccess = JBFundAccessLimits(
125
+ _getDeploymentAddress({
126
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBFundAccessLimits"
127
+ })
128
+ );
129
+
130
+ deployment.tokens = JBTokens(
131
+ _getDeploymentAddress({
132
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "JBTokens"
133
+ })
134
+ );
135
+
136
+ deployment.trustedForwarder = _getDeploymentAddress({
137
+ path: path, projectName: PROJECT_NAME, networkName: networkName, contractName: "ERC2771Forwarder"
138
+ });
139
+ }
140
+
141
+ function _getDeploymentAddress(
142
+ string memory path,
143
+ string memory projectName,
144
+ string memory networkName,
145
+ string memory contractName
146
+ )
147
+ internal
148
+ view
149
+ returns (address)
150
+ {
151
+ string memory deploymentJson =
152
+ // forge-lint: disable-next-line(unsafe-cheatcode)
153
+ vm.readFile(string.concat(path, projectName, "/", networkName, "/", contractName, ".json"));
154
+ return stdJson.readAddress({json: deploymentJson, key: ".address"});
155
+ }
156
+
157
+ function _tryGetDeploymentAddress(
158
+ string memory path,
159
+ string memory projectName,
160
+ string memory networkName,
161
+ string memory contractName
162
+ )
163
+ internal
164
+ returns (address)
165
+ {
166
+ string memory filePath = string.concat(path, projectName, "/", networkName, "/", contractName, ".json");
167
+ // forge-lint: disable-next-line(unsafe-cheatcode)
168
+ if (!vm.exists(filePath)) return address(0);
169
+ // forge-lint: disable-next-line(unsafe-cheatcode)
170
+ return stdJson.readAddress({json: vm.readFile(filePath), key: ".address"});
171
+ }
172
+ }
@@ -184,6 +184,7 @@ contract CTDeployer is ERC2771Context, JBPermissioned, IJBRulesetDataHook, IERC7
184
184
  IJBController controller
185
185
  )
186
186
  external
187
+ payable
187
188
  override
188
189
  returns (uint256 projectId, IJB721TiersHook hook)
189
190
  {
@@ -194,7 +195,7 @@ contract CTDeployer is ERC2771Context, JBPermissioned, IJBRulesetDataHook, IERC7
194
195
  rulesetConfigurations[0].metadata.baseCurrency = JBCurrencyIds.ETH;
195
196
 
196
197
  // Reserve the project ID up front so permissionless project creations cannot invalidate hook deployment.
197
- projectId = PROJECTS.createFor(address(this));
198
+ projectId = PROJECTS.createFor{value: msg.value}(address(this));
198
199
 
199
200
  // Deploy a blank project.
200
201
  hook = DEPLOYER.deployHookFor({
@@ -43,6 +43,7 @@ interface ICTDeployer {
43
43
  IJBController controller
44
44
  )
45
45
  external
46
+ payable
46
47
  returns (uint256 projectId, IJB721TiersHook hook);
47
48
 
48
49
  /// @notice Deploy new suckers for an existing project.