mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
36 lines
1.1 KiB
Solidity
36 lines
1.1 KiB
Solidity
pragma solidity ^0.7.0;
|
|
|
|
import { DSMath } from "../../../common/math.sol";
|
|
import { Basic } from "../../../common/basic.sol";
|
|
import { ComptrollerInterface, BenqiMappingInterface } from "./interface.sol";
|
|
|
|
abstract contract Helpers is DSMath, Basic {
|
|
/**
|
|
* @dev Benqi Comptroller
|
|
*/
|
|
ComptrollerInterface internal constant troller = ComptrollerInterface(0x486Af39519B4Dc9a7fCcd318217352830E8AD9b4);
|
|
|
|
/**
|
|
* @dev Benqi Mapping
|
|
*/
|
|
BenqiMappingInterface internal constant qiMapping = BenqiMappingInterface(0xe19Fba29ac9BAACc1F584aEcD9C98B4F6fC58ba6);
|
|
|
|
/**
|
|
* @dev enter benqi market
|
|
*/
|
|
function enterMarket(address qiToken) internal {
|
|
address[] memory markets = troller.getAssetsIn(address(this));
|
|
bool isEntered = false;
|
|
for (uint i = 0; i < markets.length; i++) {
|
|
if (markets[i] == qiToken) {
|
|
isEntered = true;
|
|
}
|
|
}
|
|
if (!isEntered) {
|
|
address[] memory toEnter = new address[](1);
|
|
toEnter[0] = qiToken;
|
|
troller.enterMarkets(toEnter);
|
|
}
|
|
}
|
|
}
|