@rev-net/core-v6 0.0.40 → 0.0.42
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 +1 -1
- package/src/REVDeployer.sol +44 -52
- package/src/REVHiddenTokens.sol +1 -1
- package/src/REVLoans.sol +132 -138
- package/src/REVOwner.sol +25 -27
- package/src/interfaces/IREVDeployer.sol +10 -10
- package/src/interfaces/IREVHiddenTokens.sol +4 -4
- package/src/interfaces/IREVLoans.sol +28 -28
- package/src/structs/REV721TiersHookFlags.sol +4 -5
- package/src/structs/REVCroptopAllowedPost.sol +7 -8
- package/src/structs/REVDeploy721TiersHookConfig.sol +10 -10
- package/src/structs/REVLoan.sol +2 -1
- package/src/structs/REVLoanSource.sol +2 -2
- package/src/structs/REVStageConfig.sol +4 -3
- package/src/structs/REVSuckerDeploymentConfig.sol +2 -2
package/package.json
CHANGED
package/src/REVDeployer.sol
CHANGED
|
@@ -144,9 +144,9 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
144
144
|
/// @notice The number of revnet tokens which can be "auto-minted" (minted without payments)
|
|
145
145
|
/// for a specific beneficiary during a stage. Think of this as a per-stage premint.
|
|
146
146
|
/// @dev These tokens can be minted with `autoIssueFor(…)`.
|
|
147
|
-
/// @custom:param revnetId The ID of the revnet to
|
|
148
|
-
/// @custom:param stageId The ID of the stage to
|
|
149
|
-
/// @custom:param beneficiary The beneficiary
|
|
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.
|
|
150
150
|
mapping(uint256 revnetId => mapping(uint256 stageId => mapping(address beneficiary => uint256)))
|
|
151
151
|
public
|
|
152
152
|
override amountToAutoIssue;
|
|
@@ -154,7 +154,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
154
154
|
/// @notice The hashed encoded configuration of each revnet.
|
|
155
155
|
/// @dev This is used to ensure that the encoded configuration of a revnet is the same when deploying suckers for
|
|
156
156
|
/// omnichain operations.
|
|
157
|
-
/// @custom:param revnetId The ID of the revnet to
|
|
157
|
+
/// @custom:param revnetId The ID of the revnet to look up.
|
|
158
158
|
mapping(uint256 revnetId => bytes32 hashedEncodedConfiguration) public override hashedEncodedConfigurationOf;
|
|
159
159
|
|
|
160
160
|
//*********************************************************************//
|
|
@@ -163,7 +163,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
163
163
|
|
|
164
164
|
/// @notice A list of `JBPermissonIds` indices to grant to the split operator of a specific revnet.
|
|
165
165
|
/// @dev These should be set in the revnet's deployment process.
|
|
166
|
-
/// @custom:param revnetId The ID of the revnet to
|
|
166
|
+
/// @custom:param revnetId The ID of the revnet to look up.
|
|
167
167
|
// slither-disable-next-line uninitialized-state
|
|
168
168
|
mapping(uint256 revnetId => uint256[]) internal _extraOperatorPermissions;
|
|
169
169
|
|
|
@@ -231,8 +231,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
231
231
|
// -------------------------- public views --------------------------- //
|
|
232
232
|
//*********************************************************************//
|
|
233
233
|
|
|
234
|
-
/// @notice
|
|
235
|
-
/// @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.
|
|
236
236
|
/// @param addr The address to check.
|
|
237
237
|
/// @return flag A flag indicating whether the address is the revnet's split operator.
|
|
238
238
|
function isSplitOperatorOf(uint256 revnetId, address addr) public view override returns (bool) {
|
|
@@ -258,8 +258,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
258
258
|
//*********************************************************************//
|
|
259
259
|
|
|
260
260
|
/// @notice If the specified address is not the revnet's current split operator, revert.
|
|
261
|
-
/// @param revnetId The ID of the revnet to check
|
|
262
|
-
/// @param operator The address
|
|
261
|
+
/// @param revnetId The ID of the revnet to check.
|
|
262
|
+
/// @param operator The address to check.
|
|
263
263
|
function _checkIfIsSplitOperatorOf(uint256 revnetId, address operator) internal view {
|
|
264
264
|
if (!isSplitOperatorOf({revnetId: revnetId, addr: operator})) {
|
|
265
265
|
revert REVDeployer_Unauthorized(revnetId, operator);
|
|
@@ -269,7 +269,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
269
269
|
/// @notice Initialize fund access limits for the loan contract.
|
|
270
270
|
/// @dev Returns an unlimited surplus allowance for each terminal+token pair derived from the terminal
|
|
271
271
|
/// configurations.
|
|
272
|
-
/// @param terminalConfigurations The terminals to set up for the revnet.
|
|
272
|
+
/// @param terminalConfigurations The terminals to set up for the revnet.
|
|
273
273
|
/// @return fundAccessLimitGroups The fund access limit groups for the loans.
|
|
274
274
|
function _makeLoanFundAccessLimits(JBTerminalConfig[] calldata terminalConfigurations)
|
|
275
275
|
internal
|
|
@@ -318,8 +318,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
318
318
|
|
|
319
319
|
/// @notice Make a ruleset configuration for a revnet's stage.
|
|
320
320
|
/// @param baseCurrency The base currency of the revnet.
|
|
321
|
-
/// @param stageConfiguration The stage configuration to
|
|
322
|
-
/// @param fundAccessLimitGroups The fund access limit groups to
|
|
321
|
+
/// @param stageConfiguration The stage configuration to build a ruleset from.
|
|
322
|
+
/// @param fundAccessLimitGroups The fund access limit groups to include in the ruleset.
|
|
323
323
|
/// @return rulesetConfiguration The ruleset configuration.
|
|
324
324
|
function _makeRulesetConfiguration(
|
|
325
325
|
uint32 baseCurrency,
|
|
@@ -359,9 +359,9 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
|
|
362
|
-
/// @notice Returns the permissions that the split operator should
|
|
363
|
-
/// @param revnetId The ID of the revnet to
|
|
364
|
-
/// @return allOperatorPermissions The permissions
|
|
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,
|
|
365
365
|
/// including both default and custom permissions.
|
|
366
366
|
function _splitOperatorPermissionIndexesOf(uint256 revnetId)
|
|
367
367
|
internal
|
|
@@ -397,8 +397,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
397
397
|
/// @dev Called after the ERC-20 token is deployed so the pool can be initialized in the PoolManager.
|
|
398
398
|
/// Computes `sqrtPriceX96` from `initialIssuance` so the pool starts at the same price as the bonding curve.
|
|
399
399
|
/// Silently catches failures (e.g., if the pool is already initialized).
|
|
400
|
-
/// @param revnetId The ID of the revnet.
|
|
401
|
-
/// @param terminalToken The terminal token to
|
|
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.
|
|
402
402
|
/// @param initialIssuance The initial issuance rate (project tokens per terminal token, 18 decimals).
|
|
403
403
|
function _tryInitializeBuybackPoolFor(uint256 revnetId, address terminalToken, uint112 initialIssuance) internal {
|
|
404
404
|
uint160 sqrtPriceX96;
|
|
@@ -438,9 +438,9 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
438
438
|
//*********************************************************************//
|
|
439
439
|
|
|
440
440
|
/// @notice Auto-mint a revnet's tokens from a stage for a beneficiary.
|
|
441
|
-
/// @param revnetId The ID of the revnet to auto-mint tokens
|
|
442
|
-
/// @param stageId The ID of the stage auto-mint tokens
|
|
443
|
-
/// @param beneficiary The address to auto-
|
|
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.
|
|
444
444
|
function autoIssueFor(uint256 revnetId, uint256 stageId, address beneficiary) external override {
|
|
445
445
|
// Get the ruleset for the stage to check if it has started.
|
|
446
446
|
// Stage IDs are `block.timestamp + i` where `i` is the stage index. These match real JB ruleset IDs
|
|
@@ -479,7 +479,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
479
479
|
|
|
480
480
|
/// @notice Burn any of a revnet's tokens held by this contract.
|
|
481
481
|
/// @dev Project tokens can end up here from reserved token distribution when splits don't sum to 100%.
|
|
482
|
-
/// @param revnetId The ID of the revnet
|
|
482
|
+
/// @param revnetId The ID of the revnet to burn tokens for.
|
|
483
483
|
function burnHeldTokensOf(uint256 revnetId) external override {
|
|
484
484
|
uint256 balance = CONTROLLER.TOKENS().totalBalanceOf({holder: address(this), projectId: revnetId});
|
|
485
485
|
if (balance == 0) revert REVDeployer_NothingToBurn();
|
|
@@ -499,13 +499,12 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
499
499
|
/// REVDeployer, and the project becomes subject to immutable revnet rules. This cannot be undone.
|
|
500
500
|
/// @param revnetId The ID of the Juicebox project to initialize as a revnet. Send 0 to deploy a new revnet.
|
|
501
501
|
/// @param configuration Core revnet configuration. See `REVConfig`.
|
|
502
|
-
/// @param terminalConfigurations The terminals to set up for the revnet.
|
|
503
|
-
/// @param suckerDeploymentConfiguration The suckers to set up for
|
|
504
|
-
///
|
|
505
|
-
/// @param
|
|
506
|
-
/// @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.
|
|
507
506
|
/// @return revnetId The ID of the newly created revnet.
|
|
508
|
-
/// @return hook The address of the tiered ERC-721 hook
|
|
507
|
+
/// @return hook The address of the tiered ERC-721 hook deployed for the revnet.
|
|
509
508
|
// The deployment flow makes external setup calls, but any observed state is revnet-scoped and reverts atomically.
|
|
510
509
|
// slither-disable-next-line reentrancy-benign
|
|
511
510
|
function deployFor(
|
|
@@ -598,8 +597,6 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
598
597
|
/// @notice Deploy new suckers for an existing revnet.
|
|
599
598
|
/// @dev Only the revnet's split operator can deploy new suckers.
|
|
600
599
|
/// @param revnetId The ID of the revnet to deploy suckers for.
|
|
601
|
-
/// See `_makeRulesetConfigurations(…)` for encoding details. Clients can read the encoded configuration
|
|
602
|
-
/// from the `DeployRevnet` event emitted by this contract.
|
|
603
600
|
/// @param suckerDeploymentConfiguration The suckers to set up for the revnet.
|
|
604
601
|
function deploySuckersFor(
|
|
605
602
|
uint256 revnetId,
|
|
@@ -635,7 +632,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
635
632
|
/// @dev Only a revnet's current split operator can set a new split operator.
|
|
636
633
|
/// @dev Passing `address(0)` as `newSplitOperator` relinquishes operator powers permanently — the permissions
|
|
637
634
|
/// are granted to the zero address (which cannot execute transactions), effectively burning them.
|
|
638
|
-
/// @param revnetId The ID of the revnet to
|
|
635
|
+
/// @param revnetId The ID of the revnet to change the split operator for.
|
|
639
636
|
/// @param newSplitOperator The new split operator's address. Use `address(0)` to relinquish operator powers.
|
|
640
637
|
function setSplitOperatorOf(uint256 revnetId, address newSplitOperator) external override {
|
|
641
638
|
// Enforce permissions.
|
|
@@ -782,9 +779,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
782
779
|
/// @param shouldDeployNewRevnet Whether the revnet ID was reserved by this deployment call, or the caller is
|
|
783
780
|
/// converting an existing Juicebox project into a revnet.
|
|
784
781
|
/// @param configuration Core revnet configuration. See `REVConfig`.
|
|
785
|
-
/// @param terminalConfigurations The terminals to set up for the revnet.
|
|
786
|
-
/// @param suckerDeploymentConfiguration The suckers to set up for
|
|
787
|
-
/// 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.
|
|
788
784
|
/// @return encodedConfigurationHash A hash that represents the revnet's configuration.
|
|
789
785
|
function _deployRevnetFor(
|
|
790
786
|
uint256 revnetId,
|
|
@@ -887,8 +883,6 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
887
883
|
}
|
|
888
884
|
|
|
889
885
|
/// @param encodedConfigurationHash A hash that represents the revnet's configuration.
|
|
890
|
-
/// See `_makeRulesetConfigurations(…)` for encoding details. Clients can read the encoded configuration
|
|
891
|
-
/// from the `DeployRevnet` event emitted by this contract.
|
|
892
886
|
/// @param suckerDeploymentConfiguration The suckers to set up for the revnet.
|
|
893
887
|
function _deploySuckersFor(
|
|
894
888
|
uint256 revnetId,
|
|
@@ -926,12 +920,11 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
926
920
|
/// @dev `cashOutTaxRate` changes at stage boundaries may allow users to cash out just before a rate increase.
|
|
927
921
|
/// This is accepted behavior — the arbitrage window is bounded by the ruleset design, and all stages are
|
|
928
922
|
/// configured immutably at deployment time.
|
|
929
|
-
/// @param revnetId The ID of the revnet to
|
|
923
|
+
/// @param revnetId The ID of the revnet to build rulesets for.
|
|
930
924
|
/// @param configuration The configuration containing the revnet's stages.
|
|
931
|
-
/// @param terminalConfigurations The terminals to set up for the revnet.
|
|
932
|
-
/// @return rulesetConfigurations A list of ruleset configurations
|
|
933
|
-
/// @return encodedConfigurationHash A hash that represents the revnet's configuration.
|
|
934
|
-
/// 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.
|
|
935
928
|
function _makeRulesetConfigurations(
|
|
936
929
|
uint256 revnetId,
|
|
937
930
|
REVConfig calldata configuration,
|
|
@@ -1073,9 +1066,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
1073
1066
|
encodedConfigurationHash = keccak256(encodedConfiguration);
|
|
1074
1067
|
}
|
|
1075
1068
|
|
|
1076
|
-
/// @notice
|
|
1077
|
-
/// @dev This prevents cash out liquidity/arbitrage issues for existing revnets
|
|
1078
|
-
/// 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.
|
|
1079
1071
|
/// @param revnetId The ID of the revnet to set the cash out delay for.
|
|
1080
1072
|
/// @param firstStageConfig The revnet's first stage.
|
|
1081
1073
|
function _setCashOutDelayIfNeeded(uint256 revnetId, REVStageConfig calldata firstStageConfig) internal {
|
|
@@ -1093,10 +1085,10 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
1093
1085
|
emit SetCashOutDelay({revnetId: revnetId, cashOutDelay: cashOutDelay, caller: _msgSender()});
|
|
1094
1086
|
}
|
|
1095
1087
|
|
|
1096
|
-
/// @notice
|
|
1097
|
-
/// @param operator The address to
|
|
1088
|
+
/// @notice Grant a permission to an address (an "operator").
|
|
1089
|
+
/// @param operator The address to grant the permission to.
|
|
1098
1090
|
/// @param revnetId The ID of the revnet to scope the permission for.
|
|
1099
|
-
/// @param permissionId The ID of the permission to
|
|
1091
|
+
/// @param permissionId The ID of the permission to grant. See `JBPermissionIds`.
|
|
1100
1092
|
function _setPermission(address operator, uint256 revnetId, uint8 permissionId) internal {
|
|
1101
1093
|
uint8[] memory permissionsIds = new uint8[](1);
|
|
1102
1094
|
permissionsIds[0] = permissionId;
|
|
@@ -1107,11 +1099,11 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
1107
1099
|
});
|
|
1108
1100
|
}
|
|
1109
1101
|
|
|
1110
|
-
/// @notice
|
|
1111
|
-
/// @param account The account granting the
|
|
1112
|
-
/// @param operator The address to
|
|
1113
|
-
/// @param revnetId The ID of the revnet to scope the
|
|
1114
|
-
/// @param permissionIds An array of permission IDs to
|
|
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`.
|
|
1115
1107
|
function _setPermissionsFor(
|
|
1116
1108
|
address account,
|
|
1117
1109
|
address operator,
|
|
@@ -1131,7 +1123,7 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
|
|
|
1131
1123
|
|
|
1132
1124
|
/// @notice Give a split operator their permissions.
|
|
1133
1125
|
/// @dev Only a revnet's current split operator can set a new split operator, by calling `setSplitOperatorOf(…)`.
|
|
1134
|
-
/// @param revnetId The ID of the revnet to
|
|
1126
|
+
/// @param revnetId The ID of the revnet to grant split operator permissions for.
|
|
1135
1127
|
/// @param operator The new split operator's address.
|
|
1136
1128
|
function _setSplitOperatorOf(uint256 revnetId, address operator) internal {
|
|
1137
1129
|
// Get the permission indexes for the split operator.
|
package/src/REVHiddenTokens.sol
CHANGED
|
@@ -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
|
|
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
|
|