flashloan updates

This commit is contained in:
Samyak Jain 2021-04-23 02:40:08 +05:30
parent 33397ef081
commit d8463fbcdf
3 changed files with 18 additions and 3 deletions

View File

@ -27,4 +27,12 @@ contract Events {
);
event LogMigrate(uint _id);
event LogFlashLoan(
address indexed sender,
address[] tokens,
uint[] amounts,
uint[] feeAmts,
uint route
);
}

View File

@ -112,5 +112,5 @@ interface InstaListInterface {
}
interface DSAInterface {
function cast(address[] calldata _targets, bytes[] calldata _datas, address _origin) external payable returns (bytes32);
function castMigrate(string[] calldata _targets, bytes[] calldata _datas, address _origin) external payable returns (bytes32);
}

View File

@ -160,12 +160,19 @@ contract InstaFlash is AaveV2Migrator {
data,
(address, uint256, address[], uint256[], string[], bytes[])
);
DSAInterface(msg.sender).cast(cd.dsaTargets, cd.dsaData, 0xB7fA44c2E964B6EB24893f7082Ecc08c8d0c0F87);
DSAInterface(msg.sender).castMigrate(cd.dsaTargets, cd.dsaData, 0xB7fA44c2E964B6EB24893f7082Ecc08c8d0c0F87);
for (uint i = 0; i < _length; i++) {
uint _finBal = _tokenContracts[i].balanceOf(address(this));
require(_finBal >= iniBal[i], "flashloan-not-returned");
}
// TODO: emit event
uint[] memory _feeAmts = new uint[](_length);
emit LogFlashLoan(
msg.sender,
_tokens,
_amounts,
_feeAmts,
0
);
}
}