From c1e58f818dacf77d1c41922aadcea085dceae6e1 Mon Sep 17 00:00:00 2001 From: Anmol Arora Date: Tue, 13 May 2025 11:15:12 -0700 Subject: [PATCH 1/2] preview redeem and withdraw --- src/AutoWrapper.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AutoWrapper.sol b/src/AutoWrapper.sol index 31f9ace..ff22e41 100644 --- a/src/AutoWrapper.sol +++ b/src/AutoWrapper.sol @@ -422,7 +422,7 @@ contract AutoWrapper is BaseHook, DeltaResolver, Ownable2Step { function getWrapInputRequired( uint256 wUSDLAmount ) public view returns (int256) { - return int256(wUSDL.previewRedeem(wUSDLAmount)); + return int256(wUSDL.previewMint(wUSDLAmount)); } /** @@ -433,7 +433,7 @@ contract AutoWrapper is BaseHook, DeltaResolver, Ownable2Step { function getUnwrapInputRequired( uint256 usdlAmount ) public view returns (int256) { - return int256(wUSDL.previewDeposit(usdlAmount)); + return int256(wUSDL.previewWithdraw(usdlAmount)); } /** From 250d4abae3f52b1e3b2539afef549207a51736e8 Mon Sep 17 00:00:00 2001 From: Anmol Arora Date: Tue, 13 May 2025 13:22:32 -0700 Subject: [PATCH 2/2] bug fix --- src/AutoWrapper.sol | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/AutoWrapper.sol b/src/AutoWrapper.sol index ff22e41..c6186ce 100644 --- a/src/AutoWrapper.sol +++ b/src/AutoWrapper.sol @@ -300,8 +300,7 @@ contract AutoWrapper is BaseHook, DeltaResolver, Ownable2Step { _settle(Currency.wrap(address(wUSDL)), address(this), uint256(-wUSDLDelta)); - int128 amountUnspecified = - isExactInput ? -baseCurrencyDelta.toInt128() : (usdlBalanceAfter - usdlBalanceBefore).toInt128(); + int128 amountUnspecified = isExactInput ? -baseCurrencyDelta.toInt128() : inputAmount.toInt128(); swapDelta = toBeforeSwapDelta(-params.amountSpecified.toInt128(), amountUnspecified); }