From 6cb9c6d22625086ddc39a04bd350d3eefaa56d9f Mon Sep 17 00:00:00 2001 From: Samyak Jain <34437877+KaymasJain@users.noreply.github.com> Date: Fri, 19 Nov 2021 20:10:44 +0530 Subject: [PATCH] fixed bugs --- .../connectors/uniswap-sell-beta/helpers.sol | 16 +++++++++++----- .../connectors/uniswap-sell-beta/main.sol | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/contracts/arbitrum/connectors/uniswap-sell-beta/helpers.sol b/contracts/arbitrum/connectors/uniswap-sell-beta/helpers.sol index 395837fc..cd614a5e 100644 --- a/contracts/arbitrum/connectors/uniswap-sell-beta/helpers.sol +++ b/contracts/arbitrum/connectors/uniswap-sell-beta/helpers.sol @@ -1,11 +1,17 @@ pragma solidity ^0.7.6; pragma abicoder v2; -import "./interface.sol"; +import { + UniswapV3Pool, + ISwapRouter +} from "./interface.sol"; import {SqrtPriceMath} from "./libraries/SqrtPriceMath.sol"; -import "./libraries/TransferHelper.sol"; +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; + +contract Helpers { + using SafeERC20 for IERC20; -contract Helpers is ISwapRouter { ISwapRouter constant public router = ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564); @@ -53,9 +59,9 @@ contract Helpers is ISwapRouter { address recipient, uint256 amountIn ) public { - TransferHelper.safeTransferFrom(tokenIn, sender, recipient, amountIn); + IERC20(tokenIn).safeTransferFrom(sender, recipient, amountIn); - TransferHelper.safeApprove(tokenIn, address(router), amountIn); + IERC20(tokenIn).safeApprove(address(router), amountIn); } function swapSingleInput(ISwapRouter.ExactInputSingleParams memory params) diff --git a/contracts/arbitrum/connectors/uniswap-sell-beta/main.sol b/contracts/arbitrum/connectors/uniswap-sell-beta/main.sol index 87274cfd..92926f0f 100644 --- a/contracts/arbitrum/connectors/uniswap-sell-beta/main.sol +++ b/contracts/arbitrum/connectors/uniswap-sell-beta/main.sol @@ -3,7 +3,7 @@ pragma abicoder v2; import "./helpers.sol"; -abstract contract uniswapSellBeta is Helpers { +contract uniswapSellBeta is Helpers { function sell( address tokenIn, address tokenOut,