mirror of
				https://github.com/Instadapp/dsa-connectors.git
				synced 2024-07-29 22:37:00 +00:00 
			
		
		
		
	added function for imprtWithCollateral-polygon
This commit is contained in:
		
							parent
							
								
									7d117a52c3
								
							
						
					
					
						commit
						94490ef939
					
				| 
						 | 
				
			
			@ -224,6 +224,33 @@ contract AaveHelpers is Helper {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	function _TransferAtokens(
 | 
			
		||||
		uint256 _length,
 | 
			
		||||
		AaveInterface aave,
 | 
			
		||||
		ATokenInterface[] memory atokenContracts,
 | 
			
		||||
		uint256[] memory amts,
 | 
			
		||||
		address[] memory tokens,
 | 
			
		||||
		address userAccount
 | 
			
		||||
	) internal {
 | 
			
		||||
		for (uint256 i = 0; i < _length; i++) {
 | 
			
		||||
			if (amts[i] > 0) {
 | 
			
		||||
				uint256 _amt = amts[i];
 | 
			
		||||
				require(
 | 
			
		||||
					atokenContracts[i].transferFrom(
 | 
			
		||||
						userAccount,
 | 
			
		||||
						address(this),
 | 
			
		||||
						_amt
 | 
			
		||||
					),
 | 
			
		||||
					"allowance?"
 | 
			
		||||
				);
 | 
			
		||||
 | 
			
		||||
				if (!getIsColl(tokens[i], address(this))) {
 | 
			
		||||
					aave.setUserUseReserveAsCollateral(tokens[i], true);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	function _TransferAtokensWithCollateral(
 | 
			
		||||
		uint256 _length,
 | 
			
		||||
		AaveInterface aave,
 | 
			
		||||
		ATokenInterface[] memory atokenContracts,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -127,12 +127,13 @@ contract AaveV3ImportResolver is AaveHelpers {
 | 
			
		|||
		);
 | 
			
		||||
 | 
			
		||||
		//  transfer atokens to this address;
 | 
			
		||||
		_TransferAtokens(
 | 
			
		||||
		_TransferAtokensWithCollateral(
 | 
			
		||||
			data._supplyTokens.length,
 | 
			
		||||
			aave,
 | 
			
		||||
			data.aTokens,
 | 
			
		||||
			data.supplyAmts,
 | 
			
		||||
			data._supplyTokens,
 | 
			
		||||
			enableCollateral,
 | 
			
		||||
			userAccount
 | 
			
		||||
		);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user