@rev-net/core-v6 0.0.73 → 0.0.74
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": "@rev-net/core-v6",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.74",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@bananapus/721-hook-v6": "^0.0.55",
|
|
28
28
|
"@bananapus/buyback-hook-v6": "^0.0.51",
|
|
29
|
-
"@bananapus/core-v6": "^0.0.
|
|
29
|
+
"@bananapus/core-v6": "^0.0.64",
|
|
30
30
|
"@bananapus/ownable-v6": "^0.0.28",
|
|
31
31
|
"@bananapus/permission-ids-v6": "^0.0.27",
|
|
32
32
|
"@bananapus/router-terminal-v6": "^0.0.49",
|
package/script/Deploy.s.sol
CHANGED
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
BuybackDeployment,
|
|
7
7
|
BuybackDeploymentLib
|
|
8
8
|
} from "@bananapus/buyback-hook-v6/script/helpers/BuybackDeploymentLib.sol";
|
|
9
|
-
import {CoreDeployment, CoreDeploymentLib} from "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
10
9
|
import {SuckerDeployment, SuckerDeploymentLib} from "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
11
10
|
import {
|
|
12
11
|
RouterTerminalDeployment,
|
|
@@ -44,6 +43,7 @@ import {JB721InitTiersConfig} from "@bananapus/721-hook-v6/src/structs/JB721Init
|
|
|
44
43
|
import {JB721TierConfig} from "@bananapus/721-hook-v6/src/structs/JB721TierConfig.sol";
|
|
45
44
|
import {REVBaseline721HookConfig} from "../src/structs/REVBaseline721HookConfig.sol";
|
|
46
45
|
import {REV721TiersHookFlags} from "../src/structs/REV721TiersHookFlags.sol";
|
|
46
|
+
import {CoreDeployment, CoreDeploymentLib} from "./helpers/CoreDeploymentLib.sol";
|
|
47
47
|
|
|
48
48
|
struct FeeProjectConfig {
|
|
49
49
|
REVConfig configuration;
|
|
@@ -426,7 +426,7 @@ contract DeployScript is Script, Sphinx {
|
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
if (!_foundExisting) {
|
|
429
|
-
feeProjectId = core.projects.createFor(safeAddress());
|
|
429
|
+
feeProjectId = core.projects.createFor{value: core.projects.creationFee()}(safeAddress());
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
432
|
|
|
@@ -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
|
+
}
|
package/src/REVDeployer.sol
CHANGED
|
@@ -64,6 +64,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
64
64
|
error REVDeployer_AutoIssuanceBeneficiaryZeroAddress(uint256 stageIndex, uint256 autoIssuanceIndex);
|
|
65
65
|
error REVDeployer_CashOutsCantBeTurnedOffCompletely(uint256 cashOutTaxRate, uint256 maxCashOutTaxRate);
|
|
66
66
|
error REVDeployer_MustHaveSplits(uint256 stageIndex, uint256 splitPercent);
|
|
67
|
+
error REVDeployer_ProjectCreationFeeNotNeeded(uint256 revnetId, uint256 value);
|
|
67
68
|
error REVDeployer_RulesetDoesNotAllowDeployingSuckers(uint256 revnetId);
|
|
68
69
|
error REVDeployer_StagesRequired(uint256 stageCount);
|
|
69
70
|
error REVDeployer_StageTimesMustIncrease(uint256 stageIndex, uint256 previousStageStart, uint256 effectiveStart);
|
|
@@ -492,6 +493,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
492
493
|
REVCroptopAllowedPost[] calldata allowedPosts
|
|
493
494
|
)
|
|
494
495
|
external
|
|
496
|
+
payable
|
|
495
497
|
override
|
|
496
498
|
returns (uint256, IJB721TiersHook hook)
|
|
497
499
|
{
|
|
@@ -499,7 +501,11 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
499
501
|
bool shouldDeployNewRevnet = revnetId == 0;
|
|
500
502
|
|
|
501
503
|
// If the caller is deploying a new revnet, reserve its project ID before deriving hook/sucker config.
|
|
502
|
-
if (shouldDeployNewRevnet)
|
|
504
|
+
if (shouldDeployNewRevnet) {
|
|
505
|
+
revnetId = PROJECTS.createFor{value: msg.value}(address(this));
|
|
506
|
+
} else if (msg.value != 0) {
|
|
507
|
+
revert REVDeployer_ProjectCreationFeeNotNeeded({revnetId: revnetId, value: msg.value});
|
|
508
|
+
}
|
|
503
509
|
|
|
504
510
|
// Deploy the revnet with the specified tiered ERC-721 hook and croptop posting criteria.
|
|
505
511
|
hook = _deploy721RevnetFor({
|
|
@@ -524,11 +530,16 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
524
530
|
REVSuckerDeploymentConfig calldata suckerDeploymentConfiguration
|
|
525
531
|
)
|
|
526
532
|
external
|
|
533
|
+
payable
|
|
527
534
|
override
|
|
528
535
|
returns (uint256, IJB721TiersHook hook)
|
|
529
536
|
{
|
|
530
537
|
bool shouldDeployNewRevnet = revnetId == 0;
|
|
531
|
-
if (shouldDeployNewRevnet)
|
|
538
|
+
if (shouldDeployNewRevnet) {
|
|
539
|
+
revnetId = PROJECTS.createFor{value: msg.value}(address(this));
|
|
540
|
+
} else if (msg.value != 0) {
|
|
541
|
+
revert REVDeployer_ProjectCreationFeeNotNeeded({revnetId: revnetId, value: msg.value});
|
|
542
|
+
}
|
|
532
543
|
|
|
533
544
|
// Deploy the revnet (project, rulesets, ERC-20, suckers, etc.).
|
|
534
545
|
(bytes32 encodedConfigurationHash, REVOwnerRevnetInit memory ownerInit) = _deployRevnetFor({
|
|
@@ -156,6 +156,7 @@ interface IREVDeployer {
|
|
|
156
156
|
REVCroptopAllowedPost[] memory allowedPosts
|
|
157
157
|
)
|
|
158
158
|
external
|
|
159
|
+
payable
|
|
159
160
|
returns (uint256, IJB721TiersHook hook);
|
|
160
161
|
|
|
161
162
|
/// @notice Deploy a revnet with a default empty tiered ERC-721 hook.
|
|
@@ -173,6 +174,7 @@ interface IREVDeployer {
|
|
|
173
174
|
REVSuckerDeploymentConfig memory suckerDeploymentConfiguration
|
|
174
175
|
)
|
|
175
176
|
external
|
|
177
|
+
payable
|
|
176
178
|
returns (uint256, IJB721TiersHook hook);
|
|
177
179
|
|
|
178
180
|
/// @notice Deploy new suckers for an existing revnet.
|