Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
EridianAlpha committed Jun 15, 2024
1 parent a4f63be commit 7dc4c02
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract AavePMAttackTests is AavePMTestSetup {

vm.startPrank(attacker1);
vm.expectRevert(InvalidInitialization.selector);
aavePM.initialize(attacker1, contractAddresses, tokenAddresses, uniswapV3Pools, 250, 200);
aavePM.initialize(attacker1, contractAddresses, tokenAddresses, uniswapV3Pools, 250, 200, 20);
vm.stopPrank();
}

Expand Down
34 changes: 34 additions & 0 deletions test/unit/EvilManagerTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import {AavePMTestSetup} from "test/unit/AavePM/TestSetupTest.t.sol";
import {console} from "forge-std/Test.sol";

import {IAavePM} from "src/interfaces/IAavePM.sol";
import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {IPool} from "@aave/aave-v3-core/contracts/interfaces/IPool.sol";

// ================================================================
// │ EVIL MANAGER TESTS │
// ================================================================

// If a manager address is compromised these tests show the impact.
contract AavePMEvilManagerTests is AavePMTestSetup {
function evilManagerSetup() public {
vm.startPrank(manager1);
sendEth(address(aavePM), SEND_VALUE);
aavePM.aaveSupplyFromContractBalance();
aavePM.reinvest();
vm.stopPrank();
}

function testFail_EvilManagerLoopDrain() public {
evilManagerSetup();
vm.startPrank(manager1);
for (uint256 i = 0; i <= aavePM.getManagerDailyInvocationLimit() + 1; i++) {
aavePM.deleverage();
aavePM.reinvest();
}
vm.stopPrank();
}
}

0 comments on commit 7dc4c02

Please sign in to comment.