From 0289824465173c4a920dff6b0cade72ce84d082e Mon Sep 17 00:00:00 2001 From: Shriya Tyagi <47134275+shriyatyagii@users.noreply.github.com> Date: Sat, 15 Oct 2022 21:24:03 +0400 Subject: [PATCH] Update contracts/mainnet/connectors/morpho-aave/helpers.sol Co-authored-by: Thrilok kumar --- .../connectors/morpho-aave/helpers.sol | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/contracts/mainnet/connectors/morpho-aave/helpers.sol b/contracts/mainnet/connectors/morpho-aave/helpers.sol index 97b6b4a8..a3a4c3bf 100644 --- a/contracts/mainnet/connectors/morpho-aave/helpers.sol +++ b/contracts/mainnet/connectors/morpho-aave/helpers.sol @@ -20,18 +20,12 @@ abstract contract Helpers is Stores, Basic { ) internal returns (TokenInterface _tokenContract, uint256 _amt) { _amt = getUint(_getId, _amount); - bool _isETH = _tokenAddress == ethAddr; - - _tokenContract = _isETH - ? TokenInterface(wethAddr) - : TokenInterface(_tokenAddress); - - if (_amt == uint256(-1)) { - _amt = _isETH - ? address(this).balance - : _tokenContract.balanceOf(address(this)); + if (_tokenAddress == ethAddr) { + _tokenContract = TokenInterface(wethAddr); + if (_amt == uint256(-1)) _amt = address(this).balance; + convertEthToWeth(true, _tokenContract, _amt); + } else { + _tokenContract = TokenInterface(_tokenAddress); + if (_amt == uint256(-1)) _amt = _tokenContract.balanceOf(address(this)); } - - if (_isETH) convertEthToWeth(_isETH, _tokenContract, _amt); - } }