mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
Fix flash loan fee usage in _getAmountsIn
This commit is contained in:
parent
101c775789
commit
d0d0e869d0
|
@ -335,8 +335,8 @@ contract BaseUniswapAdapter {
|
||||||
|
|
||||||
uint256[] memory amounts = UNISWAP_ROUTER.getAmountsIn(amountOut, path);
|
uint256[] memory amounts = UNISWAP_ROUTER.getAmountsIn(amountOut, path);
|
||||||
|
|
||||||
// Subtract flash loan fee
|
// Add flash loan fee
|
||||||
uint256 finalAmountIn = amounts[0].sub(amounts[0].mul(FLASHLOAN_PREMIUM_TOTAL).div(10000));
|
uint256 finalAmountIn = amounts[0].add(amounts[0].mul(FLASHLOAN_PREMIUM_TOTAL).div(10000));
|
||||||
|
|
||||||
uint256 reserveInDecimals = _getDecimals(reserveIn);
|
uint256 reserveInDecimals = _getDecimals(reserveIn);
|
||||||
uint256 reserveOutDecimals = _getDecimals(reserveOut);
|
uint256 reserveOutDecimals = _getDecimals(reserveOut);
|
||||||
|
|
|
@ -152,7 +152,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
||||||
|
|
||||||
const amountIn = parseEther('1');
|
const amountIn = parseEther('1');
|
||||||
const flashloanPremium = amountIn.mul(9).div(10000);
|
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 wethPrice = await oracle.getAssetPrice(weth.address);
|
||||||
const daiPrice = await oracle.getAssetPrice(dai.address);
|
const daiPrice = await oracle.getAssetPrice(dai.address);
|
||||||
|
@ -197,7 +197,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
||||||
|
|
||||||
const amountIn = parseEther('10');
|
const amountIn = parseEther('10');
|
||||||
const flashloanPremium = amountIn.mul(9).div(10000);
|
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 aavePrice = await oracle.getAssetPrice(aave.address);
|
||||||
const usdcPrice = await oracle.getAssetPrice(usdc.address);
|
const usdcPrice = await oracle.getAssetPrice(usdc.address);
|
||||||
|
@ -241,7 +241,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('UniswapLiquiditySwapAdapter', () => {
|
describe.only('UniswapLiquiditySwapAdapter', () => {
|
||||||
describe('constructor', () => {
|
describe('constructor', () => {
|
||||||
it('should deploy with correct parameters', async () => {
|
it('should deploy with correct parameters', async () => {
|
||||||
const {addressesProvider} = testEnv;
|
const {addressesProvider} = testEnv;
|
||||||
|
@ -1959,7 +1959,7 @@ makeSuite('Uniswap adapters', (testEnv: TestEnv) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('UniswapRepayAdapter', () => {
|
describe.only('UniswapRepayAdapter', () => {
|
||||||
describe('constructor', () => {
|
describe('constructor', () => {
|
||||||
it('should deploy with correct parameters', async () => {
|
it('should deploy with correct parameters', async () => {
|
||||||
const {addressesProvider} = testEnv;
|
const {addressesProvider} = testEnv;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user