Update contracts/mainnet/connectors/morpho-aave/helpers.sol

Co-authored-by: Thrilok kumar <thrilok2000@gmail.com>
This commit is contained in:
Shriya Tyagi 2022-10-15 21:24:03 +04:00 committed by GitHub
parent 85da96b950
commit 0289824465
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 (_isETH) convertEthToWeth(_isETH, _tokenContract, _amt);
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));
}
}