2022-10-05 01:49:52 +00:00
|
|
|
//SPDX-License-Identifier: MIT
|
|
|
|
pragma solidity ^0.7.0;
|
|
|
|
pragma experimental ABIEncoderV2;
|
|
|
|
import "./interface.sol";
|
|
|
|
import "../../common/stores.sol";
|
|
|
|
import "../../common/basic.sol";
|
|
|
|
import "../../common/interfaces.sol";
|
|
|
|
|
|
|
|
abstract contract Helpers is Stores, Basic {
|
2022-10-15 04:17:36 +00:00
|
|
|
IMorphoCore public constant MORPHO_AAVE =
|
2022-10-05 01:49:52 +00:00
|
|
|
IMorphoCore(0x777777c9898D384F785Ee44Acfe945efDFf5f3E0);
|
|
|
|
|
2022-10-15 04:17:36 +00:00
|
|
|
IMorphoAaveLens public constant MORPHO_AAVE_LENS =
|
2022-10-12 02:27:45 +00:00
|
|
|
IMorphoAaveLens(0x507fA343d0A90786d86C7cd885f5C49263A91FF4);
|
2022-10-15 04:17:36 +00:00
|
|
|
|
|
|
|
function _performEthToWethConversion(
|
|
|
|
address _tokenAddress,
|
|
|
|
uint256 _amount,
|
|
|
|
uint256 _getId
|
|
|
|
) internal returns (TokenInterface _tokenContract, uint256 _amt) {
|
|
|
|
_amt = getUint(_getId, _amount);
|
|
|
|
|
2022-10-15 17:24:03 +00:00
|
|
|
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));
|
2022-10-15 04:17:36 +00:00
|
|
|
}
|
2022-10-18 03:02:00 +00:00
|
|
|
}
|
2022-10-05 01:49:52 +00:00
|
|
|
}
|