@@ -25,7 +25,6 @@ import {
2525 MAX_HORIZON,
2626 MAX_TICK_DURATION,
2727 MAX_YIELD_CAP_BPS,
28- MAX_PRINCIPAL_BUFFER_BPS,
2928 MAX_AUTHORIZED_ACCOUNTS,
3029 REPAYMENT_DEADLINE_OFFSET,
3130 FULL_BALANCE_SENTINEL,
@@ -36,7 +35,6 @@ import {
3635 BALANCE_TSLOT,
3736 REENTRANCY_TSLOT
3837} from "../../libs/manager/rebalancer/LibRetargetterConstants.sol " ;
39- import {BPS} from "../../libs/Constants.sol " ;
4038import {LibChecks} from "../../libs/common/LibChecks.sol " ;
4139import {LibTransientSlot} from "../../libs/common/LibTransientSlot.sol " ;
4240import {EnumerableSetLib} from "lib/solady/src/utils/EnumerableSetLib.sol " ;
@@ -217,7 +215,7 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
217215 }
218216
219217 RetargetterOperation storage operation_ = LibStorage.operationStorage ();
220- address positionManager = _checkStart (operation_, fund, principal, effectiveYieldCap );
218+ address positionManager = _checkStart (operation_, fund, principal);
221219
222220 // Safe: block.timestamp + 90 days fits in uint40 for ~35,000 years
223221 // forge-lint: disable-next-line(unsafe-typecast)
@@ -280,9 +278,7 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
280278 operation_.checkYield (offer.amount, offer.expectedReturn);
281279 operation_.checkConsumptionWindow ();
282280 ytAmount = IRequest (request).consume (offer, signature, ptAmount);
283- operation_.checkPrincipalCap (
284- request, 0 , _maxPrincipal (LibStorage.assetsStorage ().positionManager, operation_.operationMaxYieldBps)
285- );
281+ operation_.checkPrincipalCap (request, 0 , _maxPrincipal (LibStorage.assetsStorage ().positionManager));
286282 emit OfferConsumed (request, offer.maker, ptAmount, ytAmount);
287283 }
288284
@@ -309,11 +305,7 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
309305 accounts.remove (to);
310306 if (ptAmount != 0 || ytAmount != 0 ) {
311307 operation_.checkOffer (
312- request,
313- ptAmount,
314- ytAmount,
315- ptAmount,
316- _maxPrincipal (LibStorage.assetsStorage ().positionManager, operation_.operationMaxYieldBps)
308+ request, ptAmount, ytAmount, ptAmount, _maxPrincipal (LibStorage.assetsStorage ().positionManager)
317309 );
318310 // The capacity bound keeps every loop over the set within gas reach; see the constant
319311 accounts.add (to, MAX_AUTHORIZED_ACCOUNTS);
@@ -612,9 +604,7 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
612604 onlyOwnerOrRebalancer
613605 {
614606 RetargetterOperation storage operation_ = LibStorage.operationStorage ();
615- // The flash repayment carries no yield, so the window's principal cap is sized on a
616- // zero yield cap (the pure one-trip headroom bound)
617- address positionManager = _checkStart (operation_, fund, flashLoanAmount, 0 );
607+ address positionManager = _checkStart (operation_, fund, flashLoanAmount);
618608 if (! LibStorage.whitelistsStorage ().flashLoanModules[flashLoanModule]) {
619609 revert LibRetargetterErrors.ModuleNotWhitelisted ();
620610 }
@@ -815,13 +805,9 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
815805 }
816806
817807 /// @inheritdoc IRetargetter
818- /// @dev Sized on the config ceiling maxYieldBps, the largest yield cap any operation may
819- /// carry, so this view is a safe floor for every permissible operation; the operation
820- /// gates size on the effective per-operation cap instead (zero for a SYNC window,
821- /// whose flash repayment carries no yield) and can admit up to that looser bound.
822- /// See {_maxPrincipal} for the formula. Reverts if no position manager is bound.
808+ /// @dev See {_maxPrincipal} for the formula. Reverts if no position manager is bound.
823809 function maxPrincipal () public view returns (uint256 ) {
824- return _maxPrincipal (LibStorage.assetsStorage ().positionManager, LibStorage. configStorage ().maxYieldBps );
810+ return _maxPrincipal (LibStorage.assetsStorage ().positionManager);
825811 }
826812
827813 /// @inheritdoc IRetargetter
@@ -885,7 +871,7 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
885871 if (
886872 config_.horizon < MIN_HORIZON || config_.horizon > MAX_HORIZON || config_.tickDuration == 0
887873 || config_.tickDuration > MAX_TICK_DURATION || config_.tickThreshold >= config_.tickDuration
888- || config_.maxYieldBps > MAX_YIELD_CAP_BPS || config_.principalBufferBps > MAX_PRINCIPAL_BUFFER_BPS
874+ || config_.maxYieldBps > MAX_YIELD_CAP_BPS
889875 ) {
890876 revert LibRetargetterErrors.InvalidParameters ();
891877 }
@@ -906,9 +892,8 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
906892 /// and a SYNC window keeps it populated, so this also locks out starts smuggled into a
907893 /// window payload. Requires a bound position manager (unbound means the instance was
908894 /// abandoned), a whitelisted fund, and the requested amount within the live principal
909- /// cap sized on the operation's yield cap (fail-fast for ASYNC, where the cap re-runs
910- /// at every consume; zero for SYNC, whose flash repayment carries no yield).
911- function _checkStart (RetargetterOperation storage operation_ , address fund , uint256 amount , uint16 yieldCapBps )
895+ /// cap (fail-fast for ASYNC, where the cap re-runs at every consume).
896+ function _checkStart (RetargetterOperation storage operation_ , address fund , uint256 amount )
912897 internal
913898 view
914899 returns (address positionManager )
@@ -918,7 +903,7 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
918903 positionManager = LibStorage.assetsStorage ().positionManager;
919904 if (positionManager == address (0 )) revert LibRetargetterErrors.PositionManagerNotBound ();
920905 if (! LibStorage.whitelistsStorage ().funds[fund]) revert LibRetargetterErrors.FundNotWhitelisted ();
921- if (amount > _maxPrincipal (positionManager, yieldCapBps )) revert LibRetargetterErrors.PrincipalCapExceeded ();
906+ if (amount > _maxPrincipal (positionManager)) revert LibRetargetterErrors.PrincipalCapExceeded ();
922907 }
923908
924909 /// @dev Shared preamble of the wrappers acting on the live order: requires an active
@@ -962,12 +947,9 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
962947 /// from live position manager state, so the cap self-corrects: once a rebalance moves
963948 /// the position to target the cap collapses toward zero and further consumption is
964949 /// blocked. An empty position reverts EmptyPosition; debt against zero collateral
965- /// reverts BadDebtPosition. Below target the buffered cap is further bounded by the
966- /// quoter's one-trip repayment bound: repayment prices actual YT supply, which the
967- /// flat yield cap bounds rather than the yield estimate, so the buffer alone would
968- /// let a cap-sized operation owe more than the post-supply target-LTV borrow
969- /// capacity can fund in one settlement trip.
970- function _maxPrincipal (address positionManager , uint16 yieldCapBps ) internal view returns (uint256 ) {
950+ /// reverts BadDebtPosition. Auction yield limits govern accepted offers separately and
951+ /// do not change this position-sizing result.
952+ function _maxPrincipal (address positionManager ) internal view returns (uint256 ) {
971953 uint256 collateralQuoted = IPositionManager (positionManager).collateralAmountQuoted ();
972954 uint256 debt = IPositionManager (positionManager).debtAmount ();
973955 if (collateralQuoted == 0 ) {
@@ -990,19 +972,7 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
990972 estimates.subscriptionDuration,
991973 estimates.redemptionDuration
992974 );
993- uint256 buffered = principal * (BPS + config_.principalBufferBps) / BPS;
994- if (debt.divWad (collateralQuoted) >= target) return buffered;
995- uint256 oneTrip = IRetargetterQuoter (_QUOTER)
996- .ltvUpOneTripPrincipal (
997- collateralQuoted,
998- debt,
999- target,
1000- yieldCapBps,
1001- estimates.borrowRate,
1002- estimates.collateralYieldRate,
1003- estimates.subscriptionDuration
1004- );
1005- return buffered.min (oneTrip);
975+ return principal;
1006976 }
1007977
1008978 /// @dev Current owed amount on the operation's Request, priced on the repayment terms
0 commit comments