Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
shafu0x committed Nov 6, 2024
1 parent d4184c8 commit a75db52
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/periphery/SwapAndDeposit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ contract SwapAndDeposit is IExtension, ReentrancyGuard {
address tokenIn,
uint256 amountIn,
uint256 minAmountOut,
bytes calldata callData,
bytes calldata swapData,
address tokenOut
) internal returns (uint256 amountOut) {
// Transfer tokenIn from the user to this contract, handling fee-on-transfer tokens
Expand All @@ -71,7 +71,7 @@ contract SwapAndDeposit is IExtension, ReentrancyGuard {
// Record balance of tokenOut before swap
uint256 tokenOutBalanceBefore = ERC20(tokenOut).balanceOf(address(this));

(bool success, ) = address(augustusSwapper).call(callData);
(bool success, ) = address(augustusSwapper).call(swapData);
require(success, SwapFailed());

// Get the amountOut by checking the balance of the tokenOut after the swap
Expand All @@ -87,14 +87,14 @@ contract SwapAndDeposit is IExtension, ReentrancyGuard {
address vault,
uint256 amountIn,
uint256 minAmountOut,
bytes calldata callData
bytes calldata swapData
) external nonReentrant {
if (dNft.ownerOf(tokenId) != msg.sender) revert NotDNftOwner();
if (!vaultLicenser.isLicensed(vault)) revert UnlicensedVault();

ERC20 asset = IVault(vault).asset();

uint256 amountSwapped = _swapToCollateral(tokenIn, amountIn, minAmountOut, callData, address(asset));
uint256 amountSwapped = _swapToCollateral(tokenIn, amountIn, minAmountOut, swapData, address(asset));

// Approve the vaultManager to spend the swapped tokens using the safe approval pattern
asset.safeApprove(address(vaultManager), 0);
Expand Down

0 comments on commit a75db52

Please sign in to comment.