Skip to content

Commit 09b3203

Browse files
committed
chore: fix lint
1 parent 575fb2f commit 09b3203

5 files changed

Lines changed: 37 additions & 29 deletions

File tree

test/ConstructorProbe.sol

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// SPDX-License-Identifier: Apache-2.0 OR MIT
2+
pragma solidity ^0.8.36;
3+
4+
contract ConstructorProbe {
5+
address public immutable DEPLOYED_AT;
6+
address public immutable CALLER;
7+
uint256 public immutable CALLVALUE;
8+
9+
uint256 public storedValue;
10+
11+
constructor(uint256 value) payable {
12+
DEPLOYED_AT = address(this);
13+
CALLER = msg.sender;
14+
CALLVALUE = msg.value;
15+
storedValue = value;
16+
}
17+
}

test/Deployment.t.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ contract DeploymentTest is Test {
7676
vm.prank(owner);
7777
DEPLOYER.deploy{value: 1 ether}(reserved, initCode);
7878

79-
assertEq(PayableExample(reserved).constructorValue(), 1 ether);
79+
assertEq(PayableExample(reserved).CALLVALUE(), 1 ether);
8080
assertEq(reserved.balance, 1 ether);
8181
assertEq(address(DEPLOYER).balance, 2 ether);
8282
}

test/Init.t.sol

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,11 @@
11
// SPDX-License-Identifier: Apache-2.0 OR MIT
22
pragma solidity ^0.8.36;
33

4-
import {Example} from "./Example.sol";
54
import {Test} from "forge-std/Test.sol";
65

7-
contract ConstructorProbe {
8-
address public immutable deployedAt;
9-
address public immutable constructorCaller;
10-
uint256 public immutable constructorValue;
11-
uint256 public storedValue;
12-
13-
constructor(uint256 value) payable {
14-
deployedAt = address(this);
15-
constructorCaller = msg.sender;
16-
constructorValue = msg.value;
17-
storedValue = value;
18-
}
19-
}
20-
21-
contract RevertingConstructor {
22-
error ExpectedRevert(uint256 value);
23-
24-
constructor() {
25-
revert ExpectedRevert(42);
26-
}
27-
}
6+
import {ConstructorProbe} from "./ConstructorProbe.sol";
7+
import {Example} from "./Example.sol";
8+
import {RevertingConstructor} from "./RevertingConstructor.sol";
289

2910
contract InitTest is Test {
3011
bytes constant INIT_CODE = hex"385f5f5f335afa5f5f5f5f5f515af43d5f5f3e16601a573d5ffd5b3d5ff30000";
@@ -57,13 +38,13 @@ contract InitTest is Test {
5738

5839
(bool success, bytes memory returned) = init.call{value: 7}("");
5940
assertTrue(success);
60-
assertGt(returned.length, 0);
41+
assertEq(returned.length, vm.getDeployedCode("ConstructorProbe").length);
6142

6243
vm.etch(init, returned);
6344
ConstructorProbe probe = ConstructorProbe(init);
64-
assertEq(probe.deployedAt(), init);
65-
assertEq(probe.constructorCaller(), address(this));
66-
assertEq(probe.constructorValue(), 7);
45+
assertEq(probe.DEPLOYED_AT(), init);
46+
assertEq(probe.CALLER(), address(this));
47+
assertEq(probe.CALLVALUE(), 7);
6748
assertEq(probe.storedValue(), 42);
6849
}
6950

test/PayableExample.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
pragma solidity ^0.8.36;
33

44
contract PayableExample {
5-
uint256 public immutable constructorValue;
5+
uint256 public immutable CALLVALUE;
66

77
constructor() payable {
8-
constructorValue = msg.value;
8+
CALLVALUE = msg.value;
99
}
1010
}

test/RevertingConstructor.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SPDX-License-Identifier: Apache-2.0 OR MIT
2+
pragma solidity ^0.8.36;
3+
4+
contract RevertingConstructor {
5+
error ExpectedRevert(uint256 value);
6+
7+
constructor() {
8+
revert ExpectedRevert(42);
9+
}
10+
}

0 commit comments

Comments
 (0)