Fixed memory usage

This commit is contained in:
dhadrien 2021-02-03 15:57:34 +01:00
parent 9b509eadbb
commit 9e62528b98

View File

@ -349,13 +349,15 @@ abstract contract BaseUniswapAdapter is FlashLoanReceiverBase, IBaseUniswapAdapt
if (reserveIn == reserveOut) { if (reserveIn == reserveOut) {
uint256 reserveDecimals = _getDecimals(reserveIn); uint256 reserveDecimals = _getDecimals(reserveIn);
address[] memory _reserveIn = new address[](1);
_reserveIn[0] = reserveIn;
return return
AmountCalc( AmountCalc(
finalAmountIn, finalAmountIn,
finalAmountIn.mul(10**18).div(amountIn), finalAmountIn.mul(10**18).div(amountIn),
_calcUsdValue(reserveIn, amountIn, reserveDecimals), _calcUsdValue(reserveIn, amountIn, reserveDecimals),
_calcUsdValue(reserveIn, finalAmountIn, reserveDecimals), _calcUsdValue(reserveIn, finalAmountIn, reserveDecimals),
[reserveIn] _reserveIn
); );
} }
@ -437,13 +439,15 @@ abstract contract BaseUniswapAdapter is FlashLoanReceiverBase, IBaseUniswapAdapt
// Add flash loan fee // Add flash loan fee
uint256 amountIn = amountOut.add(amountOut.mul(FLASHLOAN_PREMIUM_TOTAL).div(10000)); uint256 amountIn = amountOut.add(amountOut.mul(FLASHLOAN_PREMIUM_TOTAL).div(10000));
uint256 reserveDecimals = _getDecimals(reserveIn); uint256 reserveDecimals = _getDecimals(reserveIn);
address[] memory _reserveIn = new address[](1);
_reserveIn[0] = reserveIn;
return return
AmountCalc( AmountCalc(
amountIn, amountIn,
amountOut.mul(10**18).div(amountIn), amountOut.mul(10**18).div(amountIn),
_calcUsdValue(reserveIn, amountIn, reserveDecimals), _calcUsdValue(reserveIn, amountIn, reserveDecimals),
_calcUsdValue(reserveIn, amountOut, reserveDecimals), _calcUsdValue(reserveIn, amountOut, reserveDecimals),
[reserveIn] _reserveIn
); );
} }