@rev-net/core-v6 0.0.39 → 0.0.41

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/src/REVOwner.sol CHANGED
@@ -28,9 +28,13 @@ import {IREVHiddenTokens} from "./interfaces/IREVHiddenTokens.sol";
28
28
  import {IREVLoans} from "./interfaces/IREVLoans.sol";
29
29
  import {REVLoanSource} from "./structs/REVLoanSource.sol";
30
30
 
31
- /// @notice Handles the runtime data hook and cash out hook behavior for revnets.
32
- /// @dev Separated from `REVDeployer` to stay within the EIP-170 contract size limit.
33
- /// This contract is set as the `dataHook` in each revnet's ruleset metadata.
31
+ /// @notice The runtime hook for all revnets set as every revnet's `dataHook` in ruleset metadata. At pay time, it
32
+ /// coordinates the 721 hook (NFT tier minting) with the buyback hook (secondary market swap routing) and scales weight
33
+ /// for split deductions. At cash-out time, it aggregates cross-chain total supply and surplus (including outstanding
34
+ /// loan debt and collateral), grants suckers 0% tax, splits a 2.5% fee from non-sucker cash outs, and routes fee
35
+ /// proceeds to the fee revnet via `afterCashOutRecordedWith`.
36
+ /// @dev Separated from `REVDeployer` to stay within the EIP-170 contract size limit. Also implements
37
+ /// `IJBPeerChainAdjustedAccounts` to expose loan state to peer-chain supply/surplus snapshots.
34
38
  contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAccounts {
35
39
  // A library that adds default safety checks to ERC20 functionality.
36
40
  using SafeERC20 for IERC20;
@@ -79,12 +83,12 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
79
83
  //*********************************************************************//
80
84
 
81
85
  /// @notice The timestamp of when cashouts will become available to a specific revnet's participants.
82
- /// @dev Only applies to existing revnets which are deploying onto a new network.
83
- /// @custom:param revnetId The ID of the revnet to get the cash out delay for.
86
+ /// @dev Only applies to existing revnets deploying onto a new network.
87
+ /// @custom:param revnetId The ID of the revnet to check the cash out delay for.
84
88
  mapping(uint256 revnetId => uint256 cashOutDelay) public cashOutDelayOf;
85
89
 
86
90
  /// @notice Each revnet's tiered ERC-721 hook.
87
- /// @custom:param revnetId The ID of the revnet to get the tiered ERC-721 hook for.
91
+ /// @custom:param revnetId The ID of the revnet to look up.
88
92
  // slither-disable-next-line uninitialized-state
89
93
  mapping(uint256 revnetId => IJB721TiersHook tiered721Hook) public tiered721HookOf;
90
94
 
@@ -130,20 +134,20 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
130
134
  // ------------------------- external views -------------------------- //
131
135
  //*********************************************************************//
132
136
 
133
- /// @notice Determine how a cash out from a revnet should be processed.
134
- /// @dev This function is part of `IJBRulesetDataHook`, and gets called before the revnet processes a cash out.
135
- /// @dev If a sucker is cashing out, no taxes or fees are imposed.
136
- /// @dev REVOwner is intentionally not registered as a feeless address. The protocol fee (2.5%) applies on top
137
- /// of the rev fee this is by design. The fee hook spec amount sent to `afterCashOutRecordedWith` will have the
138
- /// protocol fee deducted by the terminal before reaching this contract, so the rev fee is computed on the
139
- /// post-protocol-fee amount.
137
+ /// @notice Called before a cash out is recorded. Suckers get 0% tax (bridged tokens redeem at face value). For
138
+ /// regular holders, aggregates cross-chain total supply and surplus (including outstanding loan debt/collateral),
139
+ /// splits a 2.5% fee from the cashed-out token count, computes bonding curve reclaims for both the holder's portion
140
+ /// and the fee portion, then delegates to the buyback hook for potential swap routing.
141
+ /// @dev Part of `IJBRulesetDataHook`. REVOwner is intentionally not registered as a feeless address the
142
+ /// protocol
143
+ /// fee (2.5%) applies on top of the rev fee. The fee hook spec amount sent to `afterCashOutRecordedWith` will have
144
+ /// the protocol fee deducted by the terminal before reaching this contract.
140
145
  /// @param context Standard Juicebox cash out context. See `JBBeforeCashOutRecordedContext`.
141
- /// @return cashOutTaxRate The cash out tax rate, which influences the amount of terminal tokens which get cashed
142
- /// out.
143
- /// @return cashOutCount The number of revnet tokens that are cashed out.
146
+ /// @return cashOutTaxRate The cash out tax rate, which influences the amount of terminal tokens reclaimed.
147
+ /// @return cashOutCount The number of revnet tokens to cash out.
144
148
  /// @return totalSupply The total token supply across all chains (for both proportional reclaim and tax).
145
149
  /// @return effectiveSurplusValue The global surplus across all chains for proportional reclaim.
146
- /// @return hookSpecifications The amount of funds and the data to send to cash out hooks (this contract).
150
+ /// @return hookSpecifications The amount of funds and data to send to cash out hooks (this contract).
147
151
  function beforeCashOutRecordedWith(JBBeforeCashOutRecordedContext calldata context)
148
152
  external
149
153
  view
@@ -289,13 +293,16 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
289
293
  return (cashOutTaxRate, cashOutCount, totalSupply, effectiveSurplusValue, hookSpecifications);
290
294
  }
291
295
 
292
- /// @notice Before a revnet processes an incoming payment, determine the weight and pay hooks to use.
293
- /// @dev This function is part of `IJBRulesetDataHook`, and gets called before the revnet processes a payment.
296
+ /// @notice Called before a payment is recorded. Coordinates the 721 hook (NFT tier minting with split deductions)
297
+ /// with the buyback hook (which may route funds through a Uniswap pool for a better token price). Merges their hook
298
+ /// specifications and scales the minting weight so payers only receive tokens proportional to funds entering the
299
+ /// project (not the split portion).
300
+ /// @dev Part of `IJBRulesetDataHook`. The 721 hook spec comes first in the returned array.
294
301
  /// @param context Standard Juicebox payment context. See `JBBeforePayRecordedContext`.
295
302
  /// @return weight The weight which revnet tokens are minted relative to. This can be used to customize how many
296
303
  /// tokens get minted by a payment.
297
- /// @return hookSpecifications Amounts (out of what's being paid in) to be sent to pay hooks instead of being paid
298
- /// into the revnet. Useful for automatically routing funds from a treasury as payments come in.
304
+ /// @return hookSpecifications Amounts (out of what's paid in) to send to pay hooks instead of adding to the
305
+ /// revnet. Useful for automatically routing funds from a treasury as payments come in.
299
306
  function beforePayRecordedWith(JBBeforePayRecordedContext calldata context)
300
307
  external
301
308
  view
@@ -347,11 +354,13 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
347
354
  if (usesBuybackHook) hookSpecifications[usesTiered721Hook ? 1 : 0] = buybackHookSpecs[0];
348
355
  }
349
356
 
350
- /// @notice A flag indicating whether an address has permission to mint a revnet's tokens on-demand.
351
- /// @dev Required by the `IJBRulesetDataHook` interface.
352
- /// @param revnetId The ID of the revnet to check permissions for.
353
- /// @param ruleset The ruleset to check the mint permission for.
354
- /// @param addr The address to check the mint permission of.
357
+ /// @notice Returns whether an address may mint a revnet's tokens on-demand. Grants permission to: the loans
358
+ /// contract (re-mints collateral on repayment), hidden tokens contract (re-mints on reveal), buyback hook and its
359
+ /// delegates (mints tokens from pool swaps), and suckers (mints bridged tokens on the destination chain).
360
+ /// @dev Part of `IJBRulesetDataHook`.
361
+ /// @param revnetId The ID of the revnet to check.
362
+ /// @param ruleset The ruleset to check against.
363
+ /// @param addr The address to check.
355
364
  /// @return flag A flag indicating whether the address has permission to mint the revnet's tokens on-demand.
356
365
  function hasMintPermissionFor(
357
366
  uint256 revnetId,
@@ -374,9 +383,9 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
374
383
  /// @dev Hidden tokens are intentionally excluded. Revnet operators can hide tokens as a security handle without
375
384
  /// changing loan or cash-out math for other holders. Outstanding loan debt is counted as both surplus and balance:
376
385
  /// it is value owed back to this chain's revnet and should travel to peer snapshots with the collateral supply.
377
- /// @param revnetId The ID of the revnet being snapshotted.
378
- /// @param decimals The decimals the returned surplus should use.
379
- /// @param currency The currency the returned surplus should be in terms of.
386
+ /// @param revnetId The ID of the revnet to snapshot.
387
+ /// @param decimals The decimals to use for the returned surplus.
388
+ /// @param currency The currency to denominate the returned surplus in.
380
389
  /// @return supply The loan-collateral supply to include in the peer snapshot.
381
390
  /// @return surplus The outstanding loan debt to include in `sourceSurplus`.
382
391
  /// @return balance The outstanding loan debt to include in `sourceBalance`.
@@ -398,7 +407,7 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
398
407
  // --------------------- external transactions ----------------------- //
399
408
  //*********************************************************************//
400
409
 
401
- /// @notice Processes the fee from a cash out.
410
+ /// @notice Process the fee from a cash out.
402
411
  /// @param context Cash out context passed in by the terminal.
403
412
  function afterCashOutRecordedWith(JBAfterCashOutRecordedContext calldata context) external payable override {
404
413
  // No caller validation needed — this hook only pays fees to the fee project using funds forwarded by the
@@ -508,8 +517,8 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
508
517
  //*********************************************************************//
509
518
 
510
519
  /// @notice A flag indicating whether an address is a revnet's sucker.
511
- /// @param revnetId The ID of the revnet to check sucker status for.
512
- /// @param addr The address being checked.
520
+ /// @param revnetId The ID of the revnet to check.
521
+ /// @param addr The address to check.
513
522
  /// @return isSucker A flag indicating whether the address is one of the revnet's suckers.
514
523
  function _isSuckerOf(uint256 revnetId, address addr) internal view returns (bool) {
515
524
  return SUCKER_REGISTRY.isSuckerOf({projectId: revnetId, addr: addr});
@@ -519,8 +528,8 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
519
528
  /// @dev This is included in cash-out and peer-snapshot math because borrowed funds are still owed to the revnet
520
529
  /// and collateral can re-enter supply when the loan is repaid.
521
530
  /// @param revnetId The ID of the revnet to check.
522
- /// @param decimals The decimals the resulting fixed point debt value should use.
523
- /// @param currency The currency the resulting debt value should be in terms of.
531
+ /// @param decimals The decimals to use for the resulting fixed point debt value.
532
+ /// @param currency The currency to denominate the resulting debt value in.
524
533
  /// @return borrowedAmount The local outstanding loan debt converted into `currency`.
525
534
  /// @return collateralCount The local burned loan collateral count.
526
535
  function _localLoanStateOf(
@@ -586,12 +595,12 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
586
595
  // --------------------- internal transactions ----------------------- //
587
596
  //*********************************************************************//
588
597
 
589
- /// @notice Logic to be triggered before transferring tokens from this contract.
590
- /// @param to The address the transfer is going to.
591
- /// @param token The token being transferred.
592
- /// @param amount The number of tokens being transferred, as a fixed point number with the same number of decimals
598
+ /// @notice Logic to trigger before transferring tokens from this contract.
599
+ /// @param to The address to transfer to.
600
+ /// @param token The token to transfer.
601
+ /// @param amount The number of tokens to transfer, as a fixed point number with the same number of decimals
593
602
  /// as the token specifies.
594
- /// @return payValue The value to attach to the transaction being sent.
603
+ /// @return payValue The value to attach to the transaction.
595
604
  function _beforeTransferTo(address to, address token, uint256 amount) internal returns (uint256) {
596
605
  // If the token is the native token, no allowance needed.
597
606
  if (token == JBConstants.NATIVE_TOKEN) return amount;
@@ -136,8 +136,8 @@ interface IREVDeployer {
136
136
  /// @return The hook deployer contract.
137
137
  function HOOK_DEPLOYER() external view returns (IJB721TiersHookDeployer);
138
138
 
139
- /// @notice Whether an address is a revnet's split operator.
140
- /// @param revnetId The ID of the revnet.
139
+ /// @notice Check whether an address is a revnet's split operator.
140
+ /// @param revnetId The ID of the revnet to check.
141
141
  /// @param addr The address to check.
142
142
  /// @return A flag indicating whether the address is the revnet's split operator.
143
143
  function isSplitOperatorOf(uint256 revnetId, address addr) external view returns (bool);
@@ -167,13 +167,13 @@ interface IREVDeployer {
167
167
  function SUCKER_REGISTRY() external view returns (IJBSuckerRegistry);
168
168
 
169
169
  /// @notice Auto-mint a revnet's tokens from a stage for a beneficiary.
170
- /// @param revnetId The ID of the revnet to auto-mint tokens from.
171
- /// @param stageId The ID of the stage auto-mint tokens are available from.
172
- /// @param beneficiary The address to auto-mint tokens to.
170
+ /// @param revnetId The ID of the revnet to auto-mint tokens for.
171
+ /// @param stageId The ID of the stage to auto-mint tokens from.
172
+ /// @param beneficiary The address to send auto-minted tokens to.
173
173
  function autoIssueFor(uint256 revnetId, uint256 stageId, address beneficiary) external;
174
174
 
175
175
  /// @notice Burn any of a revnet's tokens held by this contract.
176
- /// @param revnetId The ID of the revnet whose tokens should be burned.
176
+ /// @param revnetId The ID of the revnet to burn tokens for.
177
177
  function burnHeldTokensOf(uint256 revnetId) external;
178
178
 
179
179
  /// @notice Deploy a revnet with a tiered ERC-721 hook and optional croptop posting support.
@@ -182,10 +182,10 @@ interface IREVDeployer {
182
182
  /// @param configuration Core revnet configuration.
183
183
  /// @param terminalConfigurations The terminals to set up for the revnet.
184
184
  /// @param suckerDeploymentConfiguration The suckers to set up for cross-chain token transfers.
185
- /// @param tiered721HookConfiguration How to set up the tiered ERC-721 hook for the revnet.
186
- /// @param allowedPosts Restrictions on which croptop posts are allowed on the revnet's ERC-721 tiers.
185
+ /// @param tiered721HookConfiguration How to configure the tiered ERC-721 hook for the revnet.
186
+ /// @param allowedPosts Restrictions on which croptop posts to allow on the revnet's ERC-721 tiers.
187
187
  /// @return The ID of the newly created or initialized revnet.
188
- /// @return hook The tiered ERC-721 hook that was deployed for the revnet.
188
+ /// @return hook The tiered ERC-721 hook deployed for the revnet.
189
189
  function deployFor(
190
190
  uint256 revnetId,
191
191
  REVConfig memory configuration,
@@ -204,7 +204,7 @@ interface IREVDeployer {
204
204
  /// @param terminalConfigurations The terminals to set up for the revnet.
205
205
  /// @param suckerDeploymentConfiguration The suckers to set up for cross-chain token transfers.
206
206
  /// @return The ID of the newly created or initialized revnet.
207
- /// @return hook The tiered ERC-721 hook that was deployed for the revnet.
207
+ /// @return hook The tiered ERC-721 hook deployed for the revnet.
208
208
  function deployFor(
209
209
  uint256 revnetId,
210
210
  REVConfig memory configuration,
@@ -10,14 +10,14 @@ import {IJBController} from "@bananapus/core-v6/src/interfaces/IJBController.sol
10
10
  interface IREVHiddenTokens {
11
11
  /// @notice Emitted when a holder is allowed or disallowed to hide their own tokens.
12
12
  /// @param revnetId The ID of the revnet.
13
- /// @param holder The holder whose tokens are being allowed or disallowed.
13
+ /// @param holder The holder to allow or disallow.
14
14
  /// @param isAllowed Whether the holder is allowed.
15
15
  event SetTokenHidingAllowed(uint256 indexed revnetId, address indexed holder, bool isAllowed);
16
16
 
17
17
  /// @notice Emitted when tokens are hidden (burned and tracked for later reveal).
18
- /// @param revnetId The ID of the revnet whose tokens are hidden.
18
+ /// @param revnetId The ID of the revnet whose tokens were hidden.
19
19
  /// @param tokenCount The number of tokens hidden.
20
- /// @param holder The address whose tokens are hidden.
20
+ /// @param holder The address whose tokens were hidden.
21
21
  /// @param caller The address that hid the tokens.
22
22
  event HideTokens(uint256 indexed revnetId, uint256 tokenCount, address holder, address caller);
23
23
 
@@ -44,7 +44,7 @@ interface IREVHiddenTokens {
44
44
  function totalHiddenOf(uint256 revnetId) external view returns (uint256);
45
45
 
46
46
  /// @notice Whether a holder is allowed to hide their own tokens.
47
- /// @param holder The holder whose tokens are being managed.
47
+ /// @param holder The holder to check.
48
48
  /// @param revnetId The ID of the revnet.
49
49
  /// @return Whether the holder is allowed.
50
50
  function tokenHidingIsAllowedFor(address holder, uint256 revnetId) external view returns (bool);
@@ -89,10 +89,10 @@ interface IREVLoans {
89
89
  event SetTokenUriResolver(IJBTokenUriResolver indexed resolver, address caller);
90
90
 
91
91
  /// @notice The amount that can be borrowed from a revnet given a certain amount of collateral.
92
- /// @param revnetId The ID of the revnet to check for borrowable assets from.
93
- /// @param collateralCount The amount of collateral used to secure the loan.
94
- /// @param decimals The decimals the resulting fixed point value will include.
95
- /// @param currency The currency that the resulting amount should be in terms of.
92
+ /// @param revnetId The ID of the revnet to borrow from.
93
+ /// @param collateralCount The amount of collateral to secure the loan with.
94
+ /// @param decimals The decimals to use for the resulting fixed point value.
95
+ /// @param currency The currency to denominate the resulting amount in.
96
96
  /// @return The amount that can be borrowed from the revnet.
97
97
  function borrowableAmountFrom(
98
98
  uint256 revnetId,
@@ -108,9 +108,9 @@ interface IREVLoans {
108
108
  /// @return The controller contract.
109
109
  function CONTROLLER() external view returns (IJBController);
110
110
 
111
- /// @notice Determines the source fee amount for a loan being paid off a certain amount.
112
- /// @param loan The loan having its source fee amount determined.
113
- /// @param amount The amount being paid off.
111
+ /// @notice Determines the source fee amount for a loan when paying off a certain amount.
112
+ /// @param loan The loan to determine the source fee for.
113
+ /// @param amount The amount to pay off.
114
114
  /// @return sourceFeeAmount The source fee amount for the loan.
115
115
  function determineSourceFeeAmount(
116
116
  REVLoan memory loan,
@@ -125,9 +125,9 @@ interface IREVLoans {
125
125
  function DIRECTORY() external view returns (IJBDirectory);
126
126
 
127
127
  /// @notice Whether a revnet currently has outstanding loans from the specified terminal in the specified token.
128
- /// @param revnetId The ID of the revnet issuing the loan.
129
- /// @param terminal The terminal that the loan is issued from.
130
- /// @param token The token being loaned.
128
+ /// @param revnetId The ID of the revnet to check.
129
+ /// @param terminal The terminal to check.
130
+ /// @param token The token to check.
131
131
  /// @return A flag indicating if the revnet has an active loan source.
132
132
  function isLoanSourceOf(uint256 revnetId, IJBPayoutTerminal terminal, address token) external view returns (bool);
133
133
 
@@ -135,8 +135,8 @@ interface IREVLoans {
135
135
  /// @return The loan liquidation duration in seconds.
136
136
  function LOAN_LIQUIDATION_DURATION() external view returns (uint256);
137
137
 
138
- /// @notice Get a loan's details.
139
- /// @param loanId The ID of the loan to retrieve.
138
+ /// @notice Get a loan's full details -- amount, collateral, creation time, prepaid fee, and source.
139
+ /// @param loanId The ID of the loan to look up.
140
140
  /// @return The loan data.
141
141
  function loanOf(uint256 loanId) external view returns (REVLoan memory);
142
142
 
@@ -176,8 +176,8 @@ interface IREVLoans {
176
176
  /// @return The REV prepaid fee percent.
177
177
  function REV_PREPAID_FEE_PERCENT() external view returns (uint256);
178
178
 
179
- /// @notice The revnet ID for the loan with the provided loan ID.
180
- /// @param loanId The loan ID to get the revnet ID of.
179
+ /// @notice The revnet ID for a given loan ID.
180
+ /// @param loanId The loan ID to look up.
181
181
  /// @return The ID of the revnet.
182
182
  function revnetIdOfLoanWith(uint256 loanId) external view returns (uint256);
183
183
 
@@ -186,9 +186,9 @@ interface IREVLoans {
186
186
  function tokenUriResolver() external view returns (IJBTokenUriResolver);
187
187
 
188
188
  /// @notice The total amount loaned out by a revnet from a specified terminal in a specified token.
189
- /// @param revnetId The ID of the revnet issuing the loan.
190
- /// @param terminal The terminal that the loan is issued from.
191
- /// @param token The token being loaned.
189
+ /// @param revnetId The ID of the revnet to check.
190
+ /// @param terminal The terminal the loans were issued from.
191
+ /// @param token The token loaned.
192
192
  /// @return The total amount borrowed.
193
193
  function totalBorrowedFrom(
194
194
  uint256 revnetId,
@@ -213,15 +213,15 @@ interface IREVLoans {
213
213
  function totalLoansBorrowedFor(uint256 revnetId) external view returns (uint256);
214
214
 
215
215
  /// @notice Open a loan by borrowing from a revnet. Collateral tokens are burned and only re-minted upon repayment.
216
- /// @param revnetId The ID of the revnet being borrowed from.
216
+ /// @param revnetId The ID of the revnet to borrow from.
217
217
  /// @param source The source of the loan (terminal and token).
218
218
  /// @param minBorrowAmount The minimum amount to borrow, denominated in the source's token.
219
219
  /// @param collateralCount The amount of tokens to use as collateral for the loan.
220
220
  /// @param beneficiary The address that will receive the borrowed funds and fee payment tokens.
221
221
  /// @param prepaidFeePercent The fee percent to charge upfront, in terms of `JBConstants.MAX_FEE`.
222
- /// @param holder The address whose tokens are used as collateral and who receives the loan NFT.
223
- /// @return loanId The ID of the loan created from borrowing.
224
- /// @return The loan created from borrowing.
222
+ /// @param holder The address whose tokens to use as collateral and who receives the loan NFT.
223
+ /// @return loanId The ID of the loan created.
224
+ /// @return The loan created.
225
225
  function borrowFrom(
226
226
  uint256 revnetId,
227
227
  REVLoanSource calldata source,
@@ -234,7 +234,7 @@ interface IREVLoans {
234
234
  external
235
235
  returns (uint256 loanId, REVLoan memory);
236
236
 
237
- /// @notice Liquidates loans that have exceeded the liquidation duration, permanently destroying their collateral.
237
+ /// @notice Liquidate loans that have exceeded the liquidation duration, permanently destroying their collateral.
238
238
  /// @param revnetId The ID of the revnet to liquidate loans from.
239
239
  /// @param startingLoanId The loan number to start iterating from.
240
240
  /// @param count The number of loans to iterate over.
@@ -245,7 +245,7 @@ interface IREVLoans {
245
245
  /// @param collateralCountToTransfer The amount of collateral to transfer from the original loan.
246
246
  /// @param source The source of the new loan (terminal and token). Must match the existing loan's source.
247
247
  /// @param minBorrowAmount The minimum amount to borrow for the new loan.
248
- /// @param collateralCountToAdd Additional collateral to add to the new loan from the caller's balance.
248
+ /// @param collateralCountToAdd Additional collateral to add to the new loan from your balance.
249
249
  /// @param beneficiary The address that will receive the borrowed funds and fee payment tokens.
250
250
  /// @param prepaidFeePercent The fee percent to charge upfront for the new loan.
251
251
  /// @return reallocatedLoanId The ID of the reallocated (reduced) loan.
@@ -265,13 +265,13 @@ interface IREVLoans {
265
265
  returns (uint256 reallocatedLoanId, uint256 newLoanId, REVLoan memory reallocatedLoan, REVLoan memory newLoan);
266
266
 
267
267
  /// @notice Repay a loan or return excess collateral no longer needed to support the loan.
268
- /// @param loanId The ID of the loan being repaid.
268
+ /// @param loanId The ID of the loan to repay.
269
269
  /// @param maxRepayBorrowAmount The maximum amount to repay, denominated in the source's token.
270
270
  /// @param collateralCountToReturn The amount of collateral to return from the loan.
271
- /// @param beneficiary The address receiving the returned collateral and fee payment tokens.
271
+ /// @param beneficiary The address to receive the returned collateral and fee payment tokens.
272
272
  /// @param allowance A permit2 allowance to facilitate the repayment transfer.
273
- /// @return paidOffLoanId The ID of the loan after it has been paid off.
274
- /// @return paidOffloan The loan after it has been paid off.
273
+ /// @return paidOffLoanId The ID of the loan after repayment.
274
+ /// @return paidOffloan The loan after repayment.
275
275
  function repayLoan(
276
276
  uint256 loanId,
277
277
  uint256 maxRepayBorrowAmount,
@@ -283,7 +283,7 @@ interface IREVLoans {
283
283
  payable
284
284
  returns (uint256 paidOffLoanId, REVLoan memory paidOffloan);
285
285
 
286
- /// @notice Sets the address of the resolver used to retrieve the token URI of loans.
286
+ /// @notice Set the address of the resolver used to retrieve the token URI of loans.
287
287
  /// @param resolver The new token URI resolver.
288
288
  function setTokenUriResolver(IJBTokenUriResolver resolver) external;
289
289
  }
@@ -1,11 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.0;
3
3
 
4
- /// @custom:member noNewTiersWithReserves A flag indicating if new tiers with non-zero reserve frequency are forbidden.
5
- /// @custom:member noNewTiersWithVotes A flag indicating if new tiers with voting units are forbidden.
6
- /// @custom:member noNewTiersWithOwnerMinting A flag indicating if new tiers with owner minting are forbidden.
7
- /// @custom:member preventOverspending A flag indicating if payments exceeding the price of minted NFTs should be
8
- /// prevented.
4
+ /// @custom:member noNewTiersWithReserves Whether to forbid new tiers with non-zero reserve frequency.
5
+ /// @custom:member noNewTiersWithVotes Whether to forbid new tiers with voting units.
6
+ /// @custom:member noNewTiersWithOwnerMinting Whether to forbid new tiers with owner minting.
7
+ /// @custom:member preventOverspending Whether to prevent payments exceeding the price of minted NFTs.
9
8
  struct REV721TiersHookFlags {
10
9
  bool noNewTiersWithReserves;
11
10
  bool noNewTiersWithVotes;
@@ -1,8 +1,10 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.0;
3
3
 
4
- /// @custom:member chainId The ID of the chain on which the mint should be honored.
5
- /// @custom:member count The number of tokens that should be minted.
4
+ /// @notice A per-stage token mint that happens without any payment think of it as a scheduled premint. Each auto
5
+ /// issuance specifies a chain, beneficiary, and token count. Can be claimed once per stage via `autoIssueFor`.
6
+ /// @custom:member chainId The chain ID where this auto-issuance should be honored (only mints on the matching chain).
7
+ /// @custom:member count The number of tokens to mint for the beneficiary.
6
8
  /// @custom:member beneficiary The address that will receive the minted tokens.
7
9
  struct REVAutoIssuance {
8
10
  uint32 chainId;
@@ -4,11 +4,14 @@ pragma solidity ^0.8.0;
4
4
  import {REVDescription} from "./REVDescription.sol";
5
5
  import {REVStageConfig} from "./REVStageConfig.sol";
6
6
 
7
- /// @custom:member description The description of the revnet.
8
- /// @custom:member baseCurrency The currency that the issuance is based on.
9
- /// @custom:member splitOperator The address that will receive the token premint and initial production split,
10
- /// and who is allowed to change who the operator is. Only the operator can replace itself after deployment.
11
- /// @custom:member stageConfigurations The periods of changing constraints.
7
+ /// @notice Top-level configuration for deploying a revnet. Defines the revnet's identity, base currency for issuance
8
+ /// pricing, the split operator (who receives production splits and can reassign that role), and the ordered list of
9
+ /// stages that govern the revnet's lifecycle.
10
+ /// @custom:member description The revnet's name, ticker, metadata URI, and deployment salt.
11
+ /// @custom:member baseCurrency The currency that issuance pricing is denominated in (e.g. ETH or USD).
12
+ /// @custom:member splitOperator The address that receives production splits and can reassign the operator role.
13
+ /// Only the current operator can replace itself after deployment.
14
+ /// @custom:member stageConfigurations The ordered stages that define how the revnet's tokenomics evolve over time.
12
15
  struct REVConfig {
13
16
  REVDescription description;
14
17
  uint32 baseCurrency;
@@ -2,14 +2,13 @@
2
2
  pragma solidity ^0.8.0;
3
3
 
4
4
  /// @notice Criteria for allowed posts.
5
- /// @custom:member category A category that should allow posts.
6
- /// @custom:member minimumPrice The minimum price that a post to the specified category should cost.
7
- /// @custom:member minimumTotalSupply The minimum total supply of NFTs that can be made available when minting.
8
- /// @custom:member maxTotalSupply The max total supply of NFTs that can be made available when minting. Leave as 0 for
9
- /// max.
10
- /// @custom:member maximumSplitPercent The maximum split percent (out of JBConstants.SPLITS_TOTAL_PERCENT) that a
11
- /// poster can set. 0 means splits are not allowed.
12
- /// @custom:member allowedAddresses A list of addresses that are allowed to post on the category through Croptop.
5
+ /// @custom:member category The category to allow posts for.
6
+ /// @custom:member minimumPrice The minimum price a post to the specified category must cost.
7
+ /// @custom:member minimumTotalSupply The minimum total supply of NFTs to make available when minting.
8
+ /// @custom:member maxTotalSupply The max total supply of NFTs to make available when minting. Leave as 0 for unlimited.
9
+ /// @custom:member maximumSplitPercent The maximum split percent (out of JBConstants.SPLITS_TOTAL_PERCENT) a poster can
10
+ /// set. 0 means splits are not allowed.
11
+ /// @custom:member allowedAddresses The addresses allowed to post on the category through Croptop.
13
12
  struct REVCroptopAllowedPost {
14
13
  uint24 category;
15
14
  uint104 minimumPrice;
@@ -3,16 +3,16 @@ pragma solidity ^0.8.0;
3
3
 
4
4
  import {REVBaseline721HookConfig} from "./REVBaseline721HookConfig.sol";
5
5
 
6
- /// @custom:member baseline721HookConfiguration The baseline config.
7
- /// @custom:member salt The salt to base the collection's address on.
8
- /// @custom:member preventSplitOperatorAdjustingTiers A flag indicating if the revnet's split operator should be
9
- /// prevented from adding tiers and removing tiers that are allowed to be removed.
10
- /// @custom:member preventSplitOperatorUpdatingMetadata A flag indicating if the revnet's split operator should be
11
- /// prevented from updating the 721's metadata.
12
- /// @custom:member preventSplitOperatorMinting A flag indicating if the revnet's split operator should be prevented from
13
- /// minting 721's from tiers that allow it.
14
- /// @custom:member preventSplitOperatorIncreasingDiscountPercent A flag indicating if the revnet's split operator should
15
- /// be prevented from increasing the discount of a tier.
6
+ /// @custom:member baseline721HookConfiguration The baseline 721 hook config.
7
+ /// @custom:member salt The salt to derive the collection's address from.
8
+ /// @custom:member preventSplitOperatorAdjustingTiers Whether to prevent the split operator from adding and removing
9
+ /// tiers.
10
+ /// @custom:member preventSplitOperatorUpdatingMetadata Whether to prevent the split operator from updating the 721's
11
+ /// metadata.
12
+ /// @custom:member preventSplitOperatorMinting Whether to prevent the split operator from minting 721s from tiers that
13
+ /// allow it.
14
+ /// @custom:member preventSplitOperatorIncreasingDiscountPercent Whether to prevent the split operator from increasing
15
+ /// the discount of a tier.
16
16
  struct REVDeploy721TiersHookConfig {
17
17
  REVBaseline721HookConfig baseline721HookConfiguration;
18
18
  bytes32 salt;
@@ -1,11 +1,12 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.0;
3
3
 
4
- /// @custom:member name The name of the ERC-20 token being create for the revnet.
5
- /// @custom:member ticker The ticker of the ERC-20 token being created for the revnet.
6
- /// @custom:member uri The metadata URI containing revnet's info.
7
- /// @custom:member salt Revnets deployed across chains by the same address with the same salt will have the same
8
- /// address.
4
+ /// @notice Identity and metadata for a revnet deployment.
5
+ /// @custom:member name The name of the ERC-20 token created for the revnet.
6
+ /// @custom:member ticker The ticker symbol of the ERC-20 token created for the revnet.
7
+ /// @custom:member uri The metadata URI containing the revnet's off-chain info (logo, description, links).
8
+ /// @custom:member salt A deployment salt — revnets deployed across chains by the same address with the same salt get
9
+ /// deterministic matching addresses.
9
10
  struct REVDescription {
10
11
  string name;
11
12
  string ticker;
@@ -3,12 +3,16 @@ pragma solidity ^0.8.0;
3
3
 
4
4
  import {REVLoanSource} from "./REVLoanSource.sol";
5
5
 
6
- /// @custom:member borrowedAmount The amount that is being borrowed.
7
- /// @custom:member collateralTokenCount The number of collateral tokens currently accounted for.
6
+ /// @notice An active loan against a revnet. The borrower locked collateral tokens (which were burned) and received
7
+ /// funds from the revnet's terminal. The loan can be repaid within the prepaid duration at no extra cost; after that,
8
+ /// repayment cost increases linearly until liquidation at 10 years.
9
+ /// @custom:member amount The amount borrowed (includes fees taken at creation).
10
+ /// @custom:member collateral The number of revnet tokens burned as collateral.
8
11
  /// @custom:member createdAt The timestamp when the loan was created.
9
- /// @custom:member prepaidFeePercent The percentage of the loan's fees that were prepaid.
10
- /// @custom:member prepaidDuration The duration that the loan was prepaid for.
11
- /// @custom:member source The source of the loan.
12
+ /// @custom:member prepaidFeePercent The percentage of fees prepaid at creation (determines prepaid duration).
13
+ /// @custom:member prepaidDuration The duration (seconds) during which repayment costs nothing beyond the original
14
+ /// amount.
15
+ /// @custom:member source The terminal and token from which funds were drawn.
12
16
  struct REVLoan {
13
17
  uint112 amount;
14
18
  uint112 collateral;
@@ -3,8 +3,8 @@ pragma solidity ^0.8.0;
3
3
 
4
4
  import {IJBPayoutTerminal} from "@bananapus/core-v6/src/interfaces/IJBPayoutTerminal.sol";
5
5
 
6
- /// @custom:member token The token that is being loaned.
7
- /// @custom:member terminal The terminal that the loan is being made from.
6
+ /// @custom:member token The token to loan.
7
+ /// @custom:member terminal The terminal to loan from.
8
8
  struct REVLoanSource {
9
9
  address token;
10
10
  IJBPayoutTerminal terminal;
@@ -5,22 +5,20 @@ import {JBSplit} from "@bananapus/core-v6/src/structs/JBSplit.sol";
5
5
 
6
6
  import {REVAutoIssuance} from "./REVAutoIssuance.sol";
7
7
 
8
- /// @custom:member startsAtOrAfter The timestamp to start a stage at the given rate at or after.
9
- /// @custom:member autoIssuances The configurations of mints during this stage.
10
- /// @custom:member splitPercent The percentage of newly issued tokens that should be split with the operator, out
11
- /// of 10_000 (JBConstants.MAX_RESERVED_PERCENT).
12
- /// @custom:member splits The splits for the revnet.
13
- /// @custom:member initialIssuance The number of revnet tokens that one unit of the revnet's base currency will buy, as
14
- /// a fixed point number
15
- /// with 18 decimals.
16
- /// @custom:member issuanceCutFrequency The number of seconds between applied issuance decreases. This
17
- /// should be at least 24 hours.
18
- /// @custom:member issuanceCutPercent The percent that issuance should decrease over time. This percentage is out
19
- /// of 1_000_000_000 (JBConstants.MAX_CUT_PERCENT). 0% corresponds to no issuance increase.
20
- /// @custom:member cashOutTaxRate The factor determining how much each token can cash out from the revnet once
21
- /// cashed out. This rate is out of 10_000 (JBConstants.MAX_CASH_OUT_TAX_RATE). 0% corresponds to no tax when cashing
22
- /// out.
23
- /// @custom:member extraMetadata Extra info to attach set into this stage that may affect hooks.
8
+ /// @notice A stage in a revnet's lifecycle. Each stage defines the token issuance rate, how quickly it decays, what
9
+ /// percentage goes to splits, and the cash-out tax rate. Stages are processed in order — each one activates at or
10
+ /// after
11
+ /// its `startsAtOrAfter` timestamp.
12
+ /// @custom:member startsAtOrAfter The earliest timestamp this stage can begin. Must be strictly increasing across
13
+ /// stages. @custom:member autoIssuances Tokens to mint without payment during this stage (per-chain, per-beneficiary).
14
+ /// @custom:member splitPercent The percentage of newly issued tokens routed to splits, out of 10,000.
15
+ /// @custom:member splits The split recipients for this stage's production allocation.
16
+ /// @custom:member initialIssuance Tokens per unit of base currency at stage start (18-decimal fixed point).
17
+ /// @custom:member issuanceCutFrequency Seconds between each issuance reduction. Should be >= 24 hours.
18
+ /// @custom:member issuanceCutPercent How much issuance decreases each period, out of 1,000,000,000. 0 = no decay.
19
+ /// @custom:member cashOutTaxRate The tax on cash outs, out of 10,000. 0 = no tax (full reclaim). Higher = more tax
20
+ /// retained by the treasury.
21
+ /// @custom:member extraMetadata Additional metadata bits passed to hooks for stage-specific behavior.
24
22
  struct REVStageConfig {
25
23
  uint48 startsAtOrAfter;
26
24
  REVAutoIssuance[] autoIssuances;