From 913a44d40f64bae4c3c641bb6b2ec554fe23ec8b Mon Sep 17 00:00:00 2001 From: MathisGD Date: Tue, 7 Mar 2023 17:38:45 +0100 Subject: [PATCH 1/2] test: fix integration test (owner) --- config/aave-v2/Config.sol | 1 - config/compound/Config.sol | 1 - test/prod/aave-v2/TestDeltas.t.sol | 4 ++-- test/prod/aave-v2/setup/TestSetup.sol | 2 +- test/prod/compound/TestDeltas.t.sol | 4 ++-- test/prod/compound/setup/TestSetup.sol | 2 +- 6 files changed, 6 insertions(+), 8 deletions(-) diff --git a/config/aave-v2/Config.sol b/config/aave-v2/Config.sol index a0dd87e17..57cdf978e 100644 --- a/config/aave-v2/Config.sol +++ b/config/aave-v2/Config.sol @@ -40,7 +40,6 @@ contract Config is BaseConfig { address constant swapRouterAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D; - address public morphoDao = 0xcBa28b38103307Ec8dA98377ffF9816C164f9AFa; ILendingPoolAddressesProvider public poolAddressesProvider = ILendingPoolAddressesProvider(0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5); ILendingPoolConfigurator public lendingPoolConfigurator = diff --git a/config/compound/Config.sol b/config/compound/Config.sol index f31ac2a52..4c591af9d 100644 --- a/config/compound/Config.sol +++ b/config/compound/Config.sol @@ -34,7 +34,6 @@ contract Config is BaseConfig { address constant cUsdp = 0x041171993284df560249B57358F931D9eB7b925D; address constant cSushi = 0x4B0181102A0112A2ef11AbEE5563bb4a3176c9d7; - address public morphoDao = 0xcBa28b38103307Ec8dA98377ffF9816C164f9AFa; IComptroller public comptroller = IComptroller(0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B); ICompoundOracle public oracle = ICompoundOracle(comptroller.oracle()); diff --git a/test/prod/aave-v2/TestDeltas.t.sol b/test/prod/aave-v2/TestDeltas.t.sol index 67d4b23f9..3c99854cb 100644 --- a/test/prod/aave-v2/TestDeltas.t.sol +++ b/test/prod/aave-v2/TestDeltas.t.sol @@ -59,7 +59,7 @@ contract TestDeltas is TestSetup { address(morpho) ); - vm.prank(morphoDao); + vm.prank(proxyAdmin.owner()); morpho.increaseP2PDeltas(test.market.poolToken, type(uint256).max); ( @@ -150,7 +150,7 @@ contract TestDeltas is TestSetup { p2pBorrowUnderlying > borrowDeltaUnderlyingBefore ) continue; - vm.prank(morphoDao); + vm.prank(proxyAdmin.owner()); vm.expectRevert(PositionsManagerUtils.AmountIsZero.selector); morpho.increaseP2PDeltas(test.market.poolToken, type(uint256).max); } diff --git a/test/prod/aave-v2/setup/TestSetup.sol b/test/prod/aave-v2/setup/TestSetup.sol index f64ff22a3..49374643d 100644 --- a/test/prod/aave-v2/setup/TestSetup.sol +++ b/test/prod/aave-v2/setup/TestSetup.sol @@ -291,7 +291,7 @@ contract TestSetup is Config, Test { /// @dev Upgrades all the protocol contracts. function _upgrade() internal { - vm.startPrank(morphoDao); + vm.startPrank(proxyAdmin.owner()); address morphoImplV2 = address(new Morpho()); proxyAdmin.upgrade(morphoProxy, morphoImplV2); vm.label(morphoImplV2, "MorphoImplV2"); diff --git a/test/prod/compound/TestDeltas.t.sol b/test/prod/compound/TestDeltas.t.sol index 7b792baa2..57bf74cfa 100644 --- a/test/prod/compound/TestDeltas.t.sol +++ b/test/prod/compound/TestDeltas.t.sol @@ -63,7 +63,7 @@ contract TestDeltas is TestSetup { address(morpho) ); - vm.prank(morphoDao); + vm.prank(proxyAdmin.owner()); morpho.increaseP2PDeltas(test.market.poolToken, type(uint256).max); ( @@ -156,7 +156,7 @@ contract TestDeltas is TestSetup { p2pBorrowUnderlying > borrowDeltaUnderlyingBefore ) continue; - vm.prank(morphoDao); + vm.prank(proxyAdmin.owner()); vm.expectRevert(PositionsManager.AmountIsZero.selector); morpho.increaseP2PDeltas(test.market.poolToken, type(uint256).max); } diff --git a/test/prod/compound/setup/TestSetup.sol b/test/prod/compound/setup/TestSetup.sol index 0a68297a2..16161bc62 100644 --- a/test/prod/compound/setup/TestSetup.sol +++ b/test/prod/compound/setup/TestSetup.sol @@ -254,7 +254,7 @@ contract TestSetup is Config, Test { /// @dev Upgrades all the protocol contracts. function _upgrade() internal { - vm.startPrank(morphoDao); + vm.startPrank(proxyAdmin.owner()); address rewardsManagerImplV2 = address(new RewardsManager()); proxyAdmin.upgrade(rewardsManagerProxy, rewardsManagerImplV2); vm.label(rewardsManagerImplV2, "RewardsManagerImplV2"); From 903778453723300438f4d51faee3397e079bff07 Mon Sep 17 00:00:00 2001 From: MathisGD Date: Tue, 7 Mar 2023 21:57:28 +0100 Subject: [PATCH 2/2] test: fix failing test rounding error --- test/prod/aave-v2/TestDeltas.t.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/prod/aave-v2/TestDeltas.t.sol b/test/prod/aave-v2/TestDeltas.t.sol index 3c99854cb..b5c710d3c 100644 --- a/test/prod/aave-v2/TestDeltas.t.sol +++ b/test/prod/aave-v2/TestDeltas.t.sol @@ -108,14 +108,14 @@ contract TestDeltas is TestSetup { assertApproxEqAbs( p2pSupplyUnderlying - supplyDeltaUnderlyingBefore, IAToken(test.market.poolToken).balanceOf(address(morpho)) - test.morphoSupplyBefore, - 2, + 3, "morpho pool supply" ); assertApproxEqAbs( p2pBorrowUnderlying - borrowDeltaUnderlyingBefore, IVariableDebtToken(test.market.debtToken).balanceOf(address(morpho)) - test.morphoBorrowBefore, - 2, + 3, "morpho pool borrow" ); }