mirror of
https://github.com/Instadapp/dsa-connectors-old.git
synced 2024-07-29 22:47:46 +00:00
Fix aave deposit
This commit is contained in:
parent
1a4525ace2
commit
d78bc8f8be
|
@ -682,6 +682,7 @@ contract AaveV1Helpers is CompoundHelpers {
|
||||||
|
|
||||||
function _aaveV1DepositOne(
|
function _aaveV1DepositOne(
|
||||||
AaveV1Interface aave,
|
AaveV1Interface aave,
|
||||||
|
AaveV1CoreInterface aaveCore,
|
||||||
uint fee,
|
uint fee,
|
||||||
address token,
|
address token,
|
||||||
uint amt
|
uint amt
|
||||||
|
@ -696,7 +697,7 @@ contract AaveV1Helpers is CompoundHelpers {
|
||||||
ethAmt = _amt;
|
ethAmt = _amt;
|
||||||
} else {
|
} else {
|
||||||
TokenInterface tokenContract = TokenInterface(token);
|
TokenInterface tokenContract = TokenInterface(token);
|
||||||
tokenContract.approve(address(aave), _amt);
|
tokenContract.approve(address(aaveCore), _amt);
|
||||||
}
|
}
|
||||||
|
|
||||||
transferFees(token, feeAmt);
|
transferFees(token, feeAmt);
|
||||||
|
@ -710,13 +711,14 @@ contract AaveV1Helpers is CompoundHelpers {
|
||||||
|
|
||||||
function _aaveV1Deposit(
|
function _aaveV1Deposit(
|
||||||
AaveV1Interface aave,
|
AaveV1Interface aave,
|
||||||
|
AaveV1CoreInterface aaveCore,
|
||||||
uint length,
|
uint length,
|
||||||
uint fee,
|
uint fee,
|
||||||
address[] memory tokens,
|
address[] memory tokens,
|
||||||
uint[] memory amts
|
uint[] memory amts
|
||||||
) internal {
|
) internal {
|
||||||
for (uint i = 0; i < length; i++) {
|
for (uint i = 0; i < length; i++) {
|
||||||
_aaveV1DepositOne(aave, fee, tokens[i], amts[i]);
|
_aaveV1DepositOne(aave, aaveCore, fee, tokens[i], amts[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1186,7 +1188,7 @@ contract RefinanceResolver is MakerHelpers {
|
||||||
);
|
);
|
||||||
_aaveV2Payback(aaveV2, aaveData, length, data.tokens, paybackAmts, data.paybackRateModes);
|
_aaveV2Payback(aaveV2, aaveData, length, data.tokens, paybackAmts, data.paybackRateModes);
|
||||||
depositAmts = _aaveV2Withdraw(aaveV2, aaveData, length, data.tokens, data.withdrawAmts);
|
depositAmts = _aaveV2Withdraw(aaveV2, aaveData, length, data.tokens, data.withdrawAmts);
|
||||||
_aaveV1Deposit(aaveV1, length, data.collateralFee, data.tokens, depositAmts);
|
_aaveV1Deposit(aaveV1, aaveCore, length, data.collateralFee, data.tokens, depositAmts);
|
||||||
} else if (data.source == 2 && data.target == 3) {
|
} else if (data.source == 2 && data.target == 3) {
|
||||||
_compEnterMarkets(length, data.tokens);
|
_compEnterMarkets(length, data.tokens);
|
||||||
|
|
||||||
|
@ -1214,7 +1216,7 @@ contract RefinanceResolver is MakerHelpers {
|
||||||
);
|
);
|
||||||
_compPayback(length, data.tokens, paybackAmts);
|
_compPayback(length, data.tokens, paybackAmts);
|
||||||
depositAmts = _compWithdraw(length, data.tokens, data.withdrawAmts);
|
depositAmts = _compWithdraw(length, data.tokens, data.withdrawAmts);
|
||||||
_aaveV1Deposit(aaveV1, length, data.collateralFee, data.tokens, depositAmts);
|
_aaveV1Deposit(aaveV1, aaveCore, length, data.collateralFee, data.tokens, depositAmts);
|
||||||
} else if (data.source == 3 && data.target == 2) {
|
} else if (data.source == 3 && data.target == 2) {
|
||||||
paybackAmts = _aaveV2Borrow(
|
paybackAmts = _aaveV2Borrow(
|
||||||
aaveV2,
|
aaveV2,
|
||||||
|
@ -1253,7 +1255,7 @@ contract RefinanceResolver is MakerHelpers {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (data.target == 1) {
|
if (data.target == 1) {
|
||||||
_aaveV1DepositOne(aaveV1, data.collateralFee, data.token, depositAmt);
|
_aaveV1DepositOne(aaveV1, aaveCore, data.collateralFee, data.token, depositAmt);
|
||||||
_aaveV1BorrowOne(aaveV1, data.debtFee, 2, dai, borrowAmt, data.borrowRateMode, 1);
|
_aaveV1BorrowOne(aaveV1, data.debtFee, 2, dai, borrowAmt, data.borrowRateMode, 1);
|
||||||
} else if (data.target == 2) {
|
} else if (data.target == 2) {
|
||||||
_aaveV2DepositOne(aaveV2, aaveData, data.collateralFee, data.token, depositAmt);
|
_aaveV2DepositOne(aaveV2, aaveData, data.collateralFee, data.token, depositAmt);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user