Skip to content

Commit

Permalink
feat: changed L2 resolver to ERC721Enumerable
Browse files Browse the repository at this point in the history
  • Loading branch information
Julink-eth committed Apr 18, 2023
1 parent 4611164 commit a29cdd2
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 40 deletions.
4 changes: 3 additions & 1 deletion packages/contracts/contracts/l1/LineaResolverStub.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,9 @@ contract LineaResolverStub is IExtendedResolver, SupportsInterface {
);

// step 2: check storage values, get itemId first and then get the address result
bytes32 tokenIdSlot = keccak256(abi.encodePacked(node, uint256(7)));
// the index slot 11 is for 'mapping(bytes32 => uint256) public addresses' in the L2 resolver
// the index slot 2 is for 'mapping(uint256 => address) private _owners' in the L2 resolver
bytes32 tokenIdSlot = keccak256(abi.encodePacked(node, uint256(11)));
(bool tokenIdExists, bytes32 tokenId) = getStorageValue(
l2resolver,
tokenIdSlot,
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/contracts/l2/LineaResolver.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.18;

import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
Expand All @@ -12,7 +12,7 @@ import "@ensdomains/ens-contracts/contracts/utils/NameEncoder.sol";
@dev A Solidity contract that implements an ERC721 token for resolving Ethereum domain names to addresses.
@author ConsenSys
*/
contract LineaResolver is ERC721, Ownable {
contract LineaResolver is ERC721Enumerable, Ownable {
// Mapping to store Ethereum domain names (as bytes32) and their corresponding addresses (as uint256)
mapping(bytes32 => uint256) public addresses;
// Mapping to store token IDs (as uint256) and their corresponding domain name (as string)
Expand Down
2 changes: 1 addition & 1 deletion packages/contracts/scripts/deployL2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function main() {
address: lineaResolver.address,
constructorArguments: [nftName, symbol, baseUri],
});
}, 20000);
}, 30000);
}
}

Expand Down
Loading

0 comments on commit a29cdd2

Please sign in to comment.