@@ -7,12 +7,7 @@ import {Wallet1} from "../src/Wallet1.sol";
7
7
8
8
contract ReentrancyTest {
9
9
function reenter () public {
10
- (bool success , ) = msg .sender .call (
11
- abi.encodeWithSelector (
12
- Wallet1.changeOwner1da7b.selector ,
13
- address (this )
14
- )
15
- );
10
+ (bool success ,) = msg .sender .call (abi.encodeWithSelector (Wallet1.changeOwner1da7b.selector , address (this )));
16
11
require (success);
17
12
}
18
13
@@ -37,16 +32,8 @@ contract TestSetupWallet1 is Test {
37
32
}
38
33
39
34
function testInitialState () public {
40
- assertEq (
41
- proxyWallet.getOwner15569 (),
42
- address (owner),
43
- "Owner should be contract deployer "
44
- );
45
- assertEq (
46
- proxy.getImplementation1599d (),
47
- address (wallet1),
48
- "Implementation should be set correctly "
49
- );
35
+ assertEq (proxyWallet.getOwner15569 (), address (owner), "Owner should be contract deployer " );
36
+ assertEq (proxy.getImplementation1599d (), address (wallet1), "Implementation should be set correctly " );
50
37
}
51
38
52
39
function testReinitialize () public {
@@ -61,17 +48,10 @@ contract TestSetupWallet1 is Test {
61
48
uint256 balanceBefore = fuzzyRecipient.balance;
62
49
vm.broadcast (owner);
63
50
proxyWallet.distribute38c1b (fuzzyRecipient);
64
- assertEq (
65
- fuzzyRecipient.balance,
66
- balanceBefore + 0.5 ether,
67
- "Recipient should receive 0.5 ether "
68
- );
51
+ assertEq (fuzzyRecipient.balance, balanceBefore + 0.5 ether, "Recipient should receive 0.5 ether " );
69
52
}
70
53
71
- function testShouldDistributeFail (
72
- address fuzzyRecipient ,
73
- address fuzzySender
74
- ) public {
54
+ function testShouldDistributeFail (address fuzzyRecipient , address fuzzySender ) public {
75
55
vm.assume (fuzzySender != owner);
76
56
vm.broadcast (fuzzySender);
77
57
vm.expectRevert (bytes ("nope " ));
@@ -81,17 +61,10 @@ contract TestSetupWallet1 is Test {
81
61
function testShouldchangeOwner1da7b (address fuzzyNewOwner ) public {
82
62
vm.broadcast (owner);
83
63
proxyWallet.changeOwner1da7b (fuzzyNewOwner);
84
- assertEq (
85
- proxyWallet.getOwner15569 (),
86
- fuzzyNewOwner,
87
- "Owner should be changed to fuzzy address "
88
- );
64
+ assertEq (proxyWallet.getOwner15569 (), fuzzyNewOwner, "Owner should be changed to fuzzy address " );
89
65
}
90
66
91
- function testShouldchangeOwner1da7bFail (
92
- address fuzzyNewOwner ,
93
- address fuzzySender
94
- ) public {
67
+ function testShouldchangeOwner1da7bFail (address fuzzyNewOwner , address fuzzySender ) public {
95
68
vm.assume (fuzzySender != owner);
96
69
vm.broadcast (fuzzySender);
97
70
vm.expectRevert (bytes ("nope " ));
@@ -103,10 +76,6 @@ contract TestSetupWallet1 is Test {
103
76
vm.broadcast (owner);
104
77
vm.expectRevert (bytes ("Recipient should accept ether " ));
105
78
proxyWallet.distribute38c1b (payable (address (attacker)));
106
- assertEq (
107
- proxyWallet.getOwner15569 (),
108
- owner,
109
- "Owner should be contract deployer "
110
- );
79
+ assertEq (proxyWallet.getOwner15569 (), owner, "Owner should be contract deployer " );
111
80
}
112
81
}
0 commit comments