mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
Added depositEtherFor func
This commit is contained in:
parent
2ac09aea58
commit
87f884ce48
|
@ -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,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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user