From 3409fe8241381fb14fae386b496099790d088a8a Mon Sep 17 00:00:00 2001 From: patrick Date: Mon, 12 Dec 2022 17:32:03 -0500 Subject: [PATCH] Implement comments --- src/aave-v2/MorphoUtils.sol | 12 +----------- test/aave-v2/TestBorrow.t.sol | 17 ----------------- 2 files changed, 1 insertion(+), 28 deletions(-) diff --git a/src/aave-v2/MorphoUtils.sol b/src/aave-v2/MorphoUtils.sol index ffb4a6b162..9cc75cf034 100644 --- a/src/aave-v2/MorphoUtils.sol +++ b/src/aave-v2/MorphoUtils.sol @@ -256,9 +256,6 @@ abstract contract MorphoUtils is MorphoStorage { Types.AssetLiquidityData memory assetData; Types.LiquidityStackVars memory vars; - DataTypes.UserConfigurationMap memory morphoPoolConfig = pool.getUserConfiguration( - address(this) - ); vars.poolTokensLength = marketsCreated.length; vars.userMarkets = userMarkets[_user]; @@ -273,18 +270,11 @@ abstract contract MorphoUtils is MorphoStorage { if (vars.poolToken != _poolToken) _updateIndexes(vars.poolToken); + // An assumption is made here that Morpho has set this asset as collateral in the underlying pool. (assetData.ltv, assetData.liquidationThreshold, , assetData.decimals, ) = pool .getConfiguration(vars.underlyingToken) .getParamsMemory(); - // LTV and liquidation threshold should be zero if Morpho has not enabled this asset as collateral. - if ( - !morphoPoolConfig.isUsingAsCollateral(pool.getReserveData(vars.underlyingToken).id) - ) { - assetData.ltv = 0; - assetData.liquidationThreshold = 0; - } - unchecked { assetData.tokenUnit = 10**assetData.decimals; } diff --git a/test/aave-v2/TestBorrow.t.sol b/test/aave-v2/TestBorrow.t.sol index 6dea58d11d..fc56b15f35 100644 --- a/test/aave-v2/TestBorrow.t.sol +++ b/test/aave-v2/TestBorrow.t.sol @@ -247,23 +247,6 @@ contract TestBorrow is TestSetup { borrower1.borrow(aUsdc, amount); } - function testShouldNotBorrowWithDisabledCollateral() public { - uint256 amount = 100 ether; - - borrower1.approve(dai, type(uint256).max); - borrower1.supply(aDai, amount * 10); - - // Give Morpho a position on the pool to be able to unset the DAI asset as collateral. - // Without this position on the pool, it's not possible to do so. - supplier1.approve(usdc, to6Decimals(amount)); - supplier1.supply(aUsdc, to6Decimals(amount)); - - morpho.setAssetAsCollateral(aDai, false); - - hevm.expectRevert(EntryPositionsManager.UnauthorisedBorrow.selector); - borrower1.borrow(aUsdc, to6Decimals(amount)); - } - function testBorrowLargerThanDeltaShouldClearDelta() public { // Allows only 10 unmatch suppliers.