mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
- Fixed issue with variadic length of amounts depending on path
This commit is contained in:
parent
41efe9e811
commit
05dbfeccb3
|
@ -174,9 +174,9 @@ abstract contract BaseUniswapAdapter is FlashLoanReceiverBase, IBaseUniswapAdapt
|
||||||
block.timestamp
|
block.timestamp
|
||||||
);
|
);
|
||||||
|
|
||||||
emit Swapped(assetToSwapFrom, assetToSwapTo, amounts[0], amounts[1]);
|
emit Swapped(assetToSwapFrom, assetToSwapTo, amounts[0], amounts[amounts.length-1]);
|
||||||
|
|
||||||
return amounts[1];
|
return amounts[amounts.length-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -222,7 +222,7 @@ abstract contract BaseUniswapAdapter is FlashLoanReceiverBase, IBaseUniswapAdapt
|
||||||
block.timestamp
|
block.timestamp
|
||||||
);
|
);
|
||||||
|
|
||||||
emit Swapped(assetToSwapFrom, assetToSwapTo, amounts[0], amounts[1]);
|
emit Swapped(assetToSwapFrom, assetToSwapTo, amounts[0], amounts[amounts.length-1]);
|
||||||
|
|
||||||
return amounts[0];
|
return amounts[0];
|
||||||
}
|
}
|
||||||
|
@ -357,15 +357,15 @@ abstract contract BaseUniswapAdapter is FlashLoanReceiverBase, IBaseUniswapAdapt
|
||||||
|
|
||||||
uint256 outPerInPrice =
|
uint256 outPerInPrice =
|
||||||
finalAmountIn.mul(10**18).mul(10**reserveOutDecimals).div(
|
finalAmountIn.mul(10**18).mul(10**reserveOutDecimals).div(
|
||||||
amounts[1].mul(10**reserveInDecimals)
|
amounts[amounts.length-1].mul(10**reserveInDecimals)
|
||||||
);
|
);
|
||||||
|
|
||||||
return
|
return
|
||||||
AmountCalc(
|
AmountCalc(
|
||||||
amounts[1],
|
amounts[amounts.length-1],
|
||||||
outPerInPrice,
|
outPerInPrice,
|
||||||
_calcUsdValue(reserveIn, amountIn, reserveInDecimals),
|
_calcUsdValue(reserveIn, amountIn, reserveInDecimals),
|
||||||
_calcUsdValue(reserveOut, amounts[1], reserveOutDecimals),
|
_calcUsdValue(reserveOut, amounts[amounts.length-1], reserveOutDecimals),
|
||||||
(pathWithWeth[0] != address(0) ? pathWithWeth : simplePath)
|
(pathWithWeth[0] != address(0) ? pathWithWeth : simplePath)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user