@rev-net/core-v6 0.0.6 → 0.0.8

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 (31) hide show
  1. package/SKILLS.md +1 -1
  2. package/docs/book.toml +1 -1
  3. package/docs/src/README.md +151 -54
  4. package/docs/src/SUMMARY.md +0 -2
  5. package/docs/src/src/REVDeployer.sol/contract.REVDeployer.md +148 -117
  6. package/docs/src/src/REVLoans.sol/contract.REVLoans.md +120 -59
  7. package/docs/src/src/interfaces/IREVDeployer.sol/interface.IREVDeployer.md +296 -14
  8. package/docs/src/src/interfaces/IREVLoans.sol/interface.IREVLoans.md +318 -16
  9. package/docs/src/src/structs/README.md +0 -2
  10. package/docs/src/src/structs/REVAutoIssuance.sol/struct.REVAutoIssuance.md +4 -4
  11. package/docs/src/src/structs/REVConfig.sol/struct.REVConfig.md +5 -17
  12. package/docs/src/src/structs/REVCroptopAllowedPost.sol/struct.REVCroptopAllowedPost.md +10 -6
  13. package/docs/src/src/structs/REVDeploy721TiersHookConfig.sol/struct.REVDeploy721TiersHookConfig.md +7 -7
  14. package/docs/src/src/structs/REVDescription.sol/struct.REVDescription.md +5 -5
  15. package/docs/src/src/structs/REVLoan.sol/struct.REVLoan.md +7 -7
  16. package/docs/src/src/structs/REVLoanSource.sol/struct.REVLoanSource.md +3 -3
  17. package/docs/src/src/structs/REVStageConfig.sol/struct.REVStageConfig.md +10 -10
  18. package/docs/src/src/structs/REVSuckerDeploymentConfig.sol/struct.REVSuckerDeploymentConfig.md +3 -3
  19. package/foundry.toml +1 -1
  20. package/package.json +11 -8
  21. package/slither-ci.config.json +1 -1
  22. package/src/REVDeployer.sol +102 -68
  23. package/src/REVLoans.sol +180 -169
  24. package/src/interfaces/IREVDeployer.sol +109 -73
  25. package/src/interfaces/IREVLoans.sol +119 -73
  26. package/test/TestPR27_CEIPattern.t.sol +2 -2
  27. package/test/TestPR32_MixedFixes.t.sol +1 -1
  28. package/test/mock/MockBuybackDataHook.sol +8 -4
  29. package/test/mock/MockBuybackDataHookMintPath.sol +7 -3
  30. package/test/regression/TestI20_CumulativeLoanCounter.t.sol +303 -0
  31. package/test/regression/TestL27_LiquidateGapHandling.t.sol +334 -0
@@ -1,12 +1,12 @@
1
1
  # REVDeployer
2
- [Git Source](https://github.com/rev-net/revnet-core-v5/blob/364afaae78a8f60af2b98252dc96af1c2e4760d3/src/REVDeployer.sol)
2
+ [Git Source](https://github.com/rev-net/revnet-core-v6/blob/94c003a3a16de2bd012d63cccedd6bd38d21f6e7/src/REVDeployer.sol)
3
3
 
4
4
  **Inherits:**
5
5
  ERC2771Context, [IREVDeployer](/src/interfaces/IREVDeployer.sol/interface.IREVDeployer.md), IJBRulesetDataHook, IJBCashOutHook, IERC721Receiver
6
6
 
7
7
  `REVDeployer` deploys, manages, and operates Revnets.
8
8
 
9
- *Revnets are unowned Juicebox projects which operate autonomously after deployment.*
9
+ Revnets are unowned Juicebox projects which operate autonomously after deployment.
10
10
 
11
11
 
12
12
  ## State Variables
@@ -16,11 +16,11 @@ revnet is deployed to a new network.
16
16
  - Only applies to existing revnets which are deploying onto a new network.
17
17
  - To prevent liquidity/arbitrage issues which might arise when an existing revnet adds a brand-new treasury.
18
18
 
19
- *30 days, in seconds.*
19
+ 30 days, in seconds.
20
20
 
21
21
 
22
22
  ```solidity
23
- uint256 public constant override CASH_OUT_DELAY = 2_592_000;
23
+ uint256 public constant override CASH_OUT_DELAY = 2_592_000
24
24
  ```
25
25
 
26
26
 
@@ -28,13 +28,44 @@ uint256 public constant override CASH_OUT_DELAY = 2_592_000;
28
28
  The cash out fee (as a fraction out of `JBConstants.MAX_FEE`).
29
29
  Cashout fees are paid to the revnet with the `FEE_REVNET_ID`.
30
30
 
31
- *Fees are charged on cashouts if the cash out tax rate is greater than 0%.*
31
+ Fees are charged on cashouts if the cash out tax rate is greater than 0%.
32
32
 
33
- *When suckers withdraw funds, they do not pay cash out fees.*
33
+ When suckers withdraw funds, they do not pay cash out fees.
34
34
 
35
35
 
36
36
  ```solidity
37
- uint256 public constant override FEE = 25;
37
+ uint256 public constant override FEE = 25
38
+ ```
39
+
40
+
41
+ ### DEFAULT_BUYBACK_POOL_FEE
42
+ The default Uniswap pool fee tier used when auto-configuring buyback pools.
43
+
44
+ 10_000 = 1%. This is the standard fee tier for most project token pairs.
45
+
46
+
47
+ ```solidity
48
+ uint24 public constant DEFAULT_BUYBACK_POOL_FEE = 10_000
49
+ ```
50
+
51
+
52
+ ### DEFAULT_BUYBACK_TWAP_WINDOW
53
+ The default TWAP window used when auto-configuring buyback pools.
54
+
55
+ 2 days provides robust manipulation resistance.
56
+
57
+
58
+ ```solidity
59
+ uint32 public constant DEFAULT_BUYBACK_TWAP_WINDOW = 2 days
60
+ ```
61
+
62
+
63
+ ### BUYBACK_HOOK
64
+ The buyback hook used as a data hook to route payments through buyback pools.
65
+
66
+
67
+ ```solidity
68
+ IJBRulesetDataHook public immutable override BUYBACK_HOOK
38
69
  ```
39
70
 
40
71
 
@@ -43,7 +74,7 @@ The controller used to create and manage Juicebox projects for revnets.
43
74
 
44
75
 
45
76
  ```solidity
46
- IJBController public immutable override CONTROLLER;
77
+ IJBController public immutable override CONTROLLER
47
78
  ```
48
79
 
49
80
 
@@ -52,7 +83,7 @@ The directory of terminals and controllers for Juicebox projects (and revnets).
52
83
 
53
84
 
54
85
  ```solidity
55
- IJBDirectory public immutable override DIRECTORY;
86
+ IJBDirectory public immutable override DIRECTORY
56
87
  ```
57
88
 
58
89
 
@@ -61,7 +92,7 @@ The Juicebox project ID of the revnet that receives cash out fees.
61
92
 
62
93
 
63
94
  ```solidity
64
- uint256 public immutable override FEE_REVNET_ID;
95
+ uint256 public immutable override FEE_REVNET_ID
65
96
  ```
66
97
 
67
98
 
@@ -70,7 +101,19 @@ Deploys tiered ERC-721 hooks for revnets.
70
101
 
71
102
 
72
103
  ```solidity
73
- IJB721TiersHookDeployer public immutable override HOOK_DEPLOYER;
104
+ IJB721TiersHookDeployer public immutable override HOOK_DEPLOYER
105
+ ```
106
+
107
+
108
+ ### LOANS
109
+ The loan contract used by all revnets.
110
+
111
+ Revnets can offer loans to their participants, collateralized by their tokens.
112
+ Participants can borrow up to the current cash out value of their tokens.
113
+
114
+
115
+ ```solidity
116
+ address public immutable override LOANS
74
117
  ```
75
118
 
76
119
 
@@ -79,7 +122,7 @@ Stores Juicebox project (and revnet) access permissions.
79
122
 
80
123
 
81
124
  ```solidity
82
- IJBPermissions public immutable override PERMISSIONS;
125
+ IJBPermissions public immutable override PERMISSIONS
83
126
  ```
84
127
 
85
128
 
@@ -88,7 +131,7 @@ Mints ERC-721s that represent Juicebox project (and revnet) ownership and transf
88
131
 
89
132
 
90
133
  ```solidity
91
- IJBProjects public immutable override PROJECTS;
134
+ IJBProjects public immutable override PROJECTS
92
135
  ```
93
136
 
94
137
 
@@ -97,7 +140,7 @@ Manages the publishing of ERC-721 posts to revnet's tiered ERC-721 hooks.
97
140
 
98
141
 
99
142
  ```solidity
100
- CTPublisher public immutable override PUBLISHER;
143
+ CTPublisher public immutable override PUBLISHER
101
144
  ```
102
145
 
103
146
 
@@ -106,7 +149,7 @@ Deploys and tracks suckers for revnets.
106
149
 
107
150
 
108
151
  ```solidity
109
- IJBSuckerRegistry public immutable override SUCKER_REGISTRY;
152
+ IJBSuckerRegistry public immutable override SUCKER_REGISTRY
110
153
  ```
111
154
 
112
155
 
@@ -114,58 +157,36 @@ IJBSuckerRegistry public immutable override SUCKER_REGISTRY;
114
157
  The number of revnet tokens which can be "auto-minted" (minted without payments)
115
158
  for a specific beneficiary during a stage. Think of this as a per-stage premint.
116
159
 
117
- *These tokens can be minted with `autoIssueFor(…)`.*
118
-
119
-
120
- ```solidity
121
- mapping(uint256 revnetId => mapping(uint256 stageId => mapping(address beneficiary => uint256))) public override
122
- amountToAutoIssue;
123
- ```
124
-
125
-
126
- ### buybackHookOf
127
- Each revnet's buyback data hook. These return buyback hook data.
128
-
129
- *Buyback hooks are a combined data hook/pay hook.*
160
+ These tokens can be minted with `autoIssueFor(…)`.
130
161
 
131
162
 
132
163
  ```solidity
133
- mapping(uint256 revnetId => IJBRulesetDataHook buybackHook) public override buybackHookOf;
164
+ mapping(uint256 revnetId => mapping(uint256 stageId => mapping(address beneficiary => uint256)))
165
+ public
166
+ override amountToAutoIssue
134
167
  ```
135
168
 
136
169
 
137
170
  ### cashOutDelayOf
138
171
  The timestamp of when cashouts will become available to a specific revnet's participants.
139
172
 
140
- *Only applies to existing revnets which are deploying onto a new network.*
173
+ Only applies to existing revnets which are deploying onto a new network.
141
174
 
142
175
 
143
176
  ```solidity
144
- mapping(uint256 revnetId => uint256 cashOutDelay) public override cashOutDelayOf;
177
+ mapping(uint256 revnetId => uint256 cashOutDelay) public override cashOutDelayOf
145
178
  ```
146
179
 
147
180
 
148
181
  ### hashedEncodedConfigurationOf
149
182
  The hashed encoded configuration of each revnet.
150
183
 
151
- *This is used to ensure that the encoded configuration of a revnet is the same when deploying suckers for
152
- omnichain operations.*
184
+ This is used to ensure that the encoded configuration of a revnet is the same when deploying suckers for
185
+ omnichain operations.
153
186
 
154
187
 
155
188
  ```solidity
156
- mapping(uint256 revnetId => bytes32 hashedEncodedConfiguration) public override hashedEncodedConfigurationOf;
157
- ```
158
-
159
-
160
- ### loansOf
161
- Each revnet's loan contract.
162
-
163
- *Revnets can offer loans to their participants, collateralized by their tokens.
164
- Participants can borrow up to the current cash out value of their tokens.*
165
-
166
-
167
- ```solidity
168
- mapping(uint256 revnetId => address) public override loansOf;
189
+ mapping(uint256 revnetId => bytes32 hashedEncodedConfiguration) public override hashedEncodedConfigurationOf
169
190
  ```
170
191
 
171
192
 
@@ -174,18 +195,18 @@ Each revnet's tiered ERC-721 hook.
174
195
 
175
196
 
176
197
  ```solidity
177
- mapping(uint256 revnetId => IJB721TiersHook tiered721Hook) public override tiered721HookOf;
198
+ mapping(uint256 revnetId => IJB721TiersHook tiered721Hook) public override tiered721HookOf
178
199
  ```
179
200
 
180
201
 
181
202
  ### _extraOperatorPermissions
182
203
  A list of `JBPermissonIds` indices to grant to the split operator of a specific revnet.
183
204
 
184
- *These should be set in the revnet's deployment process.*
205
+ These should be set in the revnet's deployment process.
185
206
 
186
207
 
187
208
  ```solidity
188
- mapping(uint256 revnetId => uint256[]) internal _extraOperatorPermissions;
209
+ mapping(uint256 revnetId => uint256[]) internal _extraOperatorPermissions
189
210
  ```
190
211
 
191
212
 
@@ -200,6 +221,8 @@ constructor(
200
221
  uint256 feeRevnetId,
201
222
  IJB721TiersHookDeployer hookDeployer,
202
223
  CTPublisher publisher,
224
+ IJBRulesetDataHook buybackHook,
225
+ address loans,
203
226
  address trustedForwarder
204
227
  )
205
228
  ERC2771Context(trustedForwarder);
@@ -213,6 +236,8 @@ constructor(
213
236
  |`feeRevnetId`|`uint256`|The Juicebox project ID of the revnet that will receive fees.|
214
237
  |`hookDeployer`|`IJB721TiersHookDeployer`|The deployer to use for revnet's tiered ERC-721 hooks.|
215
238
  |`publisher`|`CTPublisher`|The croptop publisher revnets can use to publish ERC-721 posts to their tiered ERC-721 hooks.|
239
+ |`buybackHook`|`IJBRulesetDataHook`|The buyback hook used as a data hook to route payments through buyback pools.|
240
+ |`loans`|`address`|The loan contract used by all revnets.|
216
241
  |`trustedForwarder`|`address`|The trusted forwarder for the ERC2771Context.|
217
242
 
218
243
 
@@ -220,7 +245,7 @@ constructor(
220
245
 
221
246
  Before a revnet processes an incoming payment, determine the weight and pay hooks to use.
222
247
 
223
- *This function is part of `IJBRulesetDataHook`, and gets called before the revnet processes a payment.*
248
+ This function is part of `IJBRulesetDataHook`, and gets called before the revnet processes a payment.
224
249
 
225
250
 
226
251
  ```solidity
@@ -248,9 +273,9 @@ function beforePayRecordedWith(JBBeforePayRecordedContext calldata context)
248
273
 
249
274
  Determine how a cash out from a revnet should be processed.
250
275
 
251
- *This function is part of `IJBRulesetDataHook`, and gets called before the revnet processes a cash out.*
276
+ This function is part of `IJBRulesetDataHook`, and gets called before the revnet processes a cash out.
252
277
 
253
- *If a sucker is cashing out, no taxes or fees are imposed.*
278
+ If a sucker is cashing out, no taxes or fees are imposed.
254
279
 
255
280
 
256
281
  ```solidity
@@ -285,7 +310,7 @@ function beforeCashOutRecordedWith(JBBeforeCashOutRecordedContext calldata conte
285
310
 
286
311
  A flag indicating whether an address has permission to mint a revnet's tokens on-demand.
287
312
 
288
- *Required by the `IJBRulesetDataHook` interface.*
313
+ Required by the `IJBRulesetDataHook` interface.
289
314
 
290
315
 
291
316
  ```solidity
@@ -316,7 +341,7 @@ function hasMintPermissionFor(
316
341
 
317
342
  ### onERC721Received
318
343
 
319
- *Make sure this contract can only receive project NFTs from `JBProjects`.*
344
+ Make sure this contract can only receive project NFTs from `JBProjects`.
320
345
 
321
346
 
322
347
  ```solidity
@@ -349,7 +374,7 @@ function isSplitOperatorOf(uint256 revnetId, address addr) public view override
349
374
 
350
375
  Indicates if this contract adheres to the specified interface.
351
376
 
352
- *See `IERC165.supportsInterface`.*
377
+ See `IERC165.supportsInterface`.
353
378
 
354
379
 
355
380
  ```solidity
@@ -400,27 +425,27 @@ function _isSuckerOf(uint256 revnetId, address addr) internal view returns (bool
400
425
  |`<none>`|`bool`|isSucker A flag indicating whether the address is one of the revnet's suckers.|
401
426
 
402
427
 
403
- ### _makeLoanFundAccessLimits
428
+ ### _makeLoanFundAccessLimitsAndBuybackPools
404
429
 
405
- Initialize a fund access limit group for the loan contract to use.
430
+ Initialize fund access limits for the loan contract and configure buyback pools for each terminal token.
406
431
 
407
- *Returns an unlimited surplus allowance for each token which can be loaned out.*
432
+ Returns an unlimited surplus allowance for each terminal+token pair derived from the terminal
433
+ configurations. Also auto-configures a buyback pool for each token with sensible defaults (1% fee, 2-day TWAP).
408
434
 
409
435
 
410
436
  ```solidity
411
- function _makeLoanFundAccessLimits(
412
- REVConfig calldata configuration,
437
+ function _makeLoanFundAccessLimitsAndBuybackPools(
438
+ uint256 revnetId,
413
439
  JBTerminalConfig[] calldata terminalConfigurations
414
440
  )
415
441
  internal
416
- pure
417
442
  returns (JBFundAccessLimitGroup[] memory fundAccessLimitGroups);
418
443
  ```
419
444
  **Parameters**
420
445
 
421
446
  |Name|Type|Description|
422
447
  |----|----|-----------|
423
- |`configuration`|`REVConfig`|The revnet's configuration.|
448
+ |`revnetId`|`uint256`|The ID of the revnet to configure buyback pools for.|
424
449
  |`terminalConfigurations`|`JBTerminalConfig[]`|The terminals to set up for the revnet. Used for payments and cash outs.|
425
450
 
426
451
  **Returns**
@@ -460,34 +485,6 @@ function _makeRulesetConfiguration(
460
485
  |`<none>`|`JBRulesetConfig`|rulesetConfiguration The ruleset configuration.|
461
486
 
462
487
 
463
- ### _matchingCurrencyOf
464
-
465
- Returns the currency of the loan source, if a matching terminal configuration is found.
466
-
467
-
468
- ```solidity
469
- function _matchingCurrencyOf(
470
- JBTerminalConfig[] calldata terminalConfigurations,
471
- REVLoanSource calldata loanSource
472
- )
473
- internal
474
- pure
475
- returns (uint32);
476
- ```
477
- **Parameters**
478
-
479
- |Name|Type|Description|
480
- |----|----|-----------|
481
- |`terminalConfigurations`|`JBTerminalConfig[]`|The terminals to check.|
482
- |`loanSource`|`REVLoanSource`|The loan source to check.|
483
-
484
- **Returns**
485
-
486
- |Name|Type|Description|
487
- |----|----|-----------|
488
- |`<none>`|`uint32`|currency The currency of the loan source.|
489
-
490
-
491
488
  ### _nextProjectId
492
489
 
493
490
  Returns the next project ID.
@@ -561,7 +558,16 @@ function autoIssueFor(uint256 revnetId, uint256 stageId, address beneficiary) ex
561
558
 
562
559
  ### deployFor
563
560
 
564
- Launch a revnet, or convert an existing Juicebox project into a revnet.
561
+ Launch a revnet, or initialize an existing Juicebox project as a revnet.
562
+
563
+ When initializing an existing project (revnetId != 0):
564
+ - The project must not yet have a controller or rulesets. `JBController.launchRulesetsFor` enforces this —
565
+ it reverts if rulesets have already been launched, and `JBDirectory.setControllerOf` only allows setting the
566
+ first controller. This means conversion only works for blank projects (just an ID with no on-chain state).
567
+ - This is useful in deploy scripts where the project ID is needed before configuration (e.g. for cross-chain
568
+ sucker peer mappings): create the project first, then initialize it as a revnet here.
569
+ - Initialization is a one-way operation: the project's ownership NFT is permanently transferred to this
570
+ REVDeployer, and the project becomes subject to immutable revnet rules. This cannot be undone.
565
571
 
566
572
 
567
573
  ```solidity
@@ -569,7 +575,6 @@ function deployFor(
569
575
  uint256 revnetId,
570
576
  REVConfig calldata configuration,
571
577
  JBTerminalConfig[] calldata terminalConfigurations,
572
- REVBuybackHookConfig calldata buybackHookConfiguration,
573
578
  REVSuckerDeploymentConfig calldata suckerDeploymentConfiguration
574
579
  )
575
580
  external
@@ -580,10 +585,9 @@ function deployFor(
580
585
 
581
586
  |Name|Type|Description|
582
587
  |----|----|-----------|
583
- |`revnetId`|`uint256`|The ID of the Juicebox project to turn into a revnet. Send 0 to deploy a new revnet.|
588
+ |`revnetId`|`uint256`|The ID of the Juicebox project to initialize as a revnet. Send 0 to deploy a new revnet.|
584
589
  |`configuration`|`REVConfig`|Core revnet configuration. See `REVConfig`.|
585
590
  |`terminalConfigurations`|`JBTerminalConfig[]`|The terminals to set up for the revnet. Used for payments and cash outs.|
586
- |`buybackHookConfiguration`|`REVBuybackHookConfig`|The buyback hook and pools to set up for the revnet. The buyback hook buys tokens from a Uniswap pool if minting new tokens would be more expensive.|
587
591
  |`suckerDeploymentConfiguration`|`REVSuckerDeploymentConfig`|The suckers to set up for the revnet. Suckers facilitate cross-chain token transfers between peer revnets on different networks.|
588
592
 
589
593
  **Returns**
@@ -597,7 +601,7 @@ function deployFor(
597
601
 
598
602
  Deploy new suckers for an existing revnet.
599
603
 
600
- *Only the revnet's split operator can deploy new suckers.*
604
+ Only the revnet's split operator can deploy new suckers.
601
605
 
602
606
 
603
607
  ```solidity
@@ -621,13 +625,15 @@ function deploySuckersFor(
621
625
 
622
626
  Launch a revnet which sells tiered ERC-721s and (optionally) allows croptop posts to its ERC-721 tiers.
623
627
 
628
+ When initializing an existing project (revnetId != 0), the project must be blank (no controller or
629
+ rulesets). The initialization is irreversible. See `deployFor` documentation for full details.
630
+
624
631
 
625
632
  ```solidity
626
633
  function deployWith721sFor(
627
634
  uint256 revnetId,
628
635
  REVConfig calldata configuration,
629
636
  JBTerminalConfig[] calldata terminalConfigurations,
630
- REVBuybackHookConfig calldata buybackHookConfiguration,
631
637
  REVSuckerDeploymentConfig calldata suckerDeploymentConfiguration,
632
638
  REVDeploy721TiersHookConfig calldata tiered721HookConfiguration,
633
639
  REVCroptopAllowedPost[] calldata allowedPosts
@@ -640,10 +646,9 @@ function deployWith721sFor(
640
646
 
641
647
  |Name|Type|Description|
642
648
  |----|----|-----------|
643
- |`revnetId`|`uint256`|The ID of the Juicebox project to turn into a revnet. Send 0 to deploy a new revnet.|
649
+ |`revnetId`|`uint256`|The ID of the Juicebox project to initialize as a revnet. Send 0 to deploy a new revnet.|
644
650
  |`configuration`|`REVConfig`|Core revnet configuration. See `REVConfig`.|
645
651
  |`terminalConfigurations`|`JBTerminalConfig[]`|The terminals to set up for the revnet. Used for payments and cash outs.|
646
- |`buybackHookConfiguration`|`REVBuybackHookConfig`|The buyback hook and pools to set up for the revnet. The buyback hook buys tokens from a Uniswap pool if minting new tokens would be more expensive.|
647
652
  |`suckerDeploymentConfiguration`|`REVSuckerDeploymentConfig`|The suckers to set up for the revnet. Suckers facilitate cross-chain token transfers between peer revnets on different networks.|
648
653
  |`tiered721HookConfiguration`|`REVDeploy721TiersHookConfig`|How to set up the tiered ERC-721 hook for the revnet.|
649
654
  |`allowedPosts`|`REVCroptopAllowedPost[]`|Restrictions on which croptop posts are allowed on the revnet's ERC-721 tiers.|
@@ -656,11 +661,28 @@ function deployWith721sFor(
656
661
  |`hook`|`IJB721TiersHook`|The address of the tiered ERC-721 hook that was deployed for the revnet.|
657
662
 
658
663
 
664
+ ### burnHeldTokensOf
665
+
666
+ Burn any of a revnet's tokens held by this contract.
667
+
668
+ Project tokens can end up here from reserved token distribution when splits don't sum to 100%.
669
+
670
+
671
+ ```solidity
672
+ function burnHeldTokensOf(uint256 revnetId) external override;
673
+ ```
674
+ **Parameters**
675
+
676
+ |Name|Type|Description|
677
+ |----|----|-----------|
678
+ |`revnetId`|`uint256`|The ID of the revnet whose tokens should be burned.|
679
+
680
+
659
681
  ### setSplitOperatorOf
660
682
 
661
683
  Change a revnet's split operator.
662
684
 
663
- *Only a revnet's current split operator can set a new split operator.*
685
+ Only a revnet's current split operator can set a new split operator.
664
686
 
665
687
 
666
688
  ```solidity
@@ -708,7 +730,6 @@ function _deploy721RevnetFor(
708
730
  bool shouldDeployNewRevnet,
709
731
  REVConfig calldata configuration,
710
732
  JBTerminalConfig[] calldata terminalConfigurations,
711
- REVBuybackHookConfig calldata buybackHookConfiguration,
712
733
  REVSuckerDeploymentConfig calldata suckerDeploymentConfiguration,
713
734
  REVDeploy721TiersHookConfig calldata tiered721HookConfiguration,
714
735
  REVCroptopAllowedPost[] calldata allowedPosts
@@ -724,7 +745,6 @@ function _deploy721RevnetFor(
724
745
  |`shouldDeployNewRevnet`|`bool`|Whether to deploy a new revnet or convert an existing Juicebox project into a revnet.|
725
746
  |`configuration`|`REVConfig`|Core revnet configuration. See `REVConfig`.|
726
747
  |`terminalConfigurations`|`JBTerminalConfig[]`|The terminals to set up for the revnet. Used for payments and cash outs.|
727
- |`buybackHookConfiguration`|`REVBuybackHookConfig`|The buyback hook and pools to set up for the revnet. The buyback hook buys tokens from a Uniswap pool if minting new tokens would be more expensive.|
728
748
  |`suckerDeploymentConfiguration`|`REVSuckerDeploymentConfig`|The suckers to set up for the revnet. Suckers facilitate cross-chain token transfers between peer revnets on different networks.|
729
749
  |`tiered721HookConfiguration`|`REVDeploy721TiersHookConfig`|How to set up the tiered ERC-721 hook for the revnet.|
730
750
  |`allowedPosts`|`REVCroptopAllowedPost[]`|Restrictions on which croptop posts are allowed on the revnet's ERC-721 tiers.|
@@ -738,7 +758,14 @@ function _deploy721RevnetFor(
738
758
 
739
759
  ### _deployRevnetFor
740
760
 
741
- Deploy a revnet, or convert an existing Juicebox project into a revnet.
761
+ Deploy a revnet, or initialize an existing Juicebox project as a revnet.
762
+
763
+ When initializing an existing project (`shouldDeployNewRevnet == false`):
764
+ - The project must be blank — no controller or rulesets. This is enforced by `JBController.launchRulesetsFor`,
765
+ which reverts if rulesets exist, and by `JBDirectory.setControllerOf`, which only allows setting the first
766
+ controller. Without a controller, no tokens or terminals can exist, so the project is guaranteed to be
767
+ uninitialized.
768
+ - The project's JBProjects NFT is permanently transferred to this contract. This is irreversible.
742
769
 
743
770
 
744
771
  ```solidity
@@ -747,7 +774,6 @@ function _deployRevnetFor(
747
774
  bool shouldDeployNewRevnet,
748
775
  REVConfig calldata configuration,
749
776
  JBTerminalConfig[] calldata terminalConfigurations,
750
- REVBuybackHookConfig calldata buybackHookConfiguration,
751
777
  REVSuckerDeploymentConfig calldata suckerDeploymentConfiguration,
752
778
  JBRulesetConfig[] memory rulesetConfigurations,
753
779
  bytes32 encodedConfigurationHash
@@ -758,11 +784,10 @@ function _deployRevnetFor(
758
784
 
759
785
  |Name|Type|Description|
760
786
  |----|----|-----------|
761
- |`revnetId`|`uint256`|The ID of the Juicebox project to turn into a revnet. Send 0 to deploy a new revnet.|
787
+ |`revnetId`|`uint256`|The ID of the Juicebox project to initialize as a revnet. Send 0 to deploy a new revnet.|
762
788
  |`shouldDeployNewRevnet`|`bool`|Whether to deploy a new revnet or convert an existing Juicebox project into a revnet.|
763
789
  |`configuration`|`REVConfig`|Core revnet configuration. See `REVConfig`.|
764
790
  |`terminalConfigurations`|`JBTerminalConfig[]`|The terminals to set up for the revnet. Used for payments and cash outs.|
765
- |`buybackHookConfiguration`|`REVBuybackHookConfig`|The buyback hook and pools to set up for the revnet. The buyback hook buys tokens from a Uniswap pool if minting new tokens would be more expensive.|
766
791
  |`suckerDeploymentConfiguration`|`REVSuckerDeploymentConfig`|The suckers to set up for the revnet. Suckers facilitate cross-chain token transfers between peer revnets on different networks.|
767
792
  |`rulesetConfigurations`|`JBRulesetConfig[]`|The rulesets to set up for the revnet.|
768
793
  |`encodedConfigurationHash`|`bytes32`|A hash that represents the revnet's configuration. See `_makeRulesetConfigurations(…)` for encoding details. Clients can read the encoded configuration from the `DeployRevnet` event emitted by this contract.|
@@ -770,8 +795,6 @@ function _deployRevnetFor(
770
795
 
771
796
  ### _deploySuckersFor
772
797
 
773
- Deploy suckers for a revnet.
774
-
775
798
 
776
799
  ```solidity
777
800
  function _deploySuckersFor(
@@ -786,7 +809,7 @@ function _deploySuckersFor(
786
809
 
787
810
  |Name|Type|Description|
788
811
  |----|----|-----------|
789
- |`revnetId`|`uint256`|The ID of the revnet to deploy suckers for.|
812
+ |`revnetId`|`uint256`||
790
813
  |`encodedConfigurationHash`|`bytes32`|A hash that represents the revnet's configuration. See `_makeRulesetConfigurations(…)` for encoding details. Clients can read the encoded configuration from the `DeployRevnet` event emitted by this contract.|
791
814
  |`suckerDeploymentConfiguration`|`REVSuckerDeploymentConfig`|The suckers to set up for the revnet.|
792
815
 
@@ -795,6 +818,14 @@ function _deploySuckersFor(
795
818
 
796
819
  Convert a revnet's stages into a series of Juicebox project rulesets.
797
820
 
821
+ Stage transitions affect outstanding loan health. When a new stage activates, parameters such as
822
+ `cashOutTaxRate` and `weight` change, which directly impact the borrowable amount calculated by
823
+ `REVLoans._borrowableAmountFrom`. Loans originated under a previous stage's parameters may become
824
+ under-collateralized if the new stage has a higher `cashOutTaxRate` (reducing the borrowable amount per unit
825
+ of collateral) or lower issuance weight (reducing the surplus-per-token ratio). Borrowers should monitor
826
+ upcoming stage transitions and adjust their positions accordingly, as loans that fall below their required
827
+ collateralization may become eligible for liquidation.
828
+
798
829
 
799
830
  ```solidity
800
831
  function _makeRulesetConfigurations(
@@ -825,8 +856,8 @@ function _makeRulesetConfigurations(
825
856
 
826
857
  Sets the cash out delay if the revnet's stages are already in progress.
827
858
 
828
- *This prevents cash out liquidity/arbitrage issues for existing revnets which
829
- are deploying to a new chain.*
859
+ This prevents cash out liquidity/arbitrage issues for existing revnets which
860
+ are deploying to a new chain.
830
861
 
831
862
 
832
863
  ```solidity
@@ -885,7 +916,7 @@ function _setPermissionsFor(
885
916
 
886
917
  Give a split operator their permissions.
887
918
 
888
- *Only a revnet's current split operator can set a new split operator, by calling `setSplitOperatorOf(…)`.*
919
+ Only a revnet's current split operator can set a new split operator, by calling `setSplitOperatorOf(…)`.
889
920
 
890
921
 
891
922
  ```solidity
@@ -900,12 +931,6 @@ function _setSplitOperatorOf(uint256 revnetId, address operator) internal;
900
931
 
901
932
 
902
933
  ## Errors
903
- ### REVDeployer_LoanSourceDoesntMatchTerminalConfigurations
904
-
905
- ```solidity
906
- error REVDeployer_LoanSourceDoesntMatchTerminalConfigurations(address token, address terminal);
907
- ```
908
-
909
934
  ### REVDeployer_AutoIssuanceBeneficiaryZeroAddress
910
935
 
911
936
  ```solidity
@@ -960,6 +985,12 @@ error REVDeployer_StagesRequired();
960
985
  error REVDeployer_StageTimesMustIncrease();
961
986
  ```
962
987
 
988
+ ### REVDeployer_NothingToBurn
989
+
990
+ ```solidity
991
+ error REVDeployer_NothingToBurn();
992
+ ```
993
+
963
994
  ### REVDeployer_Unauthorized
964
995
 
965
996
  ```solidity