@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rev-net/core-v6",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,8 +43,15 @@ import {REVDeploy721TiersHookConfig} from "./structs/REVDeploy721TiersHookConfig
43
43
  import {REVStageConfig} from "./structs/REVStageConfig.sol";
44
44
  import {REVSuckerDeploymentConfig} from "./structs/REVSuckerDeploymentConfig.sol";
45
45
 
46
- /// @notice `REVDeployer` deploys, manages, and operates Revnets.
47
- /// @dev Revnets are unowned Juicebox projects which operate autonomously after deployment.
46
+ /// @notice Deploys and configures Revnets autonomous Juicebox projects with pre-programmed tokenomics that cannot
47
+ /// be
48
+ /// changed after launch. Each revnet progresses through stages that define issuance rate, decay schedule, cash-out tax,
49
+ /// split allocations, and auto-issuances. The deployer translates these stage configurations into Juicebox rulesets,
50
+ /// sets up a buyback hook for secondary market routing, deploys a tiered 721 hook, optionally configures Croptop
51
+ /// posting, and can deploy cross-chain suckers. Once deployed, the project NFT is held by this contract — no single
52
+ /// address can modify the revnet's rules.
53
+ /// @dev Revnets are unowned Juicebox projects which operate autonomously after deployment. Runtime data hook logic
54
+ /// (pay/cash-out callbacks) is handled by the separate `REVOwner` contract to stay within EIP-170 size limits.
48
55
  contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
49
56
  //*********************************************************************//
50
57
  // --------------------------- custom errors ------------------------- //
@@ -137,9 +144,9 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
137
144
  /// @notice The number of revnet tokens which can be "auto-minted" (minted without payments)
138
145
  /// for a specific beneficiary during a stage. Think of this as a per-stage premint.
139
146
  /// @dev These tokens can be minted with `autoIssueFor(…)`.
140
- /// @custom:param revnetId The ID of the revnet to get the auto-mint amount for.
141
- /// @custom:param stageId The ID of the stage to get the auto-mint amount for.
142
- /// @custom:param beneficiary The beneficiary of the auto-mint.
147
+ /// @custom:param revnetId The ID of the revnet to check.
148
+ /// @custom:param stageId The ID of the stage to check.
149
+ /// @custom:param beneficiary The beneficiary to check.
143
150
  mapping(uint256 revnetId => mapping(uint256 stageId => mapping(address beneficiary => uint256)))
144
151
  public
145
152
  override amountToAutoIssue;
@@ -147,7 +154,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
147
154
  /// @notice The hashed encoded configuration of each revnet.
148
155
  /// @dev This is used to ensure that the encoded configuration of a revnet is the same when deploying suckers for
149
156
  /// omnichain operations.
150
- /// @custom:param revnetId The ID of the revnet to get the hashed encoded configuration for.
157
+ /// @custom:param revnetId The ID of the revnet to look up.
151
158
  mapping(uint256 revnetId => bytes32 hashedEncodedConfiguration) public override hashedEncodedConfigurationOf;
152
159
 
153
160
  //*********************************************************************//
@@ -156,7 +163,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
156
163
 
157
164
  /// @notice A list of `JBPermissonIds` indices to grant to the split operator of a specific revnet.
158
165
  /// @dev These should be set in the revnet's deployment process.
159
- /// @custom:param revnetId The ID of the revnet to get the extra operator permissions for.
166
+ /// @custom:param revnetId The ID of the revnet to look up.
160
167
  // slither-disable-next-line uninitialized-state
161
168
  mapping(uint256 revnetId => uint256[]) internal _extraOperatorPermissions;
162
169
 
@@ -224,8 +231,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
224
231
  // -------------------------- public views --------------------------- //
225
232
  //*********************************************************************//
226
233
 
227
- /// @notice A flag indicating whether an address is a revnet's split operator.
228
- /// @param revnetId The ID of the revnet.
234
+ /// @notice Check whether an address is a revnet's split operator.
235
+ /// @param revnetId The ID of the revnet to check.
229
236
  /// @param addr The address to check.
230
237
  /// @return flag A flag indicating whether the address is the revnet's split operator.
231
238
  function isSplitOperatorOf(uint256 revnetId, address addr) public view override returns (bool) {
@@ -251,8 +258,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
251
258
  //*********************************************************************//
252
259
 
253
260
  /// @notice If the specified address is not the revnet's current split operator, revert.
254
- /// @param revnetId The ID of the revnet to check split operator status for.
255
- /// @param operator The address being checked.
261
+ /// @param revnetId The ID of the revnet to check.
262
+ /// @param operator The address to check.
256
263
  function _checkIfIsSplitOperatorOf(uint256 revnetId, address operator) internal view {
257
264
  if (!isSplitOperatorOf({revnetId: revnetId, addr: operator})) {
258
265
  revert REVDeployer_Unauthorized(revnetId, operator);
@@ -262,7 +269,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
262
269
  /// @notice Initialize fund access limits for the loan contract.
263
270
  /// @dev Returns an unlimited surplus allowance for each terminal+token pair derived from the terminal
264
271
  /// configurations.
265
- /// @param terminalConfigurations The terminals to set up for the revnet. Used for payments and cash outs.
272
+ /// @param terminalConfigurations The terminals to set up for the revnet.
266
273
  /// @return fundAccessLimitGroups The fund access limit groups for the loans.
267
274
  function _makeLoanFundAccessLimits(JBTerminalConfig[] calldata terminalConfigurations)
268
275
  internal
@@ -311,8 +318,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
311
318
 
312
319
  /// @notice Make a ruleset configuration for a revnet's stage.
313
320
  /// @param baseCurrency The base currency of the revnet.
314
- /// @param stageConfiguration The stage configuration to make a ruleset for.
315
- /// @param fundAccessLimitGroups The fund access limit groups to set up for the ruleset.
321
+ /// @param stageConfiguration The stage configuration to build a ruleset from.
322
+ /// @param fundAccessLimitGroups The fund access limit groups to include in the ruleset.
316
323
  /// @return rulesetConfiguration The ruleset configuration.
317
324
  function _makeRulesetConfiguration(
318
325
  uint32 baseCurrency,
@@ -352,9 +359,9 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
352
359
  });
353
360
  }
354
361
 
355
- /// @notice Returns the permissions that the split operator should be granted for a revnet.
356
- /// @param revnetId The ID of the revnet to get split operator permissions for.
357
- /// @return allOperatorPermissions The permissions that the split operator should be granted for the revnet,
362
+ /// @notice Returns the permissions that the split operator should have for a revnet.
363
+ /// @param revnetId The ID of the revnet to look up.
364
+ /// @return allOperatorPermissions The permissions the split operator should have for the revnet,
358
365
  /// including both default and custom permissions.
359
366
  function _splitOperatorPermissionIndexesOf(uint256 revnetId)
360
367
  internal
@@ -390,8 +397,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
390
397
  /// @dev Called after the ERC-20 token is deployed so the pool can be initialized in the PoolManager.
391
398
  /// Computes `sqrtPriceX96` from `initialIssuance` so the pool starts at the same price as the bonding curve.
392
399
  /// Silently catches failures (e.g., if the pool is already initialized).
393
- /// @param revnetId The ID of the revnet.
394
- /// @param terminalToken The terminal token to initialize a buyback pool for.
400
+ /// @param revnetId The ID of the revnet to initialize a pool for.
401
+ /// @param terminalToken The terminal token to create a buyback pool for.
395
402
  /// @param initialIssuance The initial issuance rate (project tokens per terminal token, 18 decimals).
396
403
  function _tryInitializeBuybackPoolFor(uint256 revnetId, address terminalToken, uint112 initialIssuance) internal {
397
404
  uint160 sqrtPriceX96;
@@ -431,9 +438,9 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
431
438
  //*********************************************************************//
432
439
 
433
440
  /// @notice Auto-mint a revnet's tokens from a stage for a beneficiary.
434
- /// @param revnetId The ID of the revnet to auto-mint tokens from.
435
- /// @param stageId The ID of the stage auto-mint tokens are available from.
436
- /// @param beneficiary The address to auto-mint tokens to.
441
+ /// @param revnetId The ID of the revnet to auto-mint tokens for.
442
+ /// @param stageId The ID of the stage to auto-mint tokens from.
443
+ /// @param beneficiary The address to send auto-minted tokens to.
437
444
  function autoIssueFor(uint256 revnetId, uint256 stageId, address beneficiary) external override {
438
445
  // Get the ruleset for the stage to check if it has started.
439
446
  // Stage IDs are `block.timestamp + i` where `i` is the stage index. These match real JB ruleset IDs
@@ -472,7 +479,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
472
479
 
473
480
  /// @notice Burn any of a revnet's tokens held by this contract.
474
481
  /// @dev Project tokens can end up here from reserved token distribution when splits don't sum to 100%.
475
- /// @param revnetId The ID of the revnet whose tokens should be burned.
482
+ /// @param revnetId The ID of the revnet to burn tokens for.
476
483
  function burnHeldTokensOf(uint256 revnetId) external override {
477
484
  uint256 balance = CONTROLLER.TOKENS().totalBalanceOf({holder: address(this), projectId: revnetId});
478
485
  if (balance == 0) revert REVDeployer_NothingToBurn();
@@ -492,13 +499,12 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
492
499
  /// REVDeployer, and the project becomes subject to immutable revnet rules. This cannot be undone.
493
500
  /// @param revnetId The ID of the Juicebox project to initialize as a revnet. Send 0 to deploy a new revnet.
494
501
  /// @param configuration Core revnet configuration. See `REVConfig`.
495
- /// @param terminalConfigurations The terminals to set up for the revnet. Used for payments and cash outs.
496
- /// @param suckerDeploymentConfiguration The suckers to set up for the revnet. Suckers facilitate cross-chain
497
- /// token transfers between peer revnets on different networks.
498
- /// @param tiered721HookConfiguration How to set up the tiered ERC-721 hook for the revnet.
499
- /// @param allowedPosts Restrictions on which croptop posts are allowed on the revnet's ERC-721 tiers.
502
+ /// @param terminalConfigurations The terminals to set up for the revnet.
503
+ /// @param suckerDeploymentConfiguration The suckers to set up for cross-chain token transfers.
504
+ /// @param tiered721HookConfiguration How to configure the tiered ERC-721 hook for the revnet.
505
+ /// @param allowedPosts Restrictions on which croptop posts to allow on the revnet's ERC-721 tiers.
500
506
  /// @return revnetId The ID of the newly created revnet.
501
- /// @return hook The address of the tiered ERC-721 hook that was deployed for the revnet.
507
+ /// @return hook The address of the tiered ERC-721 hook deployed for the revnet.
502
508
  // The deployment flow makes external setup calls, but any observed state is revnet-scoped and reverts atomically.
503
509
  // slither-disable-next-line reentrancy-benign
504
510
  function deployFor(
@@ -591,8 +597,6 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
591
597
  /// @notice Deploy new suckers for an existing revnet.
592
598
  /// @dev Only the revnet's split operator can deploy new suckers.
593
599
  /// @param revnetId The ID of the revnet to deploy suckers for.
594
- /// See `_makeRulesetConfigurations(…)` for encoding details. Clients can read the encoded configuration
595
- /// from the `DeployRevnet` event emitted by this contract.
596
600
  /// @param suckerDeploymentConfiguration The suckers to set up for the revnet.
597
601
  function deploySuckersFor(
598
602
  uint256 revnetId,
@@ -628,7 +632,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
628
632
  /// @dev Only a revnet's current split operator can set a new split operator.
629
633
  /// @dev Passing `address(0)` as `newSplitOperator` relinquishes operator powers permanently — the permissions
630
634
  /// are granted to the zero address (which cannot execute transactions), effectively burning them.
631
- /// @param revnetId The ID of the revnet to set the split operator of.
635
+ /// @param revnetId The ID of the revnet to change the split operator for.
632
636
  /// @param newSplitOperator The new split operator's address. Use `address(0)` to relinquish operator powers.
633
637
  function setSplitOperatorOf(uint256 revnetId, address newSplitOperator) external override {
634
638
  // Enforce permissions.
@@ -775,9 +779,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
775
779
  /// @param shouldDeployNewRevnet Whether the revnet ID was reserved by this deployment call, or the caller is
776
780
  /// converting an existing Juicebox project into a revnet.
777
781
  /// @param configuration Core revnet configuration. See `REVConfig`.
778
- /// @param terminalConfigurations The terminals to set up for the revnet. Used for payments and cash outs.
779
- /// @param suckerDeploymentConfiguration The suckers to set up for the revnet. Suckers facilitate cross-chain
780
- /// token transfers between peer revnets on different networks.
782
+ /// @param terminalConfigurations The terminals to set up for the revnet.
783
+ /// @param suckerDeploymentConfiguration The suckers to set up for cross-chain token transfers.
781
784
  /// @return encodedConfigurationHash A hash that represents the revnet's configuration.
782
785
  function _deployRevnetFor(
783
786
  uint256 revnetId,
@@ -880,8 +883,6 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
880
883
  }
881
884
 
882
885
  /// @param encodedConfigurationHash A hash that represents the revnet's configuration.
883
- /// See `_makeRulesetConfigurations(…)` for encoding details. Clients can read the encoded configuration
884
- /// from the `DeployRevnet` event emitted by this contract.
885
886
  /// @param suckerDeploymentConfiguration The suckers to set up for the revnet.
886
887
  function _deploySuckersFor(
887
888
  uint256 revnetId,
@@ -919,12 +920,11 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
919
920
  /// @dev `cashOutTaxRate` changes at stage boundaries may allow users to cash out just before a rate increase.
920
921
  /// This is accepted behavior — the arbitrage window is bounded by the ruleset design, and all stages are
921
922
  /// configured immutably at deployment time.
922
- /// @param revnetId The ID of the revnet to make rulesets for.
923
+ /// @param revnetId The ID of the revnet to build rulesets for.
923
924
  /// @param configuration The configuration containing the revnet's stages.
924
- /// @param terminalConfigurations The terminals to set up for the revnet. Used for payments and cash outs.
925
- /// @return rulesetConfigurations A list of ruleset configurations defined by the stages.
926
- /// @return encodedConfigurationHash A hash that represents the revnet's configuration. Used for sucker
927
- /// deployment salts.
925
+ /// @param terminalConfigurations The terminals to set up for the revnet.
926
+ /// @return rulesetConfigurations A list of ruleset configurations derived from the stages.
927
+ /// @return encodedConfigurationHash A hash that represents the revnet's configuration.
928
928
  function _makeRulesetConfigurations(
929
929
  uint256 revnetId,
930
930
  REVConfig calldata configuration,
@@ -1066,9 +1066,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
1066
1066
  encodedConfigurationHash = keccak256(encodedConfiguration);
1067
1067
  }
1068
1068
 
1069
- /// @notice Sets the cash out delay if the revnet's stages are already in progress.
1070
- /// @dev This prevents cash out liquidity/arbitrage issues for existing revnets which
1071
- /// are deploying to a new chain.
1069
+ /// @notice Set the cash out delay if the revnet's stages are already in progress.
1070
+ /// @dev This prevents cash out liquidity/arbitrage issues for existing revnets deploying to a new chain.
1072
1071
  /// @param revnetId The ID of the revnet to set the cash out delay for.
1073
1072
  /// @param firstStageConfig The revnet's first stage.
1074
1073
  function _setCashOutDelayIfNeeded(uint256 revnetId, REVStageConfig calldata firstStageConfig) internal {
@@ -1086,10 +1085,10 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
1086
1085
  emit SetCashOutDelay({revnetId: revnetId, cashOutDelay: cashOutDelay, caller: _msgSender()});
1087
1086
  }
1088
1087
 
1089
- /// @notice Grants a permission to an address (an "operator").
1090
- /// @param operator The address to give the permission to.
1088
+ /// @notice Grant a permission to an address (an "operator").
1089
+ /// @param operator The address to grant the permission to.
1091
1090
  /// @param revnetId The ID of the revnet to scope the permission for.
1092
- /// @param permissionId The ID of the permission to set. See `JBPermissionIds`.
1091
+ /// @param permissionId The ID of the permission to grant. See `JBPermissionIds`.
1093
1092
  function _setPermission(address operator, uint256 revnetId, uint8 permissionId) internal {
1094
1093
  uint8[] memory permissionsIds = new uint8[](1);
1095
1094
  permissionsIds[0] = permissionId;
@@ -1100,11 +1099,11 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
1100
1099
  });
1101
1100
  }
1102
1101
 
1103
- /// @notice Grants a permission to an address (an "operator").
1104
- /// @param account The account granting the permission.
1105
- /// @param operator The address to give the permission to.
1106
- /// @param revnetId The ID of the revnet to scope the permission for.
1107
- /// @param permissionIds An array of permission IDs to set. See `JBPermissionIds`.
1102
+ /// @notice Grant permissions to an address (an "operator").
1103
+ /// @param account The account granting the permissions.
1104
+ /// @param operator The address to grant the permissions to.
1105
+ /// @param revnetId The ID of the revnet to scope the permissions for.
1106
+ /// @param permissionIds An array of permission IDs to grant. See `JBPermissionIds`.
1108
1107
  function _setPermissionsFor(
1109
1108
  address account,
1110
1109
  address operator,
@@ -1124,7 +1123,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
1124
1123
 
1125
1124
  /// @notice Give a split operator their permissions.
1126
1125
  /// @dev Only a revnet's current split operator can set a new split operator, by calling `setSplitOperatorOf(…)`.
1127
- /// @param revnetId The ID of the revnet to set the split operator of.
1126
+ /// @param revnetId The ID of the revnet to grant split operator permissions for.
1128
1127
  /// @param operator The new split operator's address.
1129
1128
  function _setSplitOperatorOf(uint256 revnetId, address operator) internal {
1130
1129
  // Get the permission indexes for the split operator.
@@ -48,7 +48,7 @@ contract REVHiddenTokens is ERC2771Context, JBPermissioned, IREVHiddenTokens {
48
48
  mapping(uint256 revnetId => uint256 count) public override totalHiddenOf;
49
49
 
50
50
  /// @notice Whether a holder is allowed to hide their own tokens.
51
- /// @custom:param holder The holder whose tokens are being managed.
51
+ /// @custom:param holder The holder to check.
52
52
  /// @custom:param revnetId The ID of the revnet.
53
53
  mapping(address holder => mapping(uint256 revnetId => bool isAllowed)) public override tokenHidingIsAllowedFor;
54
54