2023-02-23 16:34:03 +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";
|
|
|
|
|
2023-02-28 23:50:17 +00:00
|
|
|
abstract contract Helpers is Stores, Basic {
|
2023-02-23 16:34:03 +00:00
|
|
|
IMorphoCore public constant MORPHO_AAVE_V3 =
|
2023-05-10 11:26:40 +00:00
|
|
|
IMorphoCore(0x33333aea097c193e66081E930c33020272b33333);
|
2023-02-24 01:21:01 +00:00
|
|
|
|
2023-05-10 11:26:40 +00:00
|
|
|
uint256 public max_iteration = 4;
|
2023-02-23 16:34:03 +00:00
|
|
|
|
|
|
|
function _performEthToWethConversion(
|
|
|
|
address _tokenAddress,
|
|
|
|
uint256 _amount,
|
|
|
|
uint256 _getId
|
|
|
|
) internal returns (TokenInterface _tokenContract, uint256 _amt) {
|
|
|
|
_amt = getUint(_getId, _amount);
|
|
|
|
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
}
|
2023-02-24 03:19:23 +00:00
|
|
|
|
2023-02-28 23:50:17 +00:00
|
|
|
function setMaxIteration(uint256 _iter) external {
|
2023-02-24 03:19:23 +00:00
|
|
|
max_iteration = _iter;
|
|
|
|
}
|
2023-02-23 16:34:03 +00:00
|
|
|
}
|