From d6af759404a0e7e3b5cfc3343826e97d958e3221 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Mon, 3 May 2021 22:20:26 +0530 Subject: [PATCH] Fixed paraswp approve issue --- contracts/polygon/connectors/paraswap/helpers.sol | 4 +++- contracts/polygon/connectors/paraswap/interface.sol | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 contracts/polygon/connectors/paraswap/interface.sol diff --git a/contracts/polygon/connectors/paraswap/helpers.sol b/contracts/polygon/connectors/paraswap/helpers.sol index 4edcc657..3a54f10f 100644 --- a/contracts/polygon/connectors/paraswap/helpers.sol +++ b/contracts/polygon/connectors/paraswap/helpers.sol @@ -3,6 +3,7 @@ pragma solidity ^0.7.0; import { DSMath } from "../../common/math.sol"; import { Basic } from "../../common/basic.sol"; import { TokenInterface } from "../../common/interfaces.sol"; +import { AugustusSwapperInterface } from "./interface.sol"; abstract contract Helpers is DSMath, Basic { @@ -43,7 +44,8 @@ abstract contract Helpers is DSMath, Basic { if (address(_sellAddr) == maticAddr) { maticAmt = swapData._sellAmt; } else { - TokenInterface(_sellAddr).approve(paraswap, swapData._sellAmt); + address tokenProxy = AugustusSwapperInterface(paraswap).getTokenTransferProxy(); + TokenInterface(_sellAddr).approve(tokenProxy, swapData._sellAmt); } swapData._buyAmt = _swapHelper(swapData, maticAmt); diff --git a/contracts/polygon/connectors/paraswap/interface.sol b/contracts/polygon/connectors/paraswap/interface.sol new file mode 100644 index 00000000..a63b4c77 --- /dev/null +++ b/contracts/polygon/connectors/paraswap/interface.sol @@ -0,0 +1,5 @@ +pragma solidity ^0.7.0; + +interface AugustusSwapperInterface { + function getTokenTransferProxy() external view returns (address); +} \ No newline at end of file