mirror of
				https://github.com/Instadapp/dsa-connectors-old.git
				synced 2024-07-29 22:47:46 +00:00 
			
		
		
		
	Update logic
This commit is contained in:
		
							parent
							
								
									fce46257cc
								
							
						
					
					
						commit
						e0ee6b8752
					
				|  | @ -560,15 +560,17 @@ contract CompoundHelpers is Helpers { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _compBorrowOne(uint fee, address token, uint amt) internal { |     function _compBorrowOne(uint fee, address token, uint amt) internal { | ||||||
|         address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token); |         if (amt > 0) { | ||||||
|         uint feeAmt = wmul(amt, fee); |             address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token); | ||||||
|         uint _amt = add(amt, feeAmt); |             uint feeAmt = wmul(amt, fee); | ||||||
|  |             uint _amt = add(amt, feeAmt); | ||||||
| 
 | 
 | ||||||
|         require(CTokenInterface(cToken).borrow(_amt) == 0, "borrow-failed-collateral?"); |             require(CTokenInterface(cToken).borrow(_amt) == 0, "borrow-failed-collateral?"); | ||||||
|         if (token == getEthAddr()) { |             if (token == getEthAddr()) { | ||||||
|             feeCollector.transfer(feeAmt); |                 feeCollector.transfer(feeAmt); | ||||||
|         } else { |             } else { | ||||||
|             TokenInterface(token).transfer(feeCollector, feeAmt); |                 TokenInterface(token).transfer(feeCollector, feeAmt); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -579,26 +581,26 @@ contract CompoundHelpers is Helpers { | ||||||
|         uint[] memory amts |         uint[] memory amts | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _compBorrowOne(fee, tokens[i], amts[i]); | ||||||
|                 _compBorrowOne(fee, tokens[i], amts[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _compDepositOne(uint fee, address token, uint amt) internal { |     function _compDepositOne(uint fee, address token, uint amt) internal { | ||||||
|         address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token); |         if (amt > 0) { | ||||||
|  |             address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token); | ||||||
| 
 | 
 | ||||||
|         uint feeAmt = wmul(amt, fee); |             uint feeAmt = wmul(amt, fee); | ||||||
|         uint _amt = sub(amt, feeAmt); |             uint _amt = sub(amt, feeAmt); | ||||||
| 
 | 
 | ||||||
|         if (token != getEthAddr()) { |             if (token != getEthAddr()) { | ||||||
|             TokenInterface tokenContract = TokenInterface(token); |                 TokenInterface tokenContract = TokenInterface(token); | ||||||
|             tokenContract.approve(cToken, _amt); |                 tokenContract.approve(cToken, _amt); | ||||||
|             require(CTokenInterface(cToken).mint(_amt) == 0, "deposit-failed"); |                 require(CTokenInterface(cToken).mint(_amt) == 0, "deposit-failed"); | ||||||
|             tokenContract.transfer(feeCollector, feeAmt); |                 tokenContract.transfer(feeCollector, feeAmt); | ||||||
|         } else { |             } else { | ||||||
|             CETHInterface(cToken).mint.value(_amt)(); |                 CETHInterface(cToken).mint.value(_amt)(); | ||||||
|             feeCollector.transfer(feeAmt); |                 feeCollector.transfer(feeAmt); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -609,19 +611,19 @@ contract CompoundHelpers is Helpers { | ||||||
|         uint[] memory amts |         uint[] memory amts | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _compDepositOne(fee, tokens[i], amts[i]); | ||||||
|                 _compDepositOne(fee, tokens[i], amts[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _compWithdrawOne(address token, uint amt) internal { |     function _compWithdrawOne(address token, uint amt) internal { | ||||||
|         address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token); |         if (amt > 0) { | ||||||
|         CTokenInterface cTokenContract = CTokenInterface(cToken); |             address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token); | ||||||
|         if (amt == uint(-1)) { |             CTokenInterface cTokenContract = CTokenInterface(cToken); | ||||||
|             amt = cTokenContract.balanceOf(address(this)); |             if (amt == uint(-1)) { | ||||||
|  |                 amt = cTokenContract.balanceOf(address(this)); | ||||||
|  |             } | ||||||
|  |             require(cTokenContract.redeemUnderlying(amt) == 0, "withdraw-failed"); | ||||||
|         } |         } | ||||||
|         require(cTokenContract.redeemUnderlying(amt) == 0, "withdraw-failed"); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _compWithdraw( |     function _compWithdraw( | ||||||
|  | @ -630,25 +632,25 @@ contract CompoundHelpers is Helpers { | ||||||
|         uint[] memory amts |         uint[] memory amts | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _compWithdrawOne(tokens[i], amts[i]); | ||||||
|                 _compWithdrawOne(tokens[i], amts[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _compPaybackOne(address token, uint amt) internal { |     function _compPaybackOne(address token, uint amt) internal { | ||||||
|         address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token); |         if (amt > 0) { | ||||||
|         CTokenInterface cTokenContract = CTokenInterface(cToken); |             address cToken = InstaMapping(getMappingAddr()).cTokenMapping(token); | ||||||
|  |             CTokenInterface cTokenContract = CTokenInterface(cToken); | ||||||
| 
 | 
 | ||||||
|         if (amt == uint(-1)) { |             if (amt == uint(-1)) { | ||||||
|             amt = cTokenContract.borrowBalanceCurrent(address(this)); |                 amt = cTokenContract.borrowBalanceCurrent(address(this)); | ||||||
|         } |             } | ||||||
|         if (token != getEthAddr()) { |             if (token != getEthAddr()) { | ||||||
|             TokenInterface tokenContract = TokenInterface(token); |                 TokenInterface tokenContract = TokenInterface(token); | ||||||
|             tokenContract.approve(cToken, amt); |                 tokenContract.approve(cToken, amt); | ||||||
|             require(cTokenContract.repayBorrow(amt) == 0, "repay-failed."); |                 require(cTokenContract.repayBorrow(amt) == 0, "repay-failed."); | ||||||
|         } else { |             } else { | ||||||
|             CETHInterface(cToken).repayBorrow.value(amt)(); |                 CETHInterface(cToken).repayBorrow.value(amt)(); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -658,9 +660,7 @@ contract CompoundHelpers is Helpers { | ||||||
|         uint[] memory amts |         uint[] memory amts | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _compPaybackOne(tokens[i], amts[i]); | ||||||
|                 _compPaybackOne(tokens[i], amts[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -674,14 +674,16 @@ contract AaveV1Helpers is CompoundHelpers { | ||||||
|         uint amt, |         uint amt, | ||||||
|         uint rateMode |         uint rateMode | ||||||
|     ) internal { |     ) internal { | ||||||
|         uint feeAmt = wmul(amt, fee); |         if (amt > 0) { | ||||||
|         uint _amt = add(amt, feeAmt); |             uint feeAmt = wmul(amt, fee); | ||||||
|  |             uint _amt = add(amt, feeAmt); | ||||||
| 
 | 
 | ||||||
|         aave.borrow(token, _amt, rateMode, getReferralCode()); |             aave.borrow(token, _amt, rateMode, getReferralCode()); | ||||||
|         if (token == getEthAddr()) { |             if (token == getEthAddr()) { | ||||||
|             feeCollector.transfer(feeAmt); |                 feeCollector.transfer(feeAmt); | ||||||
|         } else { |             } else { | ||||||
|             TokenInterface(token).transfer(feeCollector, feeAmt); |                 TokenInterface(token).transfer(feeCollector, feeAmt); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -694,9 +696,7 @@ contract AaveV1Helpers is CompoundHelpers { | ||||||
|         uint[] memory rateModes |         uint[] memory rateModes | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _aaveV1BorrowOne(aave, fee, tokens[i], amts[i], rateModes[i]); | ||||||
|                 _aaveV1BorrowOne(aave, fee, tokens[i], amts[i], rateModes[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -706,24 +706,26 @@ contract AaveV1Helpers is CompoundHelpers { | ||||||
|         address token, |         address token, | ||||||
|         uint amt |         uint amt | ||||||
|     ) internal { |     ) internal { | ||||||
|         uint ethAmt; |         if (amt > 0) { | ||||||
|         uint feeAmt = wmul(amt, fee); |             uint ethAmt; | ||||||
|         uint _amt = sub(amt, feeAmt); |             uint feeAmt = wmul(amt, fee); | ||||||
|  |             uint _amt = sub(amt, feeAmt); | ||||||
| 
 | 
 | ||||||
|         bool isEth = token == getEthAddr(); |             bool isEth = token == getEthAddr(); | ||||||
|         if (isEth) { |             if (isEth) { | ||||||
|             ethAmt = _amt; |                 ethAmt = _amt; | ||||||
|             feeCollector.transfer(feeAmt); |                 feeCollector.transfer(feeAmt); | ||||||
|         } else { |             } else { | ||||||
|             TokenInterface tokenContract = TokenInterface(token); |                 TokenInterface tokenContract = TokenInterface(token); | ||||||
|             tokenContract.approve(address(aave), _amt); |                 tokenContract.approve(address(aave), _amt); | ||||||
|             tokenContract.transfer(feeCollector, feeAmt); |                 tokenContract.transfer(feeCollector, feeAmt); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             aave.deposit.value(ethAmt)(token, _amt, getReferralCode()); | ||||||
|  | 
 | ||||||
|  |             if (!getIsColl(aave, token)) | ||||||
|  |                 aave.setUserUseReserveAsCollateral(token, true); | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|         aave.deposit.value(ethAmt)(token, _amt, getReferralCode()); |  | ||||||
| 
 |  | ||||||
|         if (!getIsColl(aave, token)) |  | ||||||
|             aave.setUserUseReserveAsCollateral(token, true); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _aaveV1Deposit( |     function _aaveV1Deposit( | ||||||
|  | @ -734,9 +736,7 @@ contract AaveV1Helpers is CompoundHelpers { | ||||||
|         uint[] memory amts |         uint[] memory amts | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _aaveV1DepositOne(aave, fee, tokens[i], amts[i]); | ||||||
|                 _aaveV1DepositOne(aave, fee, tokens[i], amts[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -745,8 +745,10 @@ contract AaveV1Helpers is CompoundHelpers { | ||||||
|         address token, |         address token, | ||||||
|         uint amt |         uint amt | ||||||
|     ) internal { |     ) internal { | ||||||
|         ATokenV1Interface atoken = ATokenV1Interface(aaveCore.getReserveATokenAddress(token)); |         if (amt > 0) { | ||||||
|         atoken.redeem(amt); |             ATokenV1Interface atoken = ATokenV1Interface(aaveCore.getReserveATokenAddress(token)); | ||||||
|  |             atoken.redeem(amt); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _aaveV1Withdraw( |     function _aaveV1Withdraw( | ||||||
|  | @ -756,9 +758,7 @@ contract AaveV1Helpers is CompoundHelpers { | ||||||
|         uint[] memory amts |         uint[] memory amts | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _aaveV1WithdrawOne(aaveCore, tokens[i], amts[i]); | ||||||
|                 _aaveV1WithdrawOne(aaveCore, tokens[i], amts[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -767,16 +767,18 @@ contract AaveV1Helpers is CompoundHelpers { | ||||||
|         address token, |         address token, | ||||||
|         uint amt |         uint amt | ||||||
|     ) internal { |     ) internal { | ||||||
|         uint ethAmt; |         if (amt > 0) { | ||||||
|         bool isEth = token == getEthAddr(); |             uint ethAmt; | ||||||
|         if (isEth) { |             bool isEth = token == getEthAddr(); | ||||||
|             ethAmt = amt; |             if (isEth) { | ||||||
|         } else { |                 ethAmt = amt; | ||||||
|             TokenInterface tokenContract = TokenInterface(token); |             } else { | ||||||
|             tokenContract.approve(address(aave), amt); |                 TokenInterface tokenContract = TokenInterface(token); | ||||||
|         } |                 tokenContract.approve(address(aave), amt); | ||||||
|  |             } | ||||||
| 
 | 
 | ||||||
|         aave.repay.value(ethAmt)(token, amt, payable(address(this))); |             aave.repay.value(ethAmt)(token, amt, payable(address(this))); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _aaveV1Payback( |     function _aaveV1Payback( | ||||||
|  | @ -786,9 +788,7 @@ contract AaveV1Helpers is CompoundHelpers { | ||||||
|         uint[] memory amts |         uint[] memory amts | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _aaveV1PaybackOne(aave, tokens[i], amts[i]); | ||||||
|                 _aaveV1PaybackOne(aave, tokens[i], amts[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -802,19 +802,21 @@ contract AaveV2Helpers is AaveV1Helpers { | ||||||
|         uint amt, |         uint amt, | ||||||
|         uint rateMode |         uint rateMode | ||||||
|     ) internal { |     ) internal { | ||||||
|         uint feeAmt = wmul(amt, fee); |         if (amt > 0) { | ||||||
|         uint _amt = add(amt, feeAmt); |             uint feeAmt = wmul(amt, fee); | ||||||
|  |             uint _amt = add(amt, feeAmt); | ||||||
| 
 | 
 | ||||||
|         bool isEth = token == getEthAddr(); |             bool isEth = token == getEthAddr(); | ||||||
|         address _token = isEth ? getWethAddr() : token; |             address _token = isEth ? getWethAddr() : token; | ||||||
| 
 | 
 | ||||||
|         aave.borrow(_token, _amt, rateMode, getReferralCode(), address(this)); |             aave.borrow(_token, _amt, rateMode, getReferralCode(), address(this)); | ||||||
|         convertWethToEth(isEth, TokenInterface(_token), amt); |             convertWethToEth(isEth, TokenInterface(_token), amt); | ||||||
| 
 | 
 | ||||||
|         if (isEth) { |             if (isEth) { | ||||||
|             feeCollector.transfer(feeAmt); |                 feeCollector.transfer(feeAmt); | ||||||
|         } else { |             } else { | ||||||
|             TokenInterface(_token).transfer(feeCollector, feeAmt); |                 TokenInterface(_token).transfer(feeCollector, feeAmt); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -827,9 +829,7 @@ contract AaveV2Helpers is AaveV1Helpers { | ||||||
|         uint[] memory rateModes |         uint[] memory rateModes | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _aaveV2BorrowOne(aave, fee, tokens[i], amts[i], rateModes[i]); | ||||||
|                 _aaveV2BorrowOne(aave, fee, tokens[i], amts[i], rateModes[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -840,27 +840,29 @@ contract AaveV2Helpers is AaveV1Helpers { | ||||||
|         address token, |         address token, | ||||||
|         uint amt |         uint amt | ||||||
|     ) internal { |     ) internal { | ||||||
|         uint feeAmt = wmul(amt, fee); |         if (amt > 0) { | ||||||
|         uint _amt = sub(amt, feeAmt); |             uint feeAmt = wmul(amt, fee); | ||||||
|  |             uint _amt = sub(amt, feeAmt); | ||||||
| 
 | 
 | ||||||
|         bool isEth = token == getEthAddr(); |             bool isEth = token == getEthAddr(); | ||||||
|         address _token = isEth ? getWethAddr() : token; |             address _token = isEth ? getWethAddr() : token; | ||||||
|         TokenInterface tokenContract = TokenInterface(_token); |             TokenInterface tokenContract = TokenInterface(_token); | ||||||
| 
 | 
 | ||||||
|         if (isEth) { |             if (isEth) { | ||||||
|             feeCollector.transfer(feeAmt); |                 feeCollector.transfer(feeAmt); | ||||||
|         } else { |             } else { | ||||||
|             tokenContract.transfer(feeCollector, feeAmt); |                 tokenContract.transfer(feeCollector, feeAmt); | ||||||
|         } |             } | ||||||
| 
 | 
 | ||||||
|         convertEthToWeth(isEth, tokenContract, _amt); |             convertEthToWeth(isEth, tokenContract, _amt); | ||||||
| 
 | 
 | ||||||
|         tokenContract.approve(address(aave), _amt); |             tokenContract.approve(address(aave), _amt); | ||||||
| 
 | 
 | ||||||
|         aave.deposit(_token, _amt, address(this), getReferralCode()); |             aave.deposit(_token, _amt, address(this), getReferralCode()); | ||||||
| 
 | 
 | ||||||
|         if (!getIsCollV2(aaveData, _token)) { |             if (!getIsCollV2(aaveData, _token)) { | ||||||
|             aave.setUserUseReserveAsCollateral(_token, true); |                 aave.setUserUseReserveAsCollateral(_token, true); | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -873,9 +875,7 @@ contract AaveV2Helpers is AaveV1Helpers { | ||||||
|         uint[] memory amts |         uint[] memory amts | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _aaveV2DepositOne(aave, aaveData, fee, tokens[i], amts[i]); | ||||||
|                 _aaveV2DepositOne(aave, aaveData, fee, tokens[i], amts[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -885,15 +885,17 @@ contract AaveV2Helpers is AaveV1Helpers { | ||||||
|         address token, |         address token, | ||||||
|         uint amt |         uint amt | ||||||
|     ) internal { |     ) internal { | ||||||
|         bool isEth = token == getEthAddr(); |         if (amt > 0) { | ||||||
|         address _token = isEth ? getWethAddr() : token; |             bool isEth = token == getEthAddr(); | ||||||
|         TokenInterface tokenContract = TokenInterface(_token); |             address _token = isEth ? getWethAddr() : token; | ||||||
|  |             TokenInterface tokenContract = TokenInterface(_token); | ||||||
| 
 | 
 | ||||||
|         aave.withdraw(_token, amt, address(this)); |             aave.withdraw(_token, amt, address(this)); | ||||||
| 
 | 
 | ||||||
|         uint _amt = amt == uint(-1) ? getWithdrawBalanceV2(aaveData, _token) : amt; |             uint _amt = amt == uint(-1) ? getWithdrawBalanceV2(aaveData, _token) : amt; | ||||||
| 
 | 
 | ||||||
|         convertWethToEth(isEth, tokenContract, _amt); |             convertWethToEth(isEth, tokenContract, _amt); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _aaveV2Withdraw( |     function _aaveV2Withdraw( | ||||||
|  | @ -904,9 +906,7 @@ contract AaveV2Helpers is AaveV1Helpers { | ||||||
|         uint[] memory amts |         uint[] memory amts | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _aaveV2WithdrawOne(aave, aaveData, tokens[i], amts[i]); | ||||||
|                 _aaveV2WithdrawOne(aave, aaveData, tokens[i], amts[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -917,15 +917,17 @@ contract AaveV2Helpers is AaveV1Helpers { | ||||||
|         uint amt, |         uint amt, | ||||||
|         uint rateMode |         uint rateMode | ||||||
|     ) internal { |     ) internal { | ||||||
|         bool isEth = token == getEthAddr(); |         if (amt > 0) { | ||||||
|         address _token = isEth ? getWethAddr() : token; |             bool isEth = token == getEthAddr(); | ||||||
|         TokenInterface tokenContract = TokenInterface(_token); |             address _token = isEth ? getWethAddr() : token; | ||||||
|  |             TokenInterface tokenContract = TokenInterface(_token); | ||||||
| 
 | 
 | ||||||
|         uint _amt = amt == uint(-1) ? getPaybackBalanceV2(aaveData, _token, rateMode) : amt; |             uint _amt = amt == uint(-1) ? getPaybackBalanceV2(aaveData, _token, rateMode) : amt; | ||||||
| 
 | 
 | ||||||
|         convertEthToWeth(isEth, tokenContract, amt); |             convertEthToWeth(isEth, tokenContract, amt); | ||||||
| 
 | 
 | ||||||
|         aave.repay(_token, _amt, rateMode, address(this)); |             aave.repay(_token, _amt, rateMode, address(this)); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     function _aaveV2Payback( |     function _aaveV2Payback( | ||||||
|  | @ -937,9 +939,7 @@ contract AaveV2Helpers is AaveV1Helpers { | ||||||
|         uint[] memory rateModes |         uint[] memory rateModes | ||||||
|     ) internal { |     ) internal { | ||||||
|         for (uint i = 0; i < length; i++) { |         for (uint i = 0; i < length; i++) { | ||||||
|             if (amts[i] > 0) { |             _aaveV2PaybackOne(aave, aaveData, tokens[i], amts[i], rateModes[i]); | ||||||
|                 _aaveV2PaybackOne(aave, aaveData, tokens[i], amts[i], rateModes[i]); |  | ||||||
|             } |  | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -1019,8 +1019,8 @@ contract MakerHelpers is AaveV2Helpers { | ||||||
|         VatLike(managerContract.vat()).frob( |         VatLike(managerContract.vat()).frob( | ||||||
|             ilk, |             ilk, | ||||||
|             urn, |             urn, | ||||||
|             _this, |             address(this), | ||||||
|             _this, |             address(this), | ||||||
|             intAmt, |             intAmt, | ||||||
|             0 |             0 | ||||||
|         ); |         ); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Mubaris NK
						Mubaris NK