makoto / my-l2-app-v2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ENS L2 demo app (v2)

This is the rewrite of v1 but using EVM Gateway instead of dm3's Bedrock Resolver.

The demo allows anyone to either register subnames under op.evmgateway.eth on Optimism Goerli chain or subnames under base.evmgateway.eth on $BASE chain.

Setting up the server

gh repo clone makoto/my-l2-app-v2
cd my-l2-app-v2
yarn
cp .env.example .env // Update the constants
yarn start

Video Walkthrough

Setting up the subname registrar for your own name

Set resolver of your name to one of these resolvers on Goerli

Find out the corresponding l2 resovler address via DelegatableResolverFactory

On L2, each parent name will own its own resolver and you issue subnames under your resolver.

const l2resolverAddress = await DelegatableResolverFactory.predictAddress(OWNER_ADDRESS)

Set the l2 resolver address as a traget

YOURNAME = 'somenewname.eth'
node = ethers.namehash(`(base|op).{YOURNAME}`)
await L1Resolver.setTarget(node, l2resolverAddress)

Deploy l2 subname registrar

Grant the subname registrar as the root

const DelegatableResolver = new ethers.Contract(l2resolverAddress, abi, l2provider);
await DelegatableResolver.approve(encodedname, DELEGATABLE_RESOLVER_REGISRTRAR_ADDRESS, true)

Replace evmgateway.eth on this repo's code to your ENS name

About


Languages

Language:JavaScript 93.8%Language:HTML 4.0%Language:CSS 2.2%