mirror of
https://github.com/Instadapp/dsa-connectors.git
synced 2024-07-29 22:37:00 +00:00
fixed compound enter market logic
This commit is contained in:
parent
95e390ddef
commit
98d9c158fc
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user