mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
commit
6dd516d40b
|
@ -56,6 +56,7 @@ contract MigrateResolver is Helpers, Events {
|
|||
TokenInterface(wmaticAddr).deposit{value: address(this).balance}();
|
||||
}
|
||||
}
|
||||
|
||||
IERC20 _tokenContract = IERC20(_token);
|
||||
uint _tokenBal = _tokenContract.balanceOf(address(this));
|
||||
if (_tokenBal > 0) {
|
||||
|
@ -108,7 +109,7 @@ contract AaveV2Migrator is MigrateResolver {
|
|||
|
||||
isPositionSafe();
|
||||
|
||||
emit LogAaveV2Migrate(dsa, supplyTokens, borrowTokens, supplyAmts, supplyAmts);
|
||||
emit LogAaveV2Migrate(dsa, supplyTokens, borrowTokens, supplyAmts, borrowAmts);
|
||||
}
|
||||
|
||||
function onStateReceive(uint256 stateId, bytes calldata receivedData) external {
|
||||
|
|
|
@ -36,7 +36,6 @@ contract Variables {
|
|||
*/
|
||||
InstaListInterface public constant instaList = InstaListInterface(0x839c2D3aDe63DF5b0b8F3E57D5e145057Ab41556);
|
||||
|
||||
|
||||
/**
|
||||
* @dev Matic StateReceiver contract
|
||||
*/
|
||||
|
@ -67,4 +66,4 @@ contract Variables {
|
|||
* @dev last stateId from the onStateReceive
|
||||
*/
|
||||
uint256 internal lastStateId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -106,4 +106,5 @@ interface ChainLinkInterface {
|
|||
|
||||
interface RootChainManagerInterface {
|
||||
function depositFor(address user, address token, bytes calldata depositData) external;
|
||||
function depositEtherFor(address user) external payable;
|
||||
}
|
||||
|
|
|
@ -88,8 +88,18 @@ 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));
|
||||
IERC20(_token).safeApprove(erc20Predicate, _amts[i]);
|
||||
rootChainManager.depositFor(polygonReceiver, _token, abi.encode(_amts[i]));
|
||||
|
||||
if (_token == wethAddr) {
|
||||
TokenInterface wethContract = TokenInterface(wethAddr);
|
||||
uint wethBal = wethContract.balanceOf(address(this));
|
||||
wethContract.approve(wethAddr, wethBal);
|
||||
wethContract.withdraw(wethBal);
|
||||
rootChainManager.depositEtherFor{value: _amts[i]}(polygonReceiver);
|
||||
} else {
|
||||
IERC20(_token).safeApprove(erc20Predicate, _amts[i]);
|
||||
rootChainManager.depositFor(polygonReceiver, _tokens[i], abi.encode(_amts[i]));
|
||||
}
|
||||
|
||||
|
||||
isPositionSafe();
|
||||
}
|
||||
|
@ -191,4 +201,4 @@ contract InstaAaveV2MigratorSenderImplementation is MigrateResolver {
|
|||
|
||||
flashloanContract.initiateFlashLoan(data, ethAmt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user