diff --git a/contracts/senders/aave-v2-migrator/interfaces.sol b/contracts/senders/aave-v2-migrator/interfaces.sol index d9c3792..5ed078d 100644 --- a/contracts/senders/aave-v2-migrator/interfaces.sol +++ b/contracts/senders/aave-v2-migrator/interfaces.sol @@ -106,4 +106,5 @@ interface ChainLinkInterface { interface RootChainManagerInterface { function depositFor(address user, address token, bytes calldata depositData) external; + function depositEtherFor(address user) external payable; } diff --git a/contracts/senders/aave-v2-migrator/main.sol b/contracts/senders/aave-v2-migrator/main.sol index 2128123..3b34da0 100644 --- a/contracts/senders/aave-v2-migrator/main.sol +++ b/contracts/senders/aave-v2-migrator/main.sol @@ -88,16 +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]); if (_tokens[i] == ethAddr) { 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])); } - rootChainManager.depositFor(polygonReceiver, _tokens[i], abi.encode(_amts[i])); isPositionSafe(); }