Fix flash loan fee usage in _getAmountsIn

This commit is contained in:
Gerardo Nardelli 2020-11-13 12:30:14 -03:00
parent 101c775789
commit d0d0e869d0
2 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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;