Skip to content

Commit ebc5895

Browse files
committed
feat: SignetL1Ephemeral
1 parent 7333cc0 commit ebc5895

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/l1/Signet.sol

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,9 @@ abstract contract SignetL1 {
5454
}
5555
}
5656

57-
/// @notice This is used to know whether to alias. It should generally
58-
/// return false. If writing an ephemeral contract, override to return true.
59-
function isEphemeral() internal pure virtual returns (bool) {
60-
return false;
61-
}
62-
63-
/// @notice Returns
64-
function selfOnL2() internal view returns (address) {
65-
if (isEphemeral()) {
66-
return address(this);
67-
}
57+
/// @notice Returns the address of this contract on L2, applying an
58+
/// address alias.
59+
function selfOnL2() internal view virtual returns (address) {
6860
if (address(this).code.length == 23) {
6961
bool is7702;
7062
assembly {

src/l1/SignetL1Ephemeral.sol

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SPDX-License-Identifier: UNLICENSED
2+
pragma solidity ^0.8.13;
3+
4+
import {SignetL1} from "./Signet.sol";
5+
6+
abstract contract SignetL1Ephemeral is SignetL1 {
7+
function selfOnL2() internal view override returns (address) {
8+
return address(this);
9+
}
10+
}

0 commit comments

Comments
 (0)