@@ -567,15 +567,15 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
567567 bytes memory payload = abi.encode (data);
568568 MODULE_TSLOT.tStoreAddress (flashLoanModule);
569569 AMOUNT_TSLOT.tStoreUint (flashLoanAmount);
570- PAYLOAD_TSLOT.tStoreBytes32 ( keccak256 (payload));
570+ PAYLOAD_TSLOT.tStoreUint ( uint256 ( keccak256 (payload) ));
571571 BALANCE_TSLOT.tStoreUint (debtAsset.balanceOf (address (this )));
572572
573573 IFlashLoanModule (flashLoanModule).flashLoan (debtAsset, flashLoanAmount, payload);
574574
575575 // The module has pulled its repayment; close the window and scrub any leftover approval
576576 MODULE_TSLOT.tStoreAddress (address (0 ));
577577 AMOUNT_TSLOT.tStoreUint (0 );
578- PAYLOAD_TSLOT.tStoreBytes32 ( bytes32 ( 0 ) );
578+ PAYLOAD_TSLOT.tStoreUint ( 0 );
579579 BALANCE_TSLOT.tStoreUint (0 );
580580 debtAsset.safeApprove (flashLoanModule, 0 );
581581
@@ -605,12 +605,12 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
605605 address module = MODULE_TSLOT.tLoadAddress ();
606606 if (
607607 module == address (0 ) || msg .sender != module || amount != AMOUNT_TSLOT.tLoadUint ()
608- || keccak256 (data) != PAYLOAD_TSLOT.tLoadBytes32 ()
608+ || uint256 ( keccak256 (data)) != PAYLOAD_TSLOT.tLoadUint ()
609609 ) {
610610 revert LibRetargetterErrors.UnauthorizedFlashLoanCallback ();
611611 }
612612 MODULE_TSLOT.tStoreAddress (address (0 ));
613- PAYLOAD_TSLOT.tStoreBytes32 ( bytes32 ( 0 ) );
613+ PAYLOAD_TSLOT.tStoreUint ( 0 );
614614 address debtAsset = LibStorage.assetsStorage ().debtAsset;
615615 if (debtAsset.balanceOf (address (this )) < BALANCE_TSLOT.tLoadUint () + amount) {
616616 revert LibRetargetterErrors.PrincipalNotDelivered ();
@@ -910,20 +910,17 @@ contract Retargetter is IRetargetter, IFlashLoanReceiver, OwnableRoles, Initiali
910910 }
911911
912912 /// @dev Arms the rebalance value-conservation gate: returns the position manager's current
913- /// net value while the operation's Request is unrepaid and short of its deadline, and
914- /// the max sentinel (gate disarmed) otherwise. Once the Request is repaid, or
915- /// auto-expired past its deadline with holders redeeming its remaining balance,
916- /// folding residual value back into the position must reopen, which is why the gate
917- /// keys on the effective repaid state rather than the operation being active.
918- function _bridgeValueSnapshot (address positionManager ) internal view returns (int256 ) {
919- RetargetterOperation storage operation_ = LibStorage.operationStorage ();
920- address request = operation_.request;
921- if (
922- request == address (0 ) || block .timestamp >= operation_.repaymentDeadline
923- || IRequestInteractions (request).isRepaid ()
924- ) {
925- return type (int256 ).max;
926- }
913+ /// net value while the operation's Request is unrepaid, and the max sentinel (gate
914+ /// disarmed) otherwise. Once the Request is repaid, or auto-expired past its deadline
915+ /// with holders redeeming its remaining balance, folding residual value back into the
916+ /// position must reopen, which is why the gate keys on the effective repaid state
917+ /// rather than the operation being active. Read through the state-mutating sync (the
918+ /// same one resolve gates on) so a past-deadline Request reads repaid here instead of
919+ /// wedging the gate on a stale flag; that makes this the only non-view step of the
920+ /// rebalance guardrails.
921+ function _bridgeValueSnapshot (address positionManager ) internal returns (int256 ) {
922+ address request = LibStorage.operationStorage ().request;
923+ if (request == address (0 ) || IRequest (request).syncRepaidStatus ()) return type (int256 ).max;
927924 return _positionValue (positionManager);
928925 }
929926
0 commit comments