mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
flashloan updates
This commit is contained in:
parent
33397ef081
commit
d8463fbcdf
|
@ -27,4 +27,12 @@ contract Events {
|
||||||
);
|
);
|
||||||
|
|
||||||
event LogMigrate(uint _id);
|
event LogMigrate(uint _id);
|
||||||
|
|
||||||
|
event LogFlashLoan(
|
||||||
|
address indexed sender,
|
||||||
|
address[] tokens,
|
||||||
|
uint[] amounts,
|
||||||
|
uint[] feeAmts,
|
||||||
|
uint route
|
||||||
|
);
|
||||||
}
|
}
|
|
@ -112,5 +112,5 @@ interface InstaListInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DSAInterface {
|
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);
|
||||||
}
|
}
|
|
@ -160,12 +160,19 @@ contract InstaFlash is AaveV2Migrator {
|
||||||
data,
|
data,
|
||||||
(address, uint256, address[], uint256[], string[], bytes[])
|
(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++) {
|
for (uint i = 0; i < _length; i++) {
|
||||||
uint _finBal = _tokenContracts[i].balanceOf(address(this));
|
uint _finBal = _tokenContracts[i].balanceOf(address(this));
|
||||||
require(_finBal >= iniBal[i], "flashloan-not-returned");
|
require(_finBal >= iniBal[i], "flashloan-not-returned");
|
||||||
}
|
}
|
||||||
// TODO: emit event
|
uint[] memory _feeAmts = new uint[](_length);
|
||||||
|
emit LogFlashLoan(
|
||||||
|
msg.sender,
|
||||||
|
_tokens,
|
||||||
|
_amounts,
|
||||||
|
_feeAmts,
|
||||||
|
0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user