From bf92590b8fdc7dfbe2a5fae20fe181f7666f8eba Mon Sep 17 00:00:00 2001 From: Richa-iitr Date: Sun, 29 May 2022 12:22:57 +0530 Subject: [PATCH] minor changes --- contracts/polygon/common/interfaces.sol | 2 +- .../connectors/aave/v3-import/helpers.sol | 10 +++++---- .../connectors/aave/v3-import/main.sol | 22 +++++++++---------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/contracts/polygon/common/interfaces.sol b/contracts/polygon/common/interfaces.sol index fed5b4ee..127f62f9 100644 --- a/contracts/polygon/common/interfaces.sol +++ b/contracts/polygon/common/interfaces.sol @@ -34,6 +34,6 @@ interface AccountInterface { } interface ListInterface { - function accountID(address) public returns (uint64); + function accountID(address) external returns (uint64); } diff --git a/contracts/polygon/connectors/aave/v3-import/helpers.sol b/contracts/polygon/connectors/aave/v3-import/helpers.sol index 86a7890b..9113cc27 100644 --- a/contracts/polygon/connectors/aave/v3-import/helpers.sol +++ b/contracts/polygon/connectors/aave/v3-import/helpers.sol @@ -250,6 +250,9 @@ contract AaveHelpers is Helper { ), "allowance?" ); + if (!getIsColl(tokens[i], address(this))) { + aave.setUserUseReserveAsCollateral(tokens[i], true); + } } } } else { @@ -272,15 +275,14 @@ contract AaveHelpers is Helper { 0, 0 ); + if (!getIsColl(_token, address(this))) { + aave.setUserUseReserveAsCollateral(_token, true); + } } } AccountInterface(address(this)).cast(_targets, _data, address(0)); } - - if (!getIsColl(tokens[i], address(this))) { - aave.setUserUseReserveAsCollateral(tokens[i], true); - } } function _TransferAtokensWithCollateral( diff --git a/contracts/polygon/connectors/aave/v3-import/main.sol b/contracts/polygon/connectors/aave/v3-import/main.sol index 7be74082..7486f378 100644 --- a/contracts/polygon/connectors/aave/v3-import/main.sol +++ b/contracts/polygon/connectors/aave/v3-import/main.sol @@ -12,11 +12,15 @@ import "./helpers.sol"; import "./events.sol"; contract AaveV3ImportResolver is AaveHelpers { - function _importAave( - address userAccount, - ImportInputData memory inputData - ) internal returns (string memory _eventName, bytes memory _eventParam) { - if (!ListInterface(0x839c2D3aDe63DF5b0b8F3E57D5e145057Ab41556).accountID(userAccount)) + function _importAave(address userAccount, ImportInputData memory inputData) + internal + returns (string memory _eventName, bytes memory _eventParam) + { + if ( + ListInterface(0x839c2D3aDe63DF5b0b8F3E57D5e145057Ab41556).accountID( + userAccount + ) == 0 + ) { require( AccountInterface(address(this)).isAuth(userAccount), "user-account-not-auth" @@ -54,8 +58,7 @@ contract AaveV3ImportResolver is AaveHelpers { data.aTokens, data.supplyAmts, data._supplyTokens, - userAccount, - isDsa + userAccount ); // borrow assets after migrating position @@ -187,10 +190,7 @@ contract AaveV3ImportResolver is AaveHelpers { * @param userAccount The address of the EOA from which aave position will be imported or address of the DSA to which the DSA positions will be merged * @param inputData The struct containing all the neccessary input data */ - function importAave( - address userAccount, - ImportInputData memory inputData - ) + function importAave(address userAccount, ImportInputData memory inputData) external payable returns (string memory _eventName, bytes memory _eventParam)