mirror of
https://github.com/Instadapp/aave-protocol-v2.git
synced 2024-07-29 21:47:30 +00:00
- Fixed _getAmountsInAndPath() and _getAmountsOutData()
This commit is contained in:
parent
5fdb479333
commit
a84cfdabe2
|
@ -343,16 +343,20 @@ abstract contract BaseUniswapAdapter is FlashLoanReceiverBase, IBaseUniswapAdapt
|
||||||
uint256[] memory amountsWithWeth;
|
uint256[] memory amountsWithWeth;
|
||||||
|
|
||||||
address[] memory pathWithWeth = new address[](3);
|
address[] memory pathWithWeth = new address[](3);
|
||||||
pathWithWeth[0] = reserveIn;
|
if (reserveIn != WETH_ADDRESS && reserveOut != WETH_ADDRESS) {
|
||||||
pathWithWeth[1] = WETH_ADDRESS;
|
pathWithWeth[0] = reserveIn;
|
||||||
pathWithWeth[2] = reserveOut;
|
pathWithWeth[1] = WETH_ADDRESS;
|
||||||
|
pathWithWeth[2] = reserveOut;
|
||||||
|
|
||||||
try UNISWAP_ROUTER.getAmountsOut(finalAmountIn, pathWithWeth) returns (
|
try UNISWAP_ROUTER.getAmountsOut(finalAmountIn, pathWithWeth) returns (
|
||||||
uint256[] memory resultsWithWeth
|
uint256[] memory resultsWithWeth
|
||||||
) {
|
) {
|
||||||
amountsWithWeth = resultsWithWeth;
|
amountsWithWeth = resultsWithWeth;
|
||||||
} catch {
|
} catch {
|
||||||
amountsWithWeth = new uint256[](2);
|
amountsWithWeth = new uint256[](3);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
amountsWithWeth = new uint256[](3);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint256 bestAmountOut;
|
uint256 bestAmountOut;
|
||||||
|
@ -447,16 +451,21 @@ abstract contract BaseUniswapAdapter is FlashLoanReceiverBase, IBaseUniswapAdapt
|
||||||
uint256[] memory amountsWithoutWeth;
|
uint256[] memory amountsWithoutWeth;
|
||||||
uint256[] memory amountsWithWeth;
|
uint256[] memory amountsWithWeth;
|
||||||
address[] memory pathWithWeth = new address[](3);
|
address[] memory pathWithWeth = new address[](3);
|
||||||
pathWithWeth[0] = reserveIn;
|
|
||||||
pathWithWeth[1] = WETH_ADDRESS;
|
|
||||||
pathWithWeth[2] = reserveOut;
|
|
||||||
|
|
||||||
try UNISWAP_ROUTER.getAmountsIn(amountOut, pathWithWeth) returns (
|
if (reserveIn != WETH_ADDRESS && reserveOut != WETH_ADDRESS) {
|
||||||
uint256[] memory resultsWithWeth
|
pathWithWeth[0] = reserveIn;
|
||||||
) {
|
pathWithWeth[1] = WETH_ADDRESS;
|
||||||
amountsWithWeth = resultsWithWeth;
|
pathWithWeth[2] = reserveOut;
|
||||||
} catch {
|
|
||||||
return (new uint256[](2), new address[](2));
|
try UNISWAP_ROUTER.getAmountsIn(amountOut, pathWithWeth) returns (
|
||||||
|
uint256[] memory resultsWithWeth
|
||||||
|
) {
|
||||||
|
amountsWithWeth = resultsWithWeth;
|
||||||
|
} catch {
|
||||||
|
return (new uint256[](2), new address[](2));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
amountsWithWeth = new uint256[](3);
|
||||||
}
|
}
|
||||||
|
|
||||||
try UNISWAP_ROUTER.getAmountsIn(amountOut, simplePath) returns (
|
try UNISWAP_ROUTER.getAmountsIn(amountOut, simplePath) returns (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user