From a97072fe4e04b67da91280a35b090883e8800168 Mon Sep 17 00:00:00 2001 From: Samyak Jain <34437877+KaymasJain@users.noreply.github.com> Date: Fri, 9 Apr 2021 05:23:21 +0530 Subject: [PATCH] minor edits --- contracts/receivers/aave-v2-receiver/main.sol | 14 +++++--------- contracts/senders/aave-v2-migrator/main.sol | 3 +-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/contracts/receivers/aave-v2-receiver/main.sol b/contracts/receivers/aave-v2-receiver/main.sol index b10fb98..36218b8 100644 --- a/contracts/receivers/aave-v2-receiver/main.sol +++ b/contracts/receivers/aave-v2-receiver/main.sol @@ -60,7 +60,6 @@ contract MigrateResolver is Helpers, Events { emit LogDeposit(msg.sender, tokens, _amts); } - // TODO: @mubaris Make this similar to L1 migrator. Have to change ETH by MATIC function withdraw(address[] calldata tokens, uint[] calldata amts) external { uint _length = tokens.length; require(_length == amts.length, "invalid-length"); @@ -129,7 +128,6 @@ contract MigrateResolver is Helpers, Events { ,,,,, ) = aaveData.getUserReserveData(_token, address(this)); if (supplyBal != 0 && borrowBal != 0) { - uint _withdrawAmt; if (supplyBal > borrowBal) { aave.withdraw(_token, (borrowBal + flashAmts[_token]), address(this)); // TODO: fail because of not enough withdrawing capacity? IERC20(_token).approve(address(aave), borrowBal); @@ -140,8 +138,8 @@ contract MigrateResolver is Helpers, Events { aave.repay(_token, supplyBal, 2, address(this)); } } - } + // TODO: emit event } } @@ -168,11 +166,8 @@ contract AaveV2Migrator is MigrateResolver { borrowAndTransferSpells(aave, dsa, borrowTokens, borrowAmts); isPositionSafe(); - } - - // TODO: @mubaris - Do we need this? - function canMigrate(AaveData memory data) public view returns (bool can) { + // TODO: emit event } function onStateReceive(uint256 stateId, bytes calldata receivedData) external { @@ -183,6 +178,7 @@ contract AaveV2Migrator is MigrateResolver { // Can't do it via any address as user can migrate 2 times positions[stateId] = receivedData; + // TODO: add event } function migrate(uint _id) external { @@ -192,10 +188,10 @@ contract AaveV2Migrator is MigrateResolver { AaveData memory data = abi.decode(_data, (AaveData)); - require(canMigrate(data), "not-enough-liquidity"); // TODO: do we need this? as we can see if transaction will go through or not from our bot - _migratePosition(data); delete positions[_id]; + + // TODO: add event } } diff --git a/contracts/senders/aave-v2-migrator/main.sol b/contracts/senders/aave-v2-migrator/main.sol index 0a664dd..c8ff2af 100644 --- a/contracts/senders/aave-v2-migrator/main.sol +++ b/contracts/senders/aave-v2-migrator/main.sol @@ -150,7 +150,6 @@ contract LiquidityResolver is Helpers, Events { ,,,,, ) = aaveData.getUserReserveData(_token, address(this)); if (supplyBal != 0 && borrowBal != 0) { - uint _withdrawAmt; if (supplyBal > borrowBal) { aave.withdraw(_token, borrowBal, address(this)); // TODO: fail because of not enough withdrawing capacity? IERC20(_token).approve(address(aave), borrowBal); @@ -168,7 +167,7 @@ contract LiquidityResolver is Helpers, Events { isPositionSafe(); } } - + // TODO: emit event } contract MigrateResolver is LiquidityResolver {