2021-02-07 15:31:36 +00:00
|
|
|
pragma solidity ^0.7.0;
|
2021-02-05 17:07:07 +00:00
|
|
|
|
|
|
|
import { DSMath } from "../../common/math.sol";
|
|
|
|
import { Basic } from "../../common/basic.sol";
|
|
|
|
|
2021-02-05 18:33:49 +00:00
|
|
|
abstract contract Helpers is DSMath, Basic {
|
2021-02-05 17:07:07 +00:00
|
|
|
/**
|
|
|
|
* @dev Return Compound Comptroller Address
|
|
|
|
*/
|
|
|
|
function getComptrollerAddress() internal pure returns (address) {
|
|
|
|
return 0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dev Return COMP Token Address.
|
|
|
|
*/
|
|
|
|
function getCompTokenAddress() internal pure returns (address) {
|
|
|
|
return 0xc00e94Cb662C3520282E6f5717214004A7f26888;
|
|
|
|
}
|
|
|
|
|
|
|
|
function mergeTokenArr(address[] memory supplyTokens, address[] memory borrowTokens)
|
|
|
|
internal
|
|
|
|
view
|
|
|
|
returns (address[] memory ctokens, bool isBorrow, bool isSupply)
|
|
|
|
{
|
|
|
|
uint _supplyLen = supplyTokens.length;
|
|
|
|
uint _borrowLen = borrowTokens.length;
|
|
|
|
uint _totalLen = add(_supplyLen, _borrowLen);
|
|
|
|
ctokens = new address[](_totalLen);
|
|
|
|
isBorrow;
|
|
|
|
isSupply;
|
|
|
|
if(_supplyLen > 0) {
|
|
|
|
for (uint i = 0; i < _supplyLen; i++) {
|
2021-02-08 13:58:28 +00:00
|
|
|
ctokens[i] = instaMapping.cTokenMapping(supplyTokens[i]);
|
2021-02-05 17:07:07 +00:00
|
|
|
}
|
|
|
|
isSupply = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(_borrowLen > 0) {
|
|
|
|
for (uint i = 0; i < _borrowLen; i++) {
|
2021-02-08 13:58:28 +00:00
|
|
|
ctokens[_supplyLen + i] = instaMapping.cTokenMapping(borrowTokens[i]);
|
2021-02-05 17:07:07 +00:00
|
|
|
}
|
|
|
|
isBorrow = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|