@rev-net/core-v6 0.0.52 → 0.0.54

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/foundry.toml CHANGED
@@ -1,5 +1,6 @@
1
1
  [profile.default]
2
2
  solc = '0.8.28'
3
+ bytecode_hash = "none"
3
4
  evm_version = 'cancun'
4
5
  via_ir = true
5
6
  optimizer_runs = 200
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rev-net/core-v6",
3
- "version": "0.0.52",
3
+ "version": "0.0.54",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -478,7 +478,7 @@ contract DeployScript is Script, Sphinx {
478
478
  feeRevnetId: FEE_PROJECT_ID,
479
479
  suckerRegistry: suckers.registry,
480
480
  loans: revloans,
481
- deployerBinder: msg.sender
481
+ deployer: msg.sender
482
482
  });
483
483
 
484
484
  // Deploy REVDeployer with the REVLoans, buyback hook, and REVOwner addresses.
package/src/REVOwner.sol CHANGED
@@ -96,7 +96,7 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
96
96
  //*********************************************************************//
97
97
 
98
98
  /// @notice The account allowed to bind the canonical deployer exactly once.
99
- address private immutable _DEPLOYER_BINDER;
99
+ address private immutable _DEPLOYER;
100
100
 
101
101
  //*********************************************************************//
102
102
  // -------------------------- constructor ---------------------------- //
@@ -107,7 +107,7 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
107
107
  /// @param feeRevnetId The Juicebox project ID of the fee revnet.
108
108
  /// @param suckerRegistry The sucker registry.
109
109
  /// @param loans The loan contract.
110
- /// @param deployerBinder The account allowed to bind the canonical deployer via `setDeployer`. Passed explicitly
110
+ /// @param deployer The account allowed to bind the canonical deployer via `setDeployer`. Passed explicitly
111
111
  /// because CREATE2 deployments set `msg.sender` to the factory, not the intended operator.
112
112
  constructor(
113
113
  IJBBuybackHookRegistry buybackHook,
@@ -115,14 +115,14 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
115
115
  uint256 feeRevnetId,
116
116
  IJBSuckerRegistry suckerRegistry,
117
117
  IREVLoans loans,
118
- address deployerBinder
118
+ address deployer
119
119
  ) {
120
120
  BUYBACK_HOOK = buybackHook;
121
121
  DIRECTORY = directory;
122
122
  FEE_REVNET_ID = feeRevnetId;
123
123
  SUCKER_REGISTRY = suckerRegistry;
124
124
  LOANS = loans;
125
- _DEPLOYER_BINDER = deployerBinder;
125
+ _DEPLOYER = deployer;
126
126
  }
127
127
 
128
128
  //*********************************************************************//
@@ -261,12 +261,23 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
261
261
  }
262
262
  }
263
263
 
264
- // Build a context for the buyback hook using the non-fee token count and cross-chain-adjusted values
265
- // so the buyback hook sees the global state for its swap-vs-passthrough routing decision.
264
+ // Build a context for the buyback hook using the non-fee token count and the surplus that
265
+ // produces the LOCALLY-CAPPED direct reclaim. The buyback hook compares this direct reclaim
266
+ // against its pool route to decide noop-vs-swap; passing the global pre-cap surplus would
267
+ // make it score the direct path against an amount the terminal cannot actually deliver,
268
+ // so the hook would skip pools that would have paid more than the final local reclaim.
269
+ // `cashOutFrom` is linear in surplus, so scaling the surplus by the same factor that
270
+ // scaled the reclaim recovers the locally-capped reclaim at the same cashOutCount/
271
+ // totalSupply/tax inputs.
272
+ uint256 buybackSurplus = effectiveSurplusValue;
273
+ if (postFeeReclaimedAmount != unscaledReclaim && unscaledReclaim != 0) {
274
+ buybackSurplus = mulDiv({x: effectiveSurplusValue, y: postFeeReclaimedAmount, denominator: unscaledReclaim});
275
+ }
276
+
266
277
  JBBeforeCashOutRecordedContext memory buybackHookContext = context;
267
278
  buybackHookContext.cashOutCount = nonFeeCashOutCount;
268
279
  buybackHookContext.totalSupply = totalSupply;
269
- buybackHookContext.surplus.value = effectiveSurplusValue;
280
+ buybackHookContext.surplus.value = buybackSurplus;
270
281
 
271
282
  // Let the buyback hook adjust the cash out parameters and optionally return a hook specification.
272
283
  JBCashOutHookSpecification[] memory buybackHookSpecifications;
@@ -508,9 +519,7 @@ contract REVOwner is IJBRulesetDataHook, IJBCashOutHook, IJBPeerChainAdjustedAcc
508
519
  /// @param deployer The canonical REVDeployer instance that will manage revnet runtime state.
509
520
  function setDeployer(IREVDeployer deployer) external {
510
521
  // Only the account that deployed this REVOwner may complete the one-time deployer binding.
511
- if (msg.sender != _DEPLOYER_BINDER) {
512
- revert REVOwner_Unauthorized({caller: msg.sender, expectedCaller: _DEPLOYER_BINDER});
513
- }
522
+ if (msg.sender != _DEPLOYER) revert REVOwner_Unauthorized({caller: msg.sender, expectedCaller: _DEPLOYER});
514
523
  // Prevent the deployer binding from being overwritten after initialization.
515
524
  if (address(DEPLOYER) != address(0)) revert REVOwner_AlreadyInitialized({deployer: address(DEPLOYER)});
516
525
  // Store the canonical REVDeployer that is authorized to manage runtime hook state.