diff --git a/contracts/protocols/aave.sol b/contracts/protocols/aave.sol index 8d79a1d..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 { @@ -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 ); } @@ -262,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 42f9388..75fbcfa 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); ( @@ -293,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 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;