From 505ccf0cd4b653606874273dcfee3f57d7c7ed1f Mon Sep 17 00:00:00 2001 From: Mubaris NK Date: Wed, 9 Dec 2020 17:01:11 +0530 Subject: [PATCH 1/4] Add collateral enabled flag --- contracts/protocols/aave.sol | 3 +++ contracts/protocols/aave_v2.sol | 2 ++ 2 files changed, 5 insertions(+) diff --git a/contracts/protocols/aave.sol b/contracts/protocols/aave.sol index 8d79a1d..c6e530e 100644 --- a/contracts/protocols/aave.sol +++ b/contracts/protocols/aave.sol @@ -125,6 +125,7 @@ contract AaveHelpers is DSMath { uint supplyRate; uint borrowRate; uint borrowModal; + bool isCollateral; AaveTokenData aaveTokenData; } @@ -200,6 +201,7 @@ contract AaveHelpers is DSMath { , uint fee, ,, + bool isCollateral ) = aave.getUserReserveData(token, user); uint supplyRate = aaveCore.getReserveCurrentLiquidityRate(token); @@ -215,6 +217,7 @@ contract AaveHelpers is DSMath { supplyRate, borrowRate, borrowModal, + isCollateral, aaveTokenData ); } diff --git a/contracts/protocols/aave_v2.sol b/contracts/protocols/aave_v2.sol index 42f9388..57f3fa8 100644 --- a/contracts/protocols/aave_v2.sol +++ b/contracts/protocols/aave_v2.sol @@ -153,6 +153,7 @@ contract AaveHelpers is DSMath { uint supplyRate; uint stableBorrowRate; uint variableBorrowRate; + bool isCollateral; AaveTokenData aaveTokenData; } @@ -225,6 +226,7 @@ contract AaveHelpers is DSMath { tokenData.stableBorrowBalance, tokenData.variableBorrowBalance, ,,,,, + tokenData.isCollateral ) = aaveData.getUserReserveData(token, user); ( From bc8d2ab2a2952e1ad7d37550b73a3797e8915104 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Wed, 9 Dec 2020 17:29:06 +0530 Subject: [PATCH 2/4] Updated version --- contracts/protocols/aave.sol | 2 +- contracts/protocols/aave_v2.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/protocols/aave.sol b/contracts/protocols/aave.sol index c6e530e..a3fd28f 100644 --- a/contracts/protocols/aave.sol +++ b/contracts/protocols/aave.sol @@ -265,5 +265,5 @@ contract Resolver is AaveHelpers { } contract InstaAaveResolver is Resolver { - string public constant name = "Aave-Resolver-v1.1"; + string public constant name = "Aave-Resolver-v1.2"; } \ No newline at end of file diff --git a/contracts/protocols/aave_v2.sol b/contracts/protocols/aave_v2.sol index 57f3fa8..75fbcfa 100644 --- a/contracts/protocols/aave_v2.sol +++ b/contracts/protocols/aave_v2.sol @@ -295,5 +295,5 @@ contract Resolver is AaveHelpers { } contract InstaAaveV2Resolver is Resolver { - string public constant name = "AaveV2-Resolver-v1.1"; + string public constant name = "AaveV2-Resolver-v1.2"; } \ No newline at end of file From f23b112bb9bf7a1d9896bf1a1ab09bef9d4c969f Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Sun, 13 Dec 2020 16:46:42 +0530 Subject: [PATCH 3/4] Minor change --- contracts/protocols/aave.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/protocols/aave.sol b/contracts/protocols/aave.sol index a3fd28f..a985acf 100644 --- a/contracts/protocols/aave.sol +++ b/contracts/protocols/aave.sol @@ -104,16 +104,16 @@ contract AaveHelpers is DSMath { * @dev get Aave Provider Address */ function getAaveProviderAddress() internal pure returns (address) { - // return 0x24a42fD28C976A61Df5D00D0599C34c4f90748c8; //mainnet - return 0x506B0B2CF20FAA8f38a4E2B524EE43e1f4458Cc5; //kovan + return 0x24a42fD28C976A61Df5D00D0599C34c4f90748c8; //mainnet + // return 0x506B0B2CF20FAA8f38a4E2B524EE43e1f4458Cc5; //kovan } /** * @dev get Chainlink ETH price feed Address */ function getChainlinkEthFeed() internal pure returns (address) { - // return 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; //mainnet - return 0x9326BFA02ADD2366b30bacB125260Af641031331; //kovan + return 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419; //mainnet + // return 0x9326BFA02ADD2366b30bacB125260Af641031331; //kovan } struct AaveUserTokenData { From 639cfc2d871da71bf601a3c7238ef417c76684e6 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Sun, 13 Dec 2020 16:47:39 +0530 Subject: [PATCH 4/4] Minor change to instapoolV2 resolver --- contracts/protocols/instapool.sol | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contracts/protocols/instapool.sol b/contracts/protocols/instapool.sol index 0f96010..db5d3e7 100644 --- a/contracts/protocols/instapool.sol +++ b/contracts/protocols/instapool.sol @@ -57,6 +57,7 @@ interface AavePriceInterface { interface AaveCoreInterface { function getReserveCurrentLiquidityRate(address _reserve) external view returns (uint256); function getReserveCurrentVariableBorrowRate(address _reserve) external view returns (uint256); + function getReserveATokenAddress(address _reserve) external view returns (address); } interface VatLike { @@ -250,6 +251,9 @@ contract AaveHelpers is CompoundResolver { public view returns (uint) { AaveProviderInterface AaveProvider = AaveProviderInterface(getAaveProviderAddress()); AaveInterface aave = AaveInterface(AaveProvider.getLendingPool()); + AaveCoreInterface aaveCore = AaveCoreInterface(AaveProvider.getLendingPoolCore()); + if (aaveCore.getReserveATokenAddress(token) == address(0)) return 0; + AaveTokenData memory aaveToken = collateralData(aave, token); AaveTokenData memory aaveEthToken = collateralData(aave, getEthAddress()); if (!aaveToken.borrowEnabled) return 0;