Skip to content

Commit fe60609

Browse files
committed
fix: ownable constructor invocation
1 parent 9af82ed commit fe60609

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/l2/SelfOwned.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol";
66
import {SignetL2} from "./Signet.sol";
77

88
abstract contract SelfOwned is SignetL2, Ownable {
9-
constructor() {
10-
Ownable(aliasedSelf());
9+
constructor() Ownable(aliasedSelf()) {
1110
}
1211
}

test/SelfOwned.sol

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,15 @@ pragma solidity ^0.8.13;
44
import {SimpleERC20} from "simple-erc20/SimpleERC20.sol";
55

66
import {PecorinoTest} from "./Base.sol";
7+
78
import {SignetL2} from "../src/l2/Signet.sol";
9+
import {SelfOwned} from "../src/l2/SelfOwned.sol";
810
import {AddressAliasHelper} from "../src/vendor/AddressAliasHelper.sol";
911

12+
contract SelfOwnedNothing is SelfOwned() {
13+
constructor() {}
14+
}
15+
1016
contract SelfOwnedToken is SignetL2, SimpleERC20 {
1117
constructor() SimpleERC20(aliasedSelf(), "My Token", "MTK", 18) {
1218
assert(HOST_WETH != address(0));
@@ -16,11 +22,18 @@ contract SelfOwnedToken is SignetL2, SimpleERC20 {
1622
contract TestSelfOwned is PecorinoTest {
1723
SelfOwnedToken token;
1824

25+
SelfOwnedNothing nothing;
26+
1927
constructor() {
2028
token = new SelfOwnedToken();
29+
nothing = new SelfOwnedNothing();
2130
}
2231

23-
function test_ownerIsSelfOnL1() public view {
32+
function test_tokenOwnerIsSelfOnL1() public view {
2433
assertEq(token.owner(), AddressAliasHelper.applyL1ToL2Alias(address(token)));
2534
}
35+
36+
function test_nothingOwnerIsSelfOnL1() public view {
37+
assertEq(nothing.owner(), AddressAliasHelper.applyL1ToL2Alias(address(nothing)));
38+
}
2639
}

0 commit comments

Comments
 (0)