mirror of
				https://github.com/Instadapp/dsa-polygon-migration.git
				synced 2024-07-29 22:27:58 +00:00 
			
		
		
		
	Finish senders
This commit is contained in:
		
							parent
							
								
									584bd9a98f
								
							
						
					
					
						commit
						bd3ebe6ea1
					
				|  | @ -5,13 +5,18 @@ contract Events { | |||
|     event LogDeposit( | ||||
|         address owner, | ||||
|         address[] tokens, | ||||
|         uint[] amts | ||||
|         uint256[] amts | ||||
|     ); | ||||
| 
 | ||||
|     event LogWithdraw( | ||||
|         address owner, | ||||
|         address[] tokens, | ||||
|         uint[] amts | ||||
|         uint256[] amts | ||||
|     ); | ||||
| 
 | ||||
|     event LogSettle( | ||||
|         address[] tokens, | ||||
|         uint256[] amts | ||||
|     ); | ||||
| 
 | ||||
|     event LogAaveV2Migrate( | ||||
|  | @ -19,9 +24,9 @@ contract Events { | |||
|         address indexed targetDsa, | ||||
|         address[] supplyTokens, | ||||
|         address[] borrowTokens, | ||||
|         uint[] supplyAmts, | ||||
|         uint[] variableBorrowAmts, | ||||
|         uint[] stableBorrowAmts | ||||
|         uint256[] supplyAmts, | ||||
|         uint256[] variableBorrowAmts, | ||||
|         uint256[] stableBorrowAmts | ||||
|     ); | ||||
| 
 | ||||
|     event LogUpdateVariables( | ||||
|  |  | |||
|  | @ -107,4 +107,8 @@ interface IndexInterface { | |||
| 
 | ||||
| interface FlashloanInterface { | ||||
|     function initiateFlashLoan(bytes memory data, uint ethAmt) external; | ||||
| } | ||||
| 
 | ||||
| interface RootChainManagerInterface { | ||||
|     function depositFor(address user, address token, bytes calldata depositData) external; | ||||
| } | ||||
|  | @ -173,12 +173,16 @@ contract LiquidityResolver is Helpers, Events { | |||
|             } | ||||
|         } | ||||
|         for (uint i = 0; i < _tokens.length; i++) { | ||||
|             address _token = _tokens[i] == ethAddr ? wethAddr : _tokens[i]; | ||||
|             aave.withdraw(_token, _amts[i], address(this)); | ||||
|             // TODO: transfer to polygon's receiver address "polygonReceiver" | ||||
|             // TODO: Verify this | ||||
|             IERC20(_token).safeApprove(erc20Predicate, _amts[i]); | ||||
|             rootChainManager.depositFor(polygonReceiver, _token, abi.encode(_amts[i])); | ||||
| 
 | ||||
|             isPositionSafe(); | ||||
|         } | ||||
|         emit LogSettle(_tokens, _amts); | ||||
|     } | ||||
|     // TODO: emit event | ||||
| } | ||||
| 
 | ||||
| contract MigrateResolver is LiquidityResolver { | ||||
|  |  | |||
|  | @ -6,7 +6,8 @@ import { | |||
|     AaveOracleInterface, | ||||
|     StateSenderInterface, | ||||
|     IndexInterface, | ||||
|     FlashloanInterface | ||||
|     FlashloanInterface, | ||||
|     RootChainManagerInterface | ||||
| } from "./interfaces.sol"; | ||||
| 
 | ||||
| contract Variables { | ||||
|  | @ -35,6 +36,7 @@ contract Variables { | |||
| 
 | ||||
|     address constant internal polygonReceiver = address(0); // TODO: Replace this | ||||
|     FlashloanInterface constant internal flashloanContract = FlashloanInterface(address(0)); // TODO: Replace this | ||||
|     address constant internal erc20Predicate = 0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf; | ||||
| 
 | ||||
|     // This will be used to have debt/collateral ratio always 20% less than liquidation | ||||
|     // TODO: Is this number correct for it? | ||||
|  | @ -69,4 +71,9 @@ contract Variables { | |||
|     // InstaIndex Address. | ||||
|     IndexInterface public constant instaIndex = IndexInterface(0x2971AdFa57b20E5a416aE5a708A8655A9c74f723); | ||||
| 
 | ||||
|     /** | ||||
|      * Polygon deposit bridge | ||||
|      */ | ||||
|     RootChainManagerInterface public constant rootChainManager = RootChainManagerInterface(0xA0c68C638235ee32657e8f720a23ceC1bFc77C77); | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Mubaris NK
						Mubaris NK