/durin

These contracts allow you to issue ENS subnames on an L2.

Primary LanguageSolidity

durin

Durin is an opinionated approach to ENS L2 subnames. Durin consists of:

  1. Registry factory on supported chains
  2. Registrar template
  3. Gateway server

Instructions To Deploy L2 ENS Subnames

This repo is meant to be used in conjuction with Durin.dev, which provides a frontend for deploying the registry & enabling name resolution.

1. Deploy Instance of Registry

Go to Durin.dev. Choose Sepolia or Mainnet ENS name resolution. Pick a supported L2 -- either mainnet or sepolia. Deploy.

Once complete note the deployed registry address on the L2.

2. Enable Name Resolution

To enable name resolution, change the resolver on the ENS name.

sepolia: 0x00f9314C69c3e7C37b3C7aD36EF9FB40d94eDDe1
mainnet: 0x2A6C785b002Ad859a3BAED69211167C7e998aAeC

After switching the resolver, add the following text record:

key: registry
value: {chain_id}:{registry_contract}

Both switching the resolver and adding the text record can be done via durin.dev or the ENS manager app.

3. Customize Registrar Template

Durin provides a registrar template designed for customization. Common customizations include adding pricing, implementing allow lists, and enabling token gating.

To get started clone this repo:

git clone git@github.com:resolverworks/durin.git
cd durin

Once cloned modify L2Registrar.sol as need it.

Durin uses foundry, to install follow the instructions.

4. Prepare .env

cp example.env .env
# Required: RPC URL for the chain where the registry is deployed
RPC_URL=

# Required: Private key of the deployer exclude "0x"
PRIVATE_KEY=

# Required: Etherscan API key for contract verification
ETHERSCAN_API_KEY=

# Required for L2Registrar contract deployment
REGISTRY_ADDRESS=

# Required to configure the deployed registry from durin.dev website. Add this after deploying the Registrar.
REGISTRAR_ADDRESS=Blank until step 5

5. Deploy L2Registrar Contract

bash deploy/deployL2Registrar.sh

Update Registrar address in .env

6. Connect Registrar to L2Registry

Only the Registrar can call register() on the Registry. The owner of the registry can add a registrar thus enabling minting. The configureRegistry.sh script adds the Registrar to the Registry by calling the addRegistrar()

bash deploy/configureRegistry.sh

Contracts

This repo includes the L2 contracts required to enable subname issuance.

  • L2RegistryFactory: L2 contract for creating new registries.
  • L2Registry: L2 contract that stores subnames as ERC721 NFTs. It's responsible for storing subname data like address and text records.
  • L2Registrar: An example registrar contract that can mint subnames. This is meant to be customized.

Active Registry Factory Deployments

L2 Registry Factory
Base 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb
Base Sepolia 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb
Optimism 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb
Optimism Sepolia 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb
Scroll 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb
Scroll Sepolia 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb
Arbitrum 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb
Arbitrum Sepolia 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb
Linea 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb
Linea Sepolia 0xA59eF1DCc0c4bcbDC718b95c0680b6B97Bb451eb

Architecture

architecture