Skip to content

Commit

Permalink
new: unit test for ONLY_DEPLOYER revert
Browse files Browse the repository at this point in the history
  • Loading branch information
DhairyaSethi committed Sep 4, 2023
1 parent 1fd49dc commit 035ad46
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/DefaultInflationManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,25 @@ contract DefaultInflationManagerTest is Test {
assertEq(polygon.totalSupply(), 10_000_000_000e18);
}

function test_InvalidDeployment(uint256 seed) external {
function test_InvalidDeployment(uint160 seed) external {
address[5] memory params = [
makeAddr("polygon"),
makeAddr("migration"),
makeAddr("stakeManager"),
makeAddr("treasury"),
makeAddr("governance")
];
params[seed % params.length] = address(0); // any one is zero addr

address proxy = address(
new TransparentUpgradeableProxy(address(new DefaultInflationManager()), msg.sender, "")
);

vm.prank(address(seed));
vm.expectRevert("ONLY_DEPLOYER");
DefaultInflationManager(proxy).initialize(params[0], params[1], params[2], params[3], params[4]);

params[seed % params.length] = address(0); // any one is zero addr

vm.expectRevert(InvalidAddress.selector);
DefaultInflationManager(proxy).initialize(params[0], params[1], params[2], params[3], params[4]);
}
Expand Down

0 comments on commit 035ad46

Please sign in to comment.