mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
free flashamt
This commit is contained in:
parent
e6bcc576e8
commit
4158bce7d4
|
@ -115,7 +115,6 @@ contract MigrateResolver is Helpers, Events {
|
||||||
function settle() external {
|
function settle() external {
|
||||||
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++) {
|
||||||
for (uint i = 0; i < supportedTokens.length; i++) {
|
|
||||||
address _token = supportedTokens[i];
|
address _token = supportedTokens[i];
|
||||||
if (_token == maticAddr) {
|
if (_token == maticAddr) {
|
||||||
_token = wmaticAddr;
|
_token = wmaticAddr;
|
||||||
|
@ -137,16 +136,16 @@ contract MigrateResolver is Helpers, Events {
|
||||||
if (supplyBal != 0 && borrowBal != 0) {
|
if (supplyBal != 0 && borrowBal != 0) {
|
||||||
uint _withdrawAmt;
|
uint _withdrawAmt;
|
||||||
if (supplyBal > borrowBal) {
|
if (supplyBal > borrowBal) {
|
||||||
aave.withdraw(_token, borrowBal, address(this)); // TODO: fail because of not enough withdrawing capacity?
|
aave.withdraw(_token, (borrowBal + flashAmts[_token]), address(this)); // TODO: fail because of not enough withdrawing capacity?
|
||||||
IERC20(_token).approve(address(aave), borrowBal);
|
IERC20(_token).approve(address(aave), borrowBal);
|
||||||
aave.repay(_token, borrowBal, 2, address(this));
|
aave.repay(_token, borrowBal, 2, address(this));
|
||||||
} else {
|
} else {
|
||||||
aave.withdraw(_token, supplyBal, address(this)); // TODO: fail because of not enough withdrawing capacity?
|
aave.withdraw(_token, (supplyBal + flashAmts[_token]), address(this)); // TODO: fail because of not enough withdrawing capacity?
|
||||||
IERC20(_token).approve(address(aave), supplyBal);
|
IERC20(_token).approve(address(aave), supplyBal);
|
||||||
aave.repay(_token, supplyBal, 2, address(this));
|
aave.repay(_token, supplyBal, 2, address(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user