@rev-net/core-v6 0.0.36 → 0.0.39
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/CHANGELOG.md +2 -2
- package/README.md +6 -7
- package/foundry.toml +1 -1
- package/package.json +23 -16
- package/references/operations.md +1 -1
- package/references/runtime.md +1 -1
- package/script/Deploy.s.sol +12 -9
- package/src/REVDeployer.sol +60 -65
- package/src/REVHiddenTokens.sol +2 -2
- package/src/REVLoans.sol +134 -90
- package/src/REVOwner.sol +124 -17
- package/src/interfaces/IREVDeployer.sol +2 -1
- package/src/interfaces/IREVHiddenTokens.sol +4 -1
- package/src/interfaces/IREVOwner.sol +5 -0
- package/ADMINISTRATION.md +0 -73
- package/ARCHITECTURE.md +0 -116
- package/AUDIT_INSTRUCTIONS.md +0 -90
- package/RISKS.md +0 -97
- package/SKILLS.md +0 -46
- package/STYLE_GUIDE.md +0 -610
- package/USER_JOURNEYS.md +0 -195
- package/foundry.lock +0 -11
- package/slither-ci.config.json +0 -10
- package/sphinx.lock +0 -507
- package/test/REV.integrations.t.sol +0 -573
- package/test/REVAutoIssuanceFuzz.t.sol +0 -328
- package/test/REVDeployerRegressions.t.sol +0 -396
- package/test/REVInvincibility.t.sol +0 -1371
- package/test/REVInvincibilityHandler.sol +0 -387
- package/test/REVLifecycle.t.sol +0 -420
- package/test/REVLoans.invariants.t.sol +0 -724
- package/test/REVLoansAttacks.t.sol +0 -816
- package/test/REVLoansFeeRecovery.t.sol +0 -783
- package/test/REVLoansFindings.t.sol +0 -711
- package/test/REVLoansRegressions.t.sol +0 -364
- package/test/REVLoansSourceFeeRecovery.t.sol +0 -517
- package/test/REVLoansSourced.t.sol +0 -1839
- package/test/REVLoansUnSourced.t.sol +0 -409
- package/test/TestAuditFixVerification.t.sol +0 -675
- package/test/TestBurnHeldTokens.t.sol +0 -394
- package/test/TestCEIPattern.t.sol +0 -508
- package/test/TestCashOutCallerValidation.t.sol +0 -452
- package/test/TestConversionDocumentation.t.sol +0 -368
- package/test/TestCrossCurrencyReclaim.t.sol +0 -610
- package/test/TestCrossSourceReallocation.t.sol +0 -361
- package/test/TestERC2771MetaTx.t.sol +0 -585
- package/test/TestEmptyBuybackSpecs.t.sol +0 -300
- package/test/TestFlashLoanSurplus.t.sol +0 -365
- package/test/TestHiddenTokens.t.sol +0 -474
- package/test/TestHookArrayOOB.t.sol +0 -278
- package/test/TestLiquidationBehavior.t.sol +0 -398
- package/test/TestLoanSourceRotation.t.sol +0 -553
- package/test/TestLoansCashOutDelay.t.sol +0 -493
- package/test/TestLongTailEconomics.t.sol +0 -677
- package/test/TestLowFindings.t.sol +0 -677
- package/test/TestMixedFixes.t.sol +0 -593
- package/test/TestPermit2Signatures.t.sol +0 -683
- package/test/TestReallocationSandwich.t.sol +0 -412
- package/test/TestRevnetRegressions.t.sol +0 -350
- package/test/TestSplitWeightAdjustment.t.sol +0 -527
- package/test/TestSplitWeightE2E.t.sol +0 -605
- package/test/TestSplitWeightFork.t.sol +0 -855
- package/test/TestStageTransitionBorrowable.t.sol +0 -301
- package/test/TestSwapTerminalPermission.t.sol +0 -262
- package/test/TestTerminalEncodingInHash.t.sol +0 -326
- package/test/TestUint112Overflow.t.sol +0 -311
- package/test/TestZeroAmountLoanGuard.t.sol +0 -378
- package/test/TestZeroRepayment.t.sol +0 -354
- package/test/audit/CodexCrossChainBuybackRouteMismatch.t.sol +0 -184
- package/test/audit/CodexPhantomSurplusTerminal.t.sol +0 -367
- package/test/audit/CodexREVOwnerRemoteSurplusCurrencyMismatch.t.sol +0 -142
- package/test/audit/LoanIdOverflowGuard.t.sol +0 -523
- package/test/audit/NemesisOperatorDelegation.t.sol +0 -356
- package/test/audit/SupportsInterfaceTest.t.sol +0 -51
- package/test/audit/TestFeeAllowanceLeak.t.sol +0 -197
- package/test/audit/TestLoansAndDeployerFixes.t.sol +0 -576
- package/test/fork/ForkTestBase.sol +0 -727
- package/test/fork/TestAutoIssuanceFork.t.sol +0 -148
- package/test/fork/TestCashOutFork.t.sol +0 -253
- package/test/fork/TestIssuanceDecayFork.t.sol +0 -158
- package/test/fork/TestLoanBorrowFork.t.sol +0 -163
- package/test/fork/TestLoanCrossRulesetFork.t.sol +0 -308
- package/test/fork/TestLoanERC20Fork.t.sol +0 -465
- package/test/fork/TestLoanLiquidationFork.t.sol +0 -135
- package/test/fork/TestLoanReallocateFork.t.sol +0 -113
- package/test/fork/TestLoanRepayFork.t.sol +0 -188
- package/test/fork/TestLoanTransferFork.t.sol +0 -143
- package/test/fork/TestPermit2PaymentFork.t.sol +0 -300
- package/test/fork/TestSplitWeightFork.t.sol +0 -189
- package/test/helpers/MaliciousContracts.sol +0 -247
- package/test/helpers/REVEmpty721Config.sol +0 -45
- package/test/mock/MockBuybackCashOutRecorder.sol +0 -84
- package/test/mock/MockBuybackDataHook.sol +0 -112
- package/test/mock/MockBuybackDataHookMintPath.sol +0 -68
- package/test/mock/MockSuckerRegistry.sol +0 -17
- package/test/regression/TestBurnPermissionRequired.t.sol +0 -294
- package/test/regression/TestCashOutBuybackFeeLeak.t.sol +0 -232
- package/test/regression/TestCrossRevnetLiquidation.t.sol +0 -255
- package/test/regression/TestCumulativeLoanCounter.t.sol +0 -361
- package/test/regression/TestLiquidateGapHandling.t.sol +0 -394
- package/test/regression/TestZeroPriceFeed.t.sol +0 -422
|
@@ -1,368 +0,0 @@
|
|
|
1
|
-
// SPDX-License-Identifier: MIT
|
|
2
|
-
pragma solidity 0.8.28;
|
|
3
|
-
|
|
4
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
5
|
-
import "forge-std/Test.sol";
|
|
6
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
7
|
-
import /* {*} from */ "@bananapus/core-v6/test/helpers/TestBaseWorkflow.sol";
|
|
8
|
-
// import /* {*} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
9
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
10
|
-
import /* {*} from */ "./../src/REVDeployer.sol";
|
|
11
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
12
|
-
import "@croptop/core-v6/src/CTPublisher.sol";
|
|
13
|
-
import {MockBuybackDataHook} from "./mock/MockBuybackDataHook.sol";
|
|
14
|
-
import {REVEmpty721Config} from "./helpers/REVEmpty721Config.sol";
|
|
15
|
-
|
|
16
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
17
|
-
import "@bananapus/core-v6/script/helpers/CoreDeploymentLib.sol";
|
|
18
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
19
|
-
import "@bananapus/721-hook-v6/script/helpers/Hook721DeploymentLib.sol";
|
|
20
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
21
|
-
import "@bananapus/suckers-v6/script/helpers/SuckerDeploymentLib.sol";
|
|
22
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
23
|
-
import "@croptop/core-v6/script/helpers/CroptopDeploymentLib.sol";
|
|
24
|
-
// forge-lint: disable-next-line(unaliased-plain-import)
|
|
25
|
-
import "@bananapus/router-terminal-v6/script/helpers/RouterTerminalDeploymentLib.sol";
|
|
26
|
-
import {JBConstants} from "@bananapus/core-v6/src/libraries/JBConstants.sol";
|
|
27
|
-
import {JBAccountingContext} from "@bananapus/core-v6/src/structs/JBAccountingContext.sol";
|
|
28
|
-
import {MockERC20} from "@bananapus/core-v6/test/mock/MockERC20.sol";
|
|
29
|
-
import {REVLoans} from "../src/REVLoans.sol";
|
|
30
|
-
import {REVStageConfig, REVAutoIssuance} from "../src/structs/REVStageConfig.sol";
|
|
31
|
-
import {REVDescription} from "../src/structs/REVDescription.sol";
|
|
32
|
-
import {IREVLoans} from "./../src/interfaces/IREVLoans.sol";
|
|
33
|
-
import {JBSuckerDeployerConfig} from "@bananapus/suckers-v6/src/structs/JBSuckerDeployerConfig.sol";
|
|
34
|
-
import {JBSuckerRegistry} from "@bananapus/suckers-v6/src/JBSuckerRegistry.sol";
|
|
35
|
-
import {JB721TiersHookDeployer} from "@bananapus/721-hook-v6/src/JB721TiersHookDeployer.sol";
|
|
36
|
-
import {JB721TiersHook} from "@bananapus/721-hook-v6/src/JB721TiersHook.sol";
|
|
37
|
-
import {JB721TiersHookStore} from "@bananapus/721-hook-v6/src/JB721TiersHookStore.sol";
|
|
38
|
-
import {JB721CheckpointsDeployer} from "@bananapus/721-hook-v6/src/JB721CheckpointsDeployer.sol";
|
|
39
|
-
import {IJB721CheckpointsDeployer} from "@bananapus/721-hook-v6/src/interfaces/IJB721CheckpointsDeployer.sol";
|
|
40
|
-
import {JBAddressRegistry} from "@bananapus/address-registry-v6/src/JBAddressRegistry.sol";
|
|
41
|
-
import {IJBAddressRegistry} from "@bananapus/address-registry-v6/src/interfaces/IJBAddressRegistry.sol";
|
|
42
|
-
import {REVOwner} from "../src/REVOwner.sol";
|
|
43
|
-
import {IREVDeployer} from "../src/interfaces/IREVDeployer.sol";
|
|
44
|
-
import {MockSuckerRegistry} from "./mock/MockSuckerRegistry.sol";
|
|
45
|
-
|
|
46
|
-
contract TestConversionDocumentation is TestBaseWorkflow {
|
|
47
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
48
|
-
bytes32 REV_DEPLOYER_SALT = "REVDeployer";
|
|
49
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
50
|
-
bytes32 ERC20_SALT = "REV_TOKEN";
|
|
51
|
-
|
|
52
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
53
|
-
REVDeployer REV_DEPLOYER;
|
|
54
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
55
|
-
REVOwner REV_OWNER;
|
|
56
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
57
|
-
JB721TiersHook EXAMPLE_HOOK;
|
|
58
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
59
|
-
IJB721TiersHookDeployer HOOK_DEPLOYER;
|
|
60
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
61
|
-
IJB721TiersHookStore HOOK_STORE;
|
|
62
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
63
|
-
IJBAddressRegistry ADDRESS_REGISTRY;
|
|
64
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
65
|
-
IREVLoans LOANS_CONTRACT;
|
|
66
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
67
|
-
MockERC20 TOKEN;
|
|
68
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
69
|
-
IJBSuckerRegistry SUCKER_REGISTRY;
|
|
70
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
71
|
-
CTPublisher PUBLISHER;
|
|
72
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
73
|
-
MockBuybackDataHook MOCK_BUYBACK;
|
|
74
|
-
|
|
75
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
76
|
-
uint256 FEE_PROJECT_ID;
|
|
77
|
-
|
|
78
|
-
// forge-lint: disable-next-line(mixed-case-variable)
|
|
79
|
-
address USER = makeAddr("user");
|
|
80
|
-
|
|
81
|
-
address private constant TRUSTED_FORWARDER = 0xB2b5841DBeF766d4b521221732F9B618fCf34A87;
|
|
82
|
-
|
|
83
|
-
function _getRevnetConfig(
|
|
84
|
-
string memory name,
|
|
85
|
-
string memory symbol,
|
|
86
|
-
bytes32 salt
|
|
87
|
-
)
|
|
88
|
-
internal
|
|
89
|
-
view
|
|
90
|
-
returns (
|
|
91
|
-
REVConfig memory configuration,
|
|
92
|
-
JBTerminalConfig[] memory terminalConfigurations,
|
|
93
|
-
REVSuckerDeploymentConfig memory suckerDeploymentConfiguration
|
|
94
|
-
)
|
|
95
|
-
{
|
|
96
|
-
uint8 decimals = 18;
|
|
97
|
-
uint256 decimalMultiplier = 10 ** decimals;
|
|
98
|
-
|
|
99
|
-
JBAccountingContext[] memory accountingContextsToAccept = new JBAccountingContext[](1);
|
|
100
|
-
accountingContextsToAccept[0] = JBAccountingContext({
|
|
101
|
-
token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
terminalConfigurations = new JBTerminalConfig[](1);
|
|
105
|
-
terminalConfigurations[0] =
|
|
106
|
-
JBTerminalConfig({terminal: jbMultiTerminal(), accountingContextsToAccept: accountingContextsToAccept});
|
|
107
|
-
|
|
108
|
-
REVStageConfig[] memory stageConfigurations = new REVStageConfig[](1);
|
|
109
|
-
JBSplit[] memory splits = new JBSplit[](1);
|
|
110
|
-
splits[0].beneficiary = payable(multisig());
|
|
111
|
-
splits[0].percent = 10_000;
|
|
112
|
-
|
|
113
|
-
stageConfigurations[0] = REVStageConfig({
|
|
114
|
-
startsAtOrAfter: uint40(block.timestamp),
|
|
115
|
-
autoIssuances: new REVAutoIssuance[](0),
|
|
116
|
-
splitPercent: 2000,
|
|
117
|
-
splits: splits,
|
|
118
|
-
// forge-lint: disable-next-line(unsafe-typecast)
|
|
119
|
-
initialIssuance: uint112(1000 * decimalMultiplier),
|
|
120
|
-
issuanceCutFrequency: 90 days,
|
|
121
|
-
issuanceCutPercent: JBConstants.MAX_WEIGHT_CUT_PERCENT / 2,
|
|
122
|
-
cashOutTaxRate: 6000,
|
|
123
|
-
extraMetadata: 0
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
configuration = REVConfig({
|
|
127
|
-
// forge-lint: disable-next-line(named-struct-fields)
|
|
128
|
-
description: REVDescription(name, symbol, "ipfs://test", salt),
|
|
129
|
-
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
130
|
-
splitOperator: multisig(),
|
|
131
|
-
stageConfigurations: stageConfigurations
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
suckerDeploymentConfiguration = REVSuckerDeploymentConfig({
|
|
135
|
-
deployerConfigurations: new JBSuckerDeployerConfig[](0), salt: keccak256(abi.encodePacked(salt))
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function setUp() public override {
|
|
140
|
-
super.setUp();
|
|
141
|
-
|
|
142
|
-
FEE_PROJECT_ID = jbProjects().createFor(multisig());
|
|
143
|
-
SUCKER_REGISTRY = new JBSuckerRegistry(jbDirectory(), jbPermissions(), multisig(), address(0));
|
|
144
|
-
HOOK_STORE = new JB721TiersHookStore();
|
|
145
|
-
EXAMPLE_HOOK = new JB721TiersHook(
|
|
146
|
-
jbDirectory(),
|
|
147
|
-
jbPermissions(),
|
|
148
|
-
jbPrices(),
|
|
149
|
-
jbRulesets(),
|
|
150
|
-
HOOK_STORE,
|
|
151
|
-
jbSplits(),
|
|
152
|
-
IJB721CheckpointsDeployer(address(new JB721CheckpointsDeployer())),
|
|
153
|
-
multisig()
|
|
154
|
-
);
|
|
155
|
-
ADDRESS_REGISTRY = new JBAddressRegistry();
|
|
156
|
-
HOOK_DEPLOYER = new JB721TiersHookDeployer(EXAMPLE_HOOK, HOOK_STORE, ADDRESS_REGISTRY, multisig());
|
|
157
|
-
PUBLISHER = new CTPublisher(jbDirectory(), jbPermissions(), FEE_PROJECT_ID, multisig());
|
|
158
|
-
MOCK_BUYBACK = new MockBuybackDataHook();
|
|
159
|
-
TOKEN = new MockERC20("1/2 ETH", "1/2");
|
|
160
|
-
|
|
161
|
-
LOANS_CONTRACT = new REVLoans({
|
|
162
|
-
controller: jbController(),
|
|
163
|
-
suckerRegistry: IJBSuckerRegistry(address(new MockSuckerRegistry())),
|
|
164
|
-
revId: FEE_PROJECT_ID,
|
|
165
|
-
owner: address(this),
|
|
166
|
-
permit2: permit2(),
|
|
167
|
-
trustedForwarder: TRUSTED_FORWARDER
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
REV_OWNER = new REVOwner(
|
|
171
|
-
IJBBuybackHookRegistry(address(MOCK_BUYBACK)),
|
|
172
|
-
jbDirectory(),
|
|
173
|
-
FEE_PROJECT_ID,
|
|
174
|
-
SUCKER_REGISTRY,
|
|
175
|
-
address(LOANS_CONTRACT),
|
|
176
|
-
address(0)
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
REV_DEPLOYER = new REVDeployer{salt: REV_DEPLOYER_SALT}(
|
|
180
|
-
jbController(),
|
|
181
|
-
SUCKER_REGISTRY,
|
|
182
|
-
FEE_PROJECT_ID,
|
|
183
|
-
HOOK_DEPLOYER,
|
|
184
|
-
PUBLISHER,
|
|
185
|
-
IJBBuybackHookRegistry(address(MOCK_BUYBACK)),
|
|
186
|
-
address(LOANS_CONTRACT),
|
|
187
|
-
TRUSTED_FORWARDER,
|
|
188
|
-
address(REV_OWNER)
|
|
189
|
-
);
|
|
190
|
-
|
|
191
|
-
REV_OWNER.setDeployer(REV_DEPLOYER);
|
|
192
|
-
|
|
193
|
-
// Deploy fee project as revnet.
|
|
194
|
-
vm.prank(multisig());
|
|
195
|
-
jbProjects().approve(address(REV_DEPLOYER), FEE_PROJECT_ID);
|
|
196
|
-
|
|
197
|
-
(REVConfig memory cfg, JBTerminalConfig[] memory terms, REVSuckerDeploymentConfig memory suckerCfg) =
|
|
198
|
-
_getRevnetConfig("Revnet", "$REV", ERC20_SALT);
|
|
199
|
-
|
|
200
|
-
vm.prank(multisig());
|
|
201
|
-
REV_DEPLOYER.deployFor({
|
|
202
|
-
revnetId: FEE_PROJECT_ID,
|
|
203
|
-
configuration: cfg,
|
|
204
|
-
terminalConfigurations: terms,
|
|
205
|
-
suckerDeploymentConfiguration: suckerCfg,
|
|
206
|
-
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
207
|
-
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
/// @notice Converting a blank project (no controller, no rulesets) into a revnet succeeds.
|
|
212
|
-
function test_convertBlankProject_succeeds() public {
|
|
213
|
-
// Create blank project owned by USER.
|
|
214
|
-
vm.prank(USER);
|
|
215
|
-
uint256 blankId = jbProjects().createFor(USER);
|
|
216
|
-
|
|
217
|
-
// Approve NFT transfer to REV_DEPLOYER.
|
|
218
|
-
vm.prank(USER);
|
|
219
|
-
jbProjects().approve(address(REV_DEPLOYER), blankId);
|
|
220
|
-
|
|
221
|
-
// Get revnet config.
|
|
222
|
-
(REVConfig memory cfg, JBTerminalConfig[] memory terms, REVSuckerDeploymentConfig memory suckerCfg) =
|
|
223
|
-
_getRevnetConfig("BlankConvert", "$BLK", "BLANK_TOKEN");
|
|
224
|
-
|
|
225
|
-
// Deploy as revnet — should succeed since project is blank.
|
|
226
|
-
vm.prank(USER);
|
|
227
|
-
(uint256 deployed,) = REV_DEPLOYER.deployFor({
|
|
228
|
-
revnetId: blankId,
|
|
229
|
-
configuration: cfg,
|
|
230
|
-
terminalConfigurations: terms,
|
|
231
|
-
suckerDeploymentConfiguration: suckerCfg,
|
|
232
|
-
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
233
|
-
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
assertEq(deployed, blankId, "Should return the same project ID");
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/// @notice Converting a project that already has a controller/rulesets reverts.
|
|
240
|
-
function test_convertProjectWithController_reverts() public {
|
|
241
|
-
// Create a project owned by USER (an EOA that can receive ERC721s).
|
|
242
|
-
vm.prank(USER);
|
|
243
|
-
uint256 projectId = jbProjects().createFor(USER);
|
|
244
|
-
|
|
245
|
-
// Launch rulesets on it directly via the controller (setting a controller + rulesets).
|
|
246
|
-
JBAccountingContext[] memory accountingContextsToAccept = new JBAccountingContext[](1);
|
|
247
|
-
accountingContextsToAccept[0] = JBAccountingContext({
|
|
248
|
-
token: JBConstants.NATIVE_TOKEN, decimals: 18, currency: uint32(uint160(JBConstants.NATIVE_TOKEN))
|
|
249
|
-
});
|
|
250
|
-
JBTerminalConfig[] memory termConfigs = new JBTerminalConfig[](1);
|
|
251
|
-
termConfigs[0] =
|
|
252
|
-
JBTerminalConfig({terminal: jbMultiTerminal(), accountingContextsToAccept: accountingContextsToAccept});
|
|
253
|
-
|
|
254
|
-
JBRulesetConfig[] memory rulesetConfigs = new JBRulesetConfig[](1);
|
|
255
|
-
rulesetConfigs[0] = JBRulesetConfig({
|
|
256
|
-
mustStartAtOrAfter: uint48(block.timestamp),
|
|
257
|
-
duration: uint32(90 days),
|
|
258
|
-
weight: uint112(1000e18),
|
|
259
|
-
weightCutPercent: 0,
|
|
260
|
-
approvalHook: IJBRulesetApprovalHook(address(0)),
|
|
261
|
-
metadata: JBRulesetMetadata({
|
|
262
|
-
reservedPercent: 0,
|
|
263
|
-
cashOutTaxRate: 0,
|
|
264
|
-
baseCurrency: uint32(uint160(JBConstants.NATIVE_TOKEN)),
|
|
265
|
-
pausePay: false,
|
|
266
|
-
pauseCreditTransfers: false,
|
|
267
|
-
allowOwnerMinting: false,
|
|
268
|
-
allowSetCustomToken: false,
|
|
269
|
-
allowTerminalMigration: false,
|
|
270
|
-
allowSetTerminals: false,
|
|
271
|
-
allowSetController: false,
|
|
272
|
-
allowAddAccountingContext: false,
|
|
273
|
-
allowAddPriceFeed: false,
|
|
274
|
-
ownerMustSendPayouts: false,
|
|
275
|
-
holdFees: false,
|
|
276
|
-
useTotalSurplusForCashOuts: false,
|
|
277
|
-
useDataHookForPay: false,
|
|
278
|
-
useDataHookForCashOut: false,
|
|
279
|
-
dataHook: address(0),
|
|
280
|
-
metadata: 0
|
|
281
|
-
}),
|
|
282
|
-
splitGroups: new JBSplitGroup[](0),
|
|
283
|
-
fundAccessLimitGroups: new JBFundAccessLimitGroup[](0)
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
vm.prank(USER);
|
|
287
|
-
jbController()
|
|
288
|
-
.launchRulesetsFor({
|
|
289
|
-
projectId: projectId,
|
|
290
|
-
rulesetConfigurations: rulesetConfigs,
|
|
291
|
-
terminalConfigurations: termConfigs,
|
|
292
|
-
memo: ""
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
// Now try to convert this project to a revnet — should revert.
|
|
296
|
-
// Approve NFT to REV_DEPLOYER.
|
|
297
|
-
vm.prank(USER);
|
|
298
|
-
jbProjects().approve(address(REV_DEPLOYER), projectId);
|
|
299
|
-
|
|
300
|
-
(REVConfig memory cfg, JBTerminalConfig[] memory terms2, REVSuckerDeploymentConfig memory suckerCfg) =
|
|
301
|
-
_getRevnetConfig("FailConvert", "$FAIL", "FAIL_TOKEN");
|
|
302
|
-
|
|
303
|
-
// Should revert because rulesets already launched.
|
|
304
|
-
vm.prank(USER);
|
|
305
|
-
vm.expectRevert(abi.encodeWithSignature("JBController_RulesetsAlreadyLaunched(uint256)", projectId));
|
|
306
|
-
REV_DEPLOYER.deployFor({
|
|
307
|
-
revnetId: projectId,
|
|
308
|
-
configuration: cfg,
|
|
309
|
-
terminalConfigurations: terms2,
|
|
310
|
-
suckerDeploymentConfiguration: suckerCfg,
|
|
311
|
-
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
312
|
-
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
/// @notice After deploying a revnet from an existing project, the owner is REVDeployer (irreversible).
|
|
317
|
-
function test_conversionIsIrreversible() public {
|
|
318
|
-
// Create blank project owned by USER.
|
|
319
|
-
vm.prank(USER);
|
|
320
|
-
uint256 blankId = jbProjects().createFor(USER);
|
|
321
|
-
|
|
322
|
-
// Approve NFT transfer.
|
|
323
|
-
vm.prank(USER);
|
|
324
|
-
jbProjects().approve(address(REV_DEPLOYER), blankId);
|
|
325
|
-
|
|
326
|
-
// Get config.
|
|
327
|
-
(REVConfig memory cfg, JBTerminalConfig[] memory terms, REVSuckerDeploymentConfig memory suckerCfg) =
|
|
328
|
-
_getRevnetConfig("Irreversible", "$IRR", "IRR_TOKEN");
|
|
329
|
-
|
|
330
|
-
// Deploy as revnet.
|
|
331
|
-
vm.prank(USER);
|
|
332
|
-
REV_DEPLOYER.deployFor({
|
|
333
|
-
revnetId: blankId,
|
|
334
|
-
configuration: cfg,
|
|
335
|
-
terminalConfigurations: terms,
|
|
336
|
-
suckerDeploymentConfiguration: suckerCfg,
|
|
337
|
-
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
338
|
-
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
// Verify the project's owner is now the REVDeployer (NFT transferred permanently).
|
|
342
|
-
assertEq(jbProjects().ownerOf(blankId), address(REV_DEPLOYER), "Owner should be REVDeployer after conversion");
|
|
343
|
-
|
|
344
|
-
// Verify the original user is no longer the owner.
|
|
345
|
-
assertTrue(jbProjects().ownerOf(blankId) != USER, "Original user should no longer own the project");
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
/// @notice Deploy with revnetId=0 creates a new project.
|
|
349
|
-
function test_deployNewRevnet_zeroRevnetId() public {
|
|
350
|
-
(REVConfig memory cfg, JBTerminalConfig[] memory terms, REVSuckerDeploymentConfig memory suckerCfg) =
|
|
351
|
-
_getRevnetConfig("NewRevnet", "$NEW", "NEW_TOKEN");
|
|
352
|
-
|
|
353
|
-
(uint256 newId,) = REV_DEPLOYER.deployFor({
|
|
354
|
-
revnetId: 0,
|
|
355
|
-
configuration: cfg,
|
|
356
|
-
terminalConfigurations: terms,
|
|
357
|
-
suckerDeploymentConfiguration: suckerCfg,
|
|
358
|
-
tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
|
|
359
|
-
allowedPosts: REVEmpty721Config.emptyAllowedPosts()
|
|
360
|
-
});
|
|
361
|
-
|
|
362
|
-
// Verify the project was created (ID > fee project).
|
|
363
|
-
assertGt(newId, FEE_PROJECT_ID, "New project ID should be greater than fee project ID");
|
|
364
|
-
|
|
365
|
-
// Verify the owner is the REVDeployer.
|
|
366
|
-
assertEq(jbProjects().ownerOf(newId), address(REV_DEPLOYER), "New revnet owner should be REVDeployer");
|
|
367
|
-
}
|
|
368
|
-
}
|