Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b0d05dd
chore: removes boilerplate sample files
0xItadaki Aug 19, 2025
0df451e
fix: fixes micromatch security vulnerability
0xItadaki Aug 19, 2025
af97185
docs: updates README header
0xItadaki Aug 19, 2025
a414f97
chore: updates solc_version to 0.8.30
0xItadaki Aug 19, 2025
ed862f2
chore: comments medusa and halmos CI tests
0xItadaki Aug 19, 2025
06dd078
feat: adds IL2Resolver interface with variables
0xItadaki Aug 19, 2025
4f9888e
feat: implements L2Resolver with constants and records mapping
0xItadaki Aug 19, 2025
b77398a
feat: adds empty IENS and INameWrapper interfaces
0xItadaki Aug 19, 2025
78571ad
feat: implements L2Resolver constructor
0xItadaki Aug 19, 2025
972f503
feat: makes state variables public
0xItadaki Aug 19, 2025
822121e
test: implements L2Resolver constructor unit tests
0xItadaki Aug 19, 2025
1abdb94
style: fixes _REVERSE_LOOKUP_NODE
0xItadaki Aug 19, 2025
05ccc90
chore: tidy up and clear boilerplate sample files (#1)
0xItadaki Aug 19, 2025
21447d5
Merge branch 'dev' into feat/L2Resolver-contract-constructor
0xItadaki Aug 19, 2025
909946a
test: adds empty IntegrationL2Resolver to fix CI
0xItadaki Aug 19, 2025
e1fd7c5
refactor: makes REVERSE_LOOKUP_NODE public
0xItadaki Aug 19, 2025
61d875a
style: removes unnecessary spaces
0xItadaki Aug 19, 2025
2323509
chore: comments integration tests from CI
0xItadaki Aug 19, 2025
1e0782c
chore: fixes version to 0.8.30
0xItadaki Aug 19, 2025
e1d50be
feat: L2Resolver state variables and constructor w/unit tests (#2)
0xItadaki Aug 19, 2025
62dab74
feat: implement IERC165
0xAustrian Aug 19, 2025
72a28c0
Merge branch 'dev' into feat/implement-IERC165
0xAustrian Aug 19, 2025
c5e7c0d
test: add unit tests
0xAustrian Aug 19, 2025
cb5212b
chore: oz dependency
0xAustrian Aug 20, 2025
a394908
chore: new line at the end of .tree
0xAustrian Aug 20, 2025
5996843
Merge branch 'dev' into feat/implement-IERC165
0xAustrian Aug 20, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"devDependencies": {
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@openzeppelin/contracts": "5.4.0",
"forge-std": "github:foundry-rs/forge-std#1.9.2",
"halmos-cheatcodes": "github:a16z/halmos-cheatcodes#c0d8655",
"husky": ">=9",
Expand Down
1 change: 1 addition & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
forge-std/=node_modules/forge-std/src
halmos-cheatcodes=node_modules/halmos-cheatcodes
openzeppelin-contracts=node_modules/@openzeppelin/contracts
Comment thread
0xItadaki marked this conversation as resolved.

contracts/=src/contracts
interfaces/=src/interfaces
9 changes: 8 additions & 1 deletion src/contracts/L2Resolver.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.30;

import {IERC165} from 'openzeppelin-contracts/interfaces/IERC165.sol';
import {IENS} from 'src/interfaces/IENS.sol';
import {IExtendedResolver} from 'src/interfaces/IExtendedResolver.sol';
import {IL2Resolver} from 'src/interfaces/IL2Resolver.sol';
import {INameWrapper} from 'src/interfaces/INameWrapper.sol';

Expand All @@ -12,7 +14,7 @@ import {INameWrapper} from 'src/interfaces/INameWrapper.sol';
* formatted chain identifiers and allows reverse lookup by mapping them back to their primary ENS names.
* EIP-7930 is an example of supported chain identifier.
*/
contract L2Resolver is IL2Resolver {
contract L2Resolver is IL2Resolver, IERC165 {
/// @inheritdoc IL2Resolver
bytes32 public constant REVERSE_LOOKUP_NODE = bytes32(keccak256('reverse.chain.id.eip7930'));

Expand Down Expand Up @@ -81,6 +83,11 @@ contract L2Resolver is IL2Resolver {
_chainId = this.getRecord(_node, CHAIN_IDENTIFIER_EIP7930_KEY);
}

/// @inheritdoc IERC165
function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool _isSupported) {
_isSupported = _interfaceId == type(IERC165).interfaceId || _interfaceId == type(IExtendedResolver).interfaceId;
}

/**
* @notice Returns the owner of a node.
* @dev If the node is the NameWrapper, then the domain is wrapped and it gets the owner from the NameWrapper.
Expand Down
12 changes: 12 additions & 0 deletions src/interfaces/IExtendedResolver.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.30;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's okay to leave out the interface comments when they are not ours, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added them only because the pre-commit fails without the natspec

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I meant the @author, @title, etc type of comments. Do we need those or not needed since it is not our interface?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh got it, I think we can 100% skip them

interface IExtendedResolver {
/**
* @notice Provides a mechanism to support wildcard resolution of ENS names
* @param _name The name to resolve
* @param _data The data to resolve
* @return _result The result of the resolution
*/
function resolve(bytes memory _name, bytes memory _data) external view returns (bytes memory _result);
}
20 changes: 20 additions & 0 deletions test/unit/L2Resolver.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
pragma solidity 0.8.30;

import {Test} from 'forge-std/Test.sol';
import {IERC165} from 'openzeppelin-contracts/interfaces/IERC165.sol';
import {L2Resolver} from 'src/contracts/L2Resolver.sol';

import {IENS} from 'src/interfaces/IENS.sol';
import {IExtendedResolver} from 'src/interfaces/IExtendedResolver.sol';
import {IL2Resolver} from 'src/interfaces/IL2Resolver.sol';
import {INameWrapper} from 'src/interfaces/INameWrapper.sol';

Expand Down Expand Up @@ -343,6 +345,24 @@ contract UnitL2Resolver is Test {
assertEq(_l2Resolver.chainId(_nodeNameHash), '');
}

function test_SupportsInterfaceWhenCheckingERC165InterfaceId() external view {
// it returns true
assertTrue(_l2Resolver.supportsInterface(type(IERC165).interfaceId));
}

function test_SupportsInterfaceWhenCheckingExtendedResolverInterfaceId() external view {
// it returns true
assertTrue(_l2Resolver.supportsInterface(type(IExtendedResolver).interfaceId));
}

function test_SupportsInterfaceWhenCheckingAnUnsupportedInterfaceId(bytes4 _interfaceId) external view {
vm.assume(_interfaceId != type(IERC165).interfaceId);
vm.assume(_interfaceId != type(IExtendedResolver).interfaceId);

// it returns false
assertFalse(_l2Resolver.supportsInterface(_interfaceId));
}

/**
* @notice Sets up a mock and expects a call to it
*
Expand Down
8 changes: 8 additions & 0 deletions test/unit/L2Resolver.tree
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,11 @@ UnitL2Resolver::chainId
│ └── it returns the stored EIP-7930 bytes
└── when the chain identifier is not set
└── it returns empty bytes

UnitL2Resolver::supportsInterface
├── when checking ERC165 interface id
│ └── it returns true
├── when checking ExtendedResolver interface id
│ └── it returns true
└── when checking an unsupported interface id
└── it returns false
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@
"@nodelib/fs.scandir" "2.1.5"
fastq "^1.6.0"

"@openzeppelin/contracts@5.4.0":
version "5.4.0"
resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-5.4.0.tgz#177594bdb2d86c71f5d1052fe40cb4edb95fb20f"
integrity sha512-eCYgWnLg6WO+X52I16TZt8uEjbtdkgLC0SUX/xnAksjjrQI4Xfn4iBRoI5j55dmlOhDv1Y7BoR3cU7e3WWhC6A==

"@solidity-parser/parser@^0.19.0":
version "0.19.0"
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.19.0.tgz#37a8983b2725af9b14ff8c4a475fa0e98d773c3f"
Expand Down
Loading