@rev-net/core-v6 0.0.37 → 0.0.40

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.
Files changed (112) hide show
  1. package/CHANGELOG.md +2 -2
  2. package/README.md +6 -7
  3. package/foundry.toml +1 -1
  4. package/package.json +23 -16
  5. package/references/operations.md +1 -1
  6. package/references/runtime.md +1 -1
  7. package/script/Deploy.s.sol +12 -9
  8. package/src/REVDeployer.sol +69 -67
  9. package/src/REVHiddenTokens.sol +2 -2
  10. package/src/REVLoans.sol +26 -22
  11. package/src/REVOwner.sol +147 -29
  12. package/src/interfaces/IREVDeployer.sol +2 -1
  13. package/src/interfaces/IREVHiddenTokens.sol +4 -1
  14. package/src/interfaces/IREVOwner.sol +5 -0
  15. package/src/structs/REVAutoIssuance.sol +4 -2
  16. package/src/structs/REVConfig.sol +8 -5
  17. package/src/structs/REVDescription.sol +6 -5
  18. package/src/structs/REVLoan.sol +8 -5
  19. package/src/structs/REVStageConfig.sol +14 -16
  20. package/ADMINISTRATION.md +0 -73
  21. package/ARCHITECTURE.md +0 -116
  22. package/AUDIT_INSTRUCTIONS.md +0 -90
  23. package/RISKS.md +0 -107
  24. package/SKILLS.md +0 -46
  25. package/STYLE_GUIDE.md +0 -610
  26. package/USER_JOURNEYS.md +0 -195
  27. package/foundry.lock +0 -11
  28. package/slither-ci.config.json +0 -10
  29. package/sphinx.lock +0 -507
  30. package/test/REV.integrations.t.sol +0 -573
  31. package/test/REVAutoIssuanceFuzz.t.sol +0 -328
  32. package/test/REVDeployerRegressions.t.sol +0 -396
  33. package/test/REVInvincibility.t.sol +0 -1371
  34. package/test/REVInvincibilityHandler.sol +0 -387
  35. package/test/REVLifecycle.t.sol +0 -420
  36. package/test/REVLoans.invariants.t.sol +0 -724
  37. package/test/REVLoansAttacks.t.sol +0 -816
  38. package/test/REVLoansFeeRecovery.t.sol +0 -783
  39. package/test/REVLoansFindings.t.sol +0 -711
  40. package/test/REVLoansRegressions.t.sol +0 -364
  41. package/test/REVLoansSourceFeeRecovery.t.sol +0 -517
  42. package/test/REVLoansSourced.t.sol +0 -1839
  43. package/test/REVLoansUnSourced.t.sol +0 -409
  44. package/test/TestAuditFixVerification.t.sol +0 -675
  45. package/test/TestBurnHeldTokens.t.sol +0 -394
  46. package/test/TestCEIPattern.t.sol +0 -508
  47. package/test/TestCashOutCallerValidation.t.sol +0 -452
  48. package/test/TestConversionDocumentation.t.sol +0 -365
  49. package/test/TestCrossCurrencyReclaim.t.sol +0 -610
  50. package/test/TestCrossSourceReallocation.t.sol +0 -361
  51. package/test/TestERC2771MetaTx.t.sol +0 -585
  52. package/test/TestEmptyBuybackSpecs.t.sol +0 -300
  53. package/test/TestFlashLoanSurplus.t.sol +0 -365
  54. package/test/TestHiddenTokens.t.sol +0 -474
  55. package/test/TestHookArrayOOB.t.sol +0 -278
  56. package/test/TestLiquidationBehavior.t.sol +0 -398
  57. package/test/TestLoanSourceRotation.t.sol +0 -553
  58. package/test/TestLoansCashOutDelay.t.sol +0 -493
  59. package/test/TestLongTailEconomics.t.sol +0 -677
  60. package/test/TestLowFindings.t.sol +0 -677
  61. package/test/TestMixedFixes.t.sol +0 -593
  62. package/test/TestPermit2Signatures.t.sol +0 -683
  63. package/test/TestReallocationSandwich.t.sol +0 -412
  64. package/test/TestRevnetRegressions.t.sol +0 -350
  65. package/test/TestSplitWeightAdjustment.t.sol +0 -527
  66. package/test/TestSplitWeightE2E.t.sol +0 -605
  67. package/test/TestSplitWeightFork.t.sol +0 -855
  68. package/test/TestStageTransitionBorrowable.t.sol +0 -301
  69. package/test/TestSwapTerminalPermission.t.sol +0 -262
  70. package/test/TestTerminalEncodingInHash.t.sol +0 -326
  71. package/test/TestUint112Overflow.t.sol +0 -311
  72. package/test/TestZeroAmountLoanGuard.t.sol +0 -378
  73. package/test/TestZeroRepayment.t.sol +0 -354
  74. package/test/audit/CrossChainBuybackRouteMismatch.t.sol +0 -184
  75. package/test/audit/HiddenSupplyCashout.t.sol +0 -61
  76. package/test/audit/LoanIdOverflowGuard.t.sol +0 -523
  77. package/test/audit/NemesisVerification.t.sol +0 -97
  78. package/test/audit/OperatorDelegation.t.sol +0 -356
  79. package/test/audit/PhantomSurplusTerminal.t.sol +0 -367
  80. package/test/audit/REVOwnerCurrencyMismatch.t.sol +0 -188
  81. package/test/audit/REVOwnerRemoteSurplusCurrencyMismatch.t.sol +0 -140
  82. package/test/audit/ReallocatePermission.t.sol +0 -363
  83. package/test/audit/RemoteLoanAccountingGap.t.sol +0 -74
  84. package/test/audit/SupportsInterfaceTest.t.sol +0 -51
  85. package/test/audit/TestFeeAllowanceLeak.t.sol +0 -197
  86. package/test/audit/TestLoansAndDeployerFixes.t.sol +0 -576
  87. package/test/fork/ForkTestBase.sol +0 -727
  88. package/test/fork/TestAutoIssuanceFork.t.sol +0 -148
  89. package/test/fork/TestCashOutFork.t.sol +0 -253
  90. package/test/fork/TestIssuanceDecayFork.t.sol +0 -158
  91. package/test/fork/TestLoanAdversarialFork.t.sol +0 -744
  92. package/test/fork/TestLoanBorrowFork.t.sol +0 -163
  93. package/test/fork/TestLoanCrossRulesetFork.t.sol +0 -308
  94. package/test/fork/TestLoanERC20Fork.t.sol +0 -459
  95. package/test/fork/TestLoanLiquidationFork.t.sol +0 -135
  96. package/test/fork/TestLoanReallocateFork.t.sol +0 -113
  97. package/test/fork/TestLoanRepayFork.t.sol +0 -188
  98. package/test/fork/TestLoanTransferFork.t.sol +0 -143
  99. package/test/fork/TestPermit2PaymentFork.t.sol +0 -300
  100. package/test/fork/TestSplitWeightFork.t.sol +0 -189
  101. package/test/helpers/MaliciousContracts.sol +0 -247
  102. package/test/helpers/REVEmpty721Config.sol +0 -45
  103. package/test/mock/MockBuybackCashOutRecorder.sol +0 -84
  104. package/test/mock/MockBuybackDataHook.sol +0 -112
  105. package/test/mock/MockBuybackDataHookMintPath.sol +0 -68
  106. package/test/mock/MockSuckerRegistry.sol +0 -17
  107. package/test/regression/TestBurnPermissionRequired.t.sol +0 -294
  108. package/test/regression/TestCashOutBuybackFeeLeak.t.sol +0 -232
  109. package/test/regression/TestCrossRevnetLiquidation.t.sol +0 -255
  110. package/test/regression/TestCumulativeLoanCounter.t.sol +0 -361
  111. package/test/regression/TestLiquidateGapHandling.t.sol +0 -394
  112. package/test/regression/TestZeroPriceFeed.t.sol +0 -422
@@ -1,365 +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, rulesetConfigurations: rulesetConfigs, terminalConfigurations: termConfigs, memo: ""
290
- });
291
-
292
- // Now try to convert this project to a revnet — should revert.
293
- // Approve NFT to REV_DEPLOYER.
294
- vm.prank(USER);
295
- jbProjects().approve(address(REV_DEPLOYER), projectId);
296
-
297
- (REVConfig memory cfg, JBTerminalConfig[] memory terms2, REVSuckerDeploymentConfig memory suckerCfg) =
298
- _getRevnetConfig("FailConvert", "$FAIL", "FAIL_TOKEN");
299
-
300
- // Should revert because rulesets already launched.
301
- vm.prank(USER);
302
- vm.expectRevert(abi.encodeWithSignature("JBController_RulesetsAlreadyLaunched(uint256)", projectId));
303
- REV_DEPLOYER.deployFor({
304
- revnetId: projectId,
305
- configuration: cfg,
306
- terminalConfigurations: terms2,
307
- suckerDeploymentConfiguration: suckerCfg,
308
- tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
309
- allowedPosts: REVEmpty721Config.emptyAllowedPosts()
310
- });
311
- }
312
-
313
- /// @notice After deploying a revnet from an existing project, the owner is REVDeployer (irreversible).
314
- function test_conversionIsIrreversible() public {
315
- // Create blank project owned by USER.
316
- vm.prank(USER);
317
- uint256 blankId = jbProjects().createFor(USER);
318
-
319
- // Approve NFT transfer.
320
- vm.prank(USER);
321
- jbProjects().approve(address(REV_DEPLOYER), blankId);
322
-
323
- // Get config.
324
- (REVConfig memory cfg, JBTerminalConfig[] memory terms, REVSuckerDeploymentConfig memory suckerCfg) =
325
- _getRevnetConfig("Irreversible", "$IRR", "IRR_TOKEN");
326
-
327
- // Deploy as revnet.
328
- vm.prank(USER);
329
- REV_DEPLOYER.deployFor({
330
- revnetId: blankId,
331
- configuration: cfg,
332
- terminalConfigurations: terms,
333
- suckerDeploymentConfiguration: suckerCfg,
334
- tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
335
- allowedPosts: REVEmpty721Config.emptyAllowedPosts()
336
- });
337
-
338
- // Verify the project's owner is now the REVDeployer (NFT transferred permanently).
339
- assertEq(jbProjects().ownerOf(blankId), address(REV_DEPLOYER), "Owner should be REVDeployer after conversion");
340
-
341
- // Verify the original user is no longer the owner.
342
- assertTrue(jbProjects().ownerOf(blankId) != USER, "Original user should no longer own the project");
343
- }
344
-
345
- /// @notice Deploy with revnetId=0 creates a new project.
346
- function test_deployNewRevnet_zeroRevnetId() public {
347
- (REVConfig memory cfg, JBTerminalConfig[] memory terms, REVSuckerDeploymentConfig memory suckerCfg) =
348
- _getRevnetConfig("NewRevnet", "$NEW", "NEW_TOKEN");
349
-
350
- (uint256 newId,) = REV_DEPLOYER.deployFor({
351
- revnetId: 0,
352
- configuration: cfg,
353
- terminalConfigurations: terms,
354
- suckerDeploymentConfiguration: suckerCfg,
355
- tiered721HookConfiguration: REVEmpty721Config.empty721Config(uint32(uint160(JBConstants.NATIVE_TOKEN))),
356
- allowedPosts: REVEmpty721Config.emptyAllowedPosts()
357
- });
358
-
359
- // Verify the project was created (ID > fee project).
360
- assertGt(newId, FEE_PROJECT_ID, "New project ID should be greater than fee project ID");
361
-
362
- // Verify the owner is the REVDeployer.
363
- assertEq(jbProjects().ownerOf(newId), address(REV_DEPLOYER), "New revnet owner should be REVDeployer");
364
- }
365
- }