diff --git a/contracts/adapters/BaseUniswapAdapter.sol b/contracts/adapters/BaseUniswapAdapter.sol index e5e779f7..7a727b7d 100644 --- a/contracts/adapters/BaseUniswapAdapter.sol +++ b/contracts/adapters/BaseUniswapAdapter.sol @@ -335,8 +335,8 @@ contract BaseUniswapAdapter { uint256[] memory amounts = UNISWAP_ROUTER.getAmountsIn(amountOut, path); - // Subtract flash loan fee - uint256 finalAmountIn = amounts[0].sub(amounts[0].mul(FLASHLOAN_PREMIUM_TOTAL).div(10000)); + // Add flash loan fee + uint256 finalAmountIn = amounts[0].add(amounts[0].mul(FLASHLOAN_PREMIUM_TOTAL).div(10000)); uint256 reserveInDecimals = _getDecimals(reserveIn); uint256 reserveOutDecimals = _getDecimals(reserveOut); diff --git a/test/uniswapAdapters.spec.ts b/test/uniswapAdapters.spec.ts index 2a086fb8..6f40530f 100644 --- a/test/uniswapAdapters.spec.ts +++ b/test/uniswapAdapters.spec.ts @@ -152,7 +152,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => { const amountIn = parseEther('1'); const flashloanPremium = amountIn.mul(9).div(10000); - const amountToSwap = amountIn.sub(flashloanPremium); + const amountToSwap = amountIn.add(flashloanPremium); const wethPrice = await oracle.getAssetPrice(weth.address); const daiPrice = await oracle.getAssetPrice(dai.address); @@ -197,7 +197,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => { const amountIn = parseEther('10'); const flashloanPremium = amountIn.mul(9).div(10000); - const amountToSwap = amountIn.sub(flashloanPremium); + const amountToSwap = amountIn.add(flashloanPremium); const aavePrice = await oracle.getAssetPrice(aave.address); const usdcPrice = await oracle.getAssetPrice(usdc.address); @@ -241,7 +241,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => { }); }); - describe('UniswapLiquiditySwapAdapter', () => { + describe.only('UniswapLiquiditySwapAdapter', () => { describe('constructor', () => { it('should deploy with correct parameters', async () => { const {addressesProvider} = testEnv; @@ -1959,7 +1959,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => { }); }); - describe('UniswapRepayAdapter', () => { + describe.only('UniswapRepayAdapter', () => { describe('constructor', () => { it('should deploy with correct parameters', async () => { const {addressesProvider} = testEnv;