Skip to content

Commit

Permalink
fix: support multi-hop uni v2 swaps
Browse files Browse the repository at this point in the history
  • Loading branch information
gabririgo committed Sep 8, 2023
1 parent 51840dc commit c2f672b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/protocol/extensions/adapters/AUniswap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ contract AUniswap is IAUniswap, AUniswapV3NPM {
address[] calldata path,
address to
) external override returns (uint256 amountOut) {
address uniswapRouter = _preSwap(path[0], path[1]);
address uniswapRouter = _preSwap(path[0], path[path.length - 1]);

amountOut = ISwapRouter02(uniswapRouter).swapExactTokensForTokens(
amountIn,
Expand All @@ -84,7 +84,7 @@ contract AUniswap is IAUniswap, AUniswapV3NPM {
address[] calldata path,
address to
) external override returns (uint256 amountIn) {
address uniswapRouter = _preSwap(path[0], path[1]);
address uniswapRouter = _preSwap(path[0], path[path.length - 1]);

amountIn = ISwapRouter02(uniswapRouter).swapTokensForExactTokens(
amountOut,
Expand Down

0 comments on commit c2f672b

Please sign in to comment.