mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
minor fixes
This commit is contained in:
parent
6131165008
commit
96c222e4c7
|
@ -23,4 +23,7 @@ contract Events {
|
||||||
uint[] variableBorrowAmts,
|
uint[] variableBorrowAmts,
|
||||||
uint[] stableBorrowAmts
|
uint[] stableBorrowAmts
|
||||||
);
|
);
|
||||||
|
|
||||||
|
event LogAddTokensSupport(address[] _tokens);
|
||||||
|
|
||||||
}
|
}
|
|
@ -26,7 +26,7 @@ contract LiquidityResolver is Helpers, Events {
|
||||||
isSupportedToken[_tokens[i]] = true;
|
isSupportedToken[_tokens[i]] = true;
|
||||||
}
|
}
|
||||||
supportedTokens = _tokens;
|
supportedTokens = _tokens;
|
||||||
// TODO: add event
|
emit LogAddTokensSupport(_tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
function spell(address _target, bytes memory _data) external {
|
function spell(address _target, bytes memory _data) external {
|
||||||
|
@ -60,12 +60,14 @@ contract LiquidityResolver is Helpers, Events {
|
||||||
if (_token == ethAddr) {
|
if (_token == ethAddr) {
|
||||||
require(msg.value == amts[i]);
|
require(msg.value == amts[i]);
|
||||||
_amt = msg.value;
|
_amt = msg.value;
|
||||||
TokenInterface(wethAddr).deposit{value: msg.value}();
|
TokenInterface(wethAddr).deposit{value: _amt}();
|
||||||
|
TokenInterface(wethAddr).approve(address(aave), _amt);
|
||||||
aave.deposit(wethAddr, _amt, address(this), 3288);
|
aave.deposit(wethAddr, _amt, address(this), 3288);
|
||||||
} else {
|
} else {
|
||||||
IERC20 tokenContract = IERC20(_token);
|
IERC20 tokenContract = IERC20(_token);
|
||||||
_amt = amts[i] == uint(-1) ? tokenContract.balanceOf(msg.sender) : amts[i];
|
_amt = amts[i] == uint(-1) ? tokenContract.balanceOf(msg.sender) : amts[i];
|
||||||
tokenContract.safeTransferFrom(msg.sender, address(this), _amt);
|
tokenContract.safeTransferFrom(msg.sender, address(this), _amt);
|
||||||
|
tokenContract.approve(address(aave), _amt);
|
||||||
aave.deposit(_token, _amt, address(this), 3288);
|
aave.deposit(_token, _amt, address(this), 3288);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,6 +130,7 @@ contract LiquidityResolver is Helpers, Events {
|
||||||
* @param _amts - array of token amounts to transfer to L2 receiver's contract
|
* @param _amts - array of token amounts to transfer to L2 receiver's contract
|
||||||
*/
|
*/
|
||||||
function settle(address[] calldata _tokens, uint[] calldata _amts) external {
|
function settle(address[] calldata _tokens, uint[] calldata _amts) external {
|
||||||
|
// TODO: Should we use dydx flashloan for easier settlement?
|
||||||
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
|
AaveInterface aave = AaveInterface(aaveProvider.getLendingPool());
|
||||||
for (uint i = 0; i < supportedTokens.length; i++) {
|
for (uint i = 0; i < supportedTokens.length; i++) {
|
||||||
address _token = supportedTokens[i];
|
address _token = supportedTokens[i];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user