File tree Expand file tree Collapse file tree 4 files changed +35
-1
lines changed Expand file tree Collapse file tree 4 files changed +35
-1
lines changed Original file line number Diff line number Diff line change @@ -181,6 +181,17 @@ contract MorphoDepositFailureTests is MorphoBaseTest {
181181 foreignController.depositERC4626 (MORPHO_VAULT_USDS, 25_000_000e18 );
182182 }
183183
184+ function test_morpho_usdc_deposit_zeroExchangeRate () external {
185+ deal (Base.USDS, address (almProxy), 25_000_000e18 );
186+
187+ vm.prank (Base.SPARK_EXECUTOR);
188+ foreignController.setMaxExchangeRate (MORPHO_VAULT_USDS, 0 , 0 );
189+
190+ vm.prank (relayer);
191+ vm.expectRevert ("FC/exchange-rate-too-high " );
192+ foreignController.depositERC4626 (MORPHO_VAULT_USDS, 1e18 );
193+ }
194+
184195}
185196
186197contract MorphoDepositSuccessTests is MorphoBaseTest {
Original file line number Diff line number Diff line change @@ -106,6 +106,18 @@ contract MainnetControllerDepositERC4626FailureTests is SUSDSTestBase {
106106 mainnetController.depositERC4626 (address (susds), 5_000_000e18 );
107107 }
108108
109+ function test_depositERC4626_zeroExchangeRate () external {
110+ vm.prank (relayer);
111+ mainnetController.mintUSDS (5_000_000e18 );
112+
113+ vm.prank (Ethereum.SPARK_PROXY);
114+ mainnetController.setMaxExchangeRate (address (susds), 0 , 0 );
115+
116+ vm.prank (relayer);
117+ vm.expectRevert ("MC/exchange-rate-too-high " );
118+ mainnetController.depositERC4626 (address (susds), 5_000_000e18 );
119+ }
120+
109121}
110122
111123contract MainnetControllerDepositERC4626Tests is SUSDSTestBase {
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ contract ERC4626DonationAttack is ERC4626DonationAttackTestBase {
8686
8787 function test_depositERC4626_donationAttackFailure () external {
8888 vm.startPrank (Ethereum.SPARK_PROXY);
89- mainnetController.setMaxExchangeRate (address (morphoVault), morphoVault. convertToShares ( 1e18 ), 1.2e18 );
89+ mainnetController.setMaxExchangeRate (address (morphoVault), 1e18 , 10e18 );
9090 vm.stopPrank ();
9191
9292 _doAttack ();
Original file line number Diff line number Diff line change @@ -145,6 +145,17 @@ contract MainnetControllerDepositERC4626MapleFailureTests is MapleTestBase {
145145 mainnetController.depositERC4626 (address (syrup), 1_000_000e6 );
146146 }
147147
148+ function test_depositERC4626_maple_zeroExchangeRate () external {
149+ deal (address (usdc), address (almProxy), 1_000_000e6 );
150+
151+ vm.prank (Ethereum.SPARK_PROXY);
152+ mainnetController.setMaxExchangeRate (address (syrup), 0 , 0 );
153+
154+ vm.prank (relayer);
155+ vm.expectRevert ("MC/exchange-rate-too-high " );
156+ mainnetController.depositERC4626 (address (syrup), 1_000_000e6 );
157+ }
158+
148159}
149160
150161contract MainnetControllerDepositERC4626Tests is MapleTestBase {
You can’t perform that action at this time.
0 commit comments