Skip to content

Commit

Permalink
Audit L8: Possible loss of funds with price limited swaps through Dep…
Browse files Browse the repository at this point in the history
…ositHelper
  • Loading branch information
0xnavigator committed May 8, 2023
1 parent 3578b12 commit 87257c0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DepositHelper.sol
Expand Up @@ -83,10 +83,10 @@ contract DepositHelper {
amountOut = IUniswapV3Router(UNISWAP_V3_ROUTER).exactInputSingle(_swapParams);

if (_swapParams.tokenIn == TOKEN_0) {
_initialAmount0 -= _swapParams.amountIn;
_initialAmount0 = IERC20(TOKEN_0).balanceOf(address(this));
_initialAmount1 += amountOut;
} else {
_initialAmount1 -= _swapParams.amountIn;
_initialAmount1 = IERC20(TOKEN_1).balanceOf(address(this));
_initialAmount0 += amountOut;
}
}
Expand Down
1 change: 1 addition & 0 deletions test/DepositHelper.t.sol
Expand Up @@ -208,6 +208,7 @@ contract DepositHelperTest is ABaseExit10Test {
uint256 usdcLeft = ERC20(usdc).balanceOf(address(depositHelper));
console.log('Only', swapAmount0 - usdcLeft, 'USDC has been swapped and used to mint bonds');
console.log('USDC Left into DepositHelper:', usdcLeft);
assertEq(usdcLeft, 0, 'Check usdcLeft == 0');
}

function _getSwapParams(
Expand Down

0 comments on commit 87257c0

Please sign in to comment.