@rev-net/core-v6 0.0.61 → 0.0.63

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.62 — Omit unset router terminal registry
4
+
5
+ - `REVDeployer` now omits `ROUTER_TERMINAL_REGISTRY` from the canonical terminal configuration when it was
6
+ constructed with `address(0)`.
7
+ - This supports chains where the router terminal stack is unavailable while still launching revnets with the canonical
8
+ multi terminal.
9
+
3
10
  ## 0.0.56 — Bump v6 deps to nana-core-v6 0.0.53 cohort
4
11
 
5
12
  - `@bananapus/core-v6`: `^0.0.48 → ^0.0.53` ([PR #145](https://github.com/Bananapus/nana-core-v6/pull/145)).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rev-net/core-v6",
3
- "version": "0.0.61",
3
+ "version": "0.0.63",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,11 +28,11 @@
28
28
  "dependencies": {
29
29
  "@bananapus/721-hook-v6": "^0.0.54",
30
30
  "@bananapus/buyback-hook-v6": "^0.0.49",
31
- "@bananapus/core-v6": "^0.0.57",
31
+ "@bananapus/core-v6": "^0.0.59",
32
32
  "@bananapus/ownable-v6": "^0.0.27",
33
33
  "@bananapus/permission-ids-v6": "^0.0.26",
34
34
  "@bananapus/router-terminal-v6": "^0.0.46",
35
- "@bananapus/suckers-v6": "^0.0.49",
35
+ "@bananapus/suckers-v6": "^0.0.50",
36
36
  "@croptop/core-v6": "^0.0.52",
37
37
  "@openzeppelin/contracts": "5.6.1",
38
38
  "@uniswap/permit2": "github:Uniswap/permit2#cc56ad0f3439c502c246fc5cfcc3db92bb8b7219"
@@ -174,8 +174,8 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
174
174
  /// @param controller The controller to use for launching and operating the Juicebox projects which will be revnets.
175
175
  /// @param multiTerminal The canonical terminal that holds revnet treasury balances. Assumed to be a valid
176
176
  /// deployment-time dependency.
177
- /// @param routerTerminalRegistry The canonical router terminal registry used for alternate payment routes. Assumed
178
- /// to be a valid deployment-time dependency.
177
+ /// @param routerTerminalRegistry The canonical router terminal registry used for alternate payment routes. May be
178
+ /// the zero address on chains where the router terminal stack is unavailable.
179
179
  /// @param suckerRegistry The registry to use for deploying and tracking each revnet's suckers.
180
180
  /// @param feeRevnetId The Juicebox project ID of the revnet that will receive fees.
181
181
  /// @param hookDeployer The deployer to use for revnet's tiered ERC-721 hooks.
@@ -353,9 +353,9 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
353
353
 
354
354
  /// @notice Build the canonical terminal configuration used by every revnet.
355
355
  /// @dev `MULTI_TERMINAL` accepts the revnet's accounting contexts and owns the treasury/loan accounting surface.
356
- /// `ROUTER_TERMINAL_REGISTRY` is registered without accounting contexts so users can pay through the router path
357
- /// without letting callers choose arbitrary terminals or loan sources. The deployer is constructed with distinct
358
- /// addresses in the two slots; reusing the same address would be rejected by the directory's duplicate check.
356
+ /// When configured, `ROUTER_TERMINAL_REGISTRY` is registered without accounting contexts so users can pay through
357
+ /// the router path without letting callers choose arbitrary terminals or loan sources. Chains without the router
358
+ /// terminal stack use only `MULTI_TERMINAL`.
359
359
  /// @param accountingContextsToAccept The accounting contexts the canonical multi terminal should accept.
360
360
  /// @return terminalConfigurations The canonical terminal configuration for the revnet.
361
361
  function _makeTerminalConfigurations(JBAccountingContext[] calldata accountingContextsToAccept)
@@ -363,12 +363,15 @@ contract REVDeployer is ERC2771Context, IREVDeployer, IERC721Receiver {
363
363
  view
364
364
  returns (JBTerminalConfig[] memory terminalConfigurations)
365
365
  {
366
- terminalConfigurations = new JBTerminalConfig[](2);
366
+ bool hasRouterTerminalRegistry = address(ROUTER_TERMINAL_REGISTRY) != address(0);
367
+ terminalConfigurations = new JBTerminalConfig[](hasRouterTerminalRegistry ? 2 : 1);
367
368
  terminalConfigurations[0] =
368
369
  JBTerminalConfig({terminal: MULTI_TERMINAL, accountingContextsToAccept: accountingContextsToAccept});
369
- terminalConfigurations[1] = JBTerminalConfig({
370
- terminal: ROUTER_TERMINAL_REGISTRY, accountingContextsToAccept: new JBAccountingContext[](0)
371
- });
370
+ if (hasRouterTerminalRegistry) {
371
+ terminalConfigurations[1] = JBTerminalConfig({
372
+ terminal: ROUTER_TERMINAL_REGISTRY, accountingContextsToAccept: new JBAccountingContext[](0)
373
+ });
374
+ }
372
375
  }
373
376
 
374
377
  /// @notice Returns the permissions that the operator should have for a revnet.
package/src/REVLoans.sol CHANGED
@@ -1055,7 +1055,16 @@ contract REVLoans is ERC721, ERC2771Context, JBPermissioned, Ownable, IREVLoans
1055
1055
  JBAccountingContext memory context =
1056
1056
  TERMINAL.accountingContextForTokenOf({projectId: revnetId, token: sourceToken});
1057
1057
 
1058
- // Pull the amount to be loaned out of the revnet. This will incure the protocol fee.
1058
+ // Pull the amount to be loaned out of the revnet. This will incure the protocol fee. Crediting `REV_ID`
1059
+ // as the referrer attributes the protocol fee volume from every Revnet loan back to the REV revnet
1060
+ // itself — REV is the project that facilitated the activity, regardless of which revnet is borrowing.
1061
+ //
1062
+ // The referrer reference is encoded as `(referralChainId << 48) | referralProjectId` per
1063
+ // `JBMultiTerminal`'s `currentReferralProjectId` packing. REV lives on Ethereum mainnet, so we hard-code
1064
+ // `referralChainId = 1`
1065
+ // here: this ensures the protocol fee volume credit accrues to REV on mainnet regardless of which chain
1066
+ // the loan originates from. (Auto-resolving to `block.chainid` would scatter credit across L2s where REV
1067
+ // has no canonical project ID, so we pin mainnet explicitly.)
1059
1068
  netAmountPaidOut = TERMINAL.useAllowanceOf({
1060
1069
  projectId: revnetId,
1061
1070
  token: sourceToken,
@@ -1064,7 +1073,8 @@ contract REVLoans is ERC721, ERC2771Context, JBPermissioned, Ownable, IREVLoans
1064
1073
  minTokensPaidOut: 0,
1065
1074
  beneficiary: payable(address(this)),
1066
1075
  feeBeneficiary: beneficiary,
1067
- memo: ""
1076
+ memo: "",
1077
+ referralProjectId: (uint256(1) << 48) | REV_ID
1068
1078
  });
1069
1079
  }
1070
1080
 
@@ -165,7 +165,7 @@ interface IREVDeployer {
165
165
  function PUBLISHER() external view returns (CTPublisher);
166
166
 
167
167
  /// @notice The canonical router terminal registry installed as a project terminal for alternate payment routes.
168
- /// @return The router terminal registry contract, cast as a terminal.
168
+ /// @return The router terminal registry contract, cast as a terminal, or zero if unavailable on this chain.
169
169
  function ROUTER_TERMINAL_REGISTRY() external view returns (IJBTerminal);
170
170
 
171
171
  /// @notice The registry that deploys and tracks suckers for revnets.