fixed compound enter market logic

This commit is contained in:
Thrilok kumar 2022-03-22 23:20:23 +05:30 committed by GitHub
parent 95e390ddef
commit 98d9c158fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 9 deletions

View File

@ -42,15 +42,10 @@ abstract contract Helpers is DSMath, Basic {
/**
* @dev enter compound market
* @param _userAccount address of the EOA's account to get the user's entered markets
* @param _cotkens array of ctoken addresses to enter compound market
*/
function _enterMarkets(address _userAccount) internal {
address[] memory markets = troller.getAssetsIn(_userAccount);
for (uint i = 0; i < markets.length; i++) {
address[] memory toEnter = new address[](1);
toEnter[0] = markets[i];
troller.enterMarkets(toEnter);
}
function _enterMarkets(address[] memory _cotkens) internal {
troller.enterMarkets(_cotkens);
}
}

View File

@ -35,7 +35,7 @@ contract CompoundImportResolver is CompoundHelper {
data = getBorrowAmounts(_importInputData, data);
data = getSupplyAmounts(_importInputData, data);
_enterMarkets(_importInputData.userAccount);
_enterMarkets(_importInputData.cTokens);
// pay back user's debt using flash loan funds
_repayUserDebt(_importInputData.userAccount, data.borrowCtokens, data.borrowAmts);