@rev-net/core-v6 0.0.53 → 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 +1 -0
- package/package.json +1 -1
- package/src/REVOwner.sol +14 -3
package/foundry.toml
CHANGED
package/package.json
CHANGED
package/src/REVOwner.sol
CHANGED
|
@@ -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
|
|
265
|
-
//
|
|
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 =
|
|
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;
|