How can I allow users to register subdomains with the new subdomain registrar?

Hey guys,

I’m currently trying to use the new RentalSubdomainRegistrar to allow users to register subdomains for my 2LD. I have deployed the contract on goerli and have used the ETH Namewrapper contract address deployed on goerli as the constructor arg.

I have some questions about how to do this. Apologies if some of them sound amateurish but this is my first time working with ENS and the documentation for the new features isn’t fully out yet. Also, I’d really like to launch my project asap:

  1. Do I need to deploy a separate registrar for each 2LD?
  2. When calling the setup domain function, what address token should I use?
  3. Do I need to wrap the 2LD before using it with the contract?
  4. If the 2LD is wrapped and has issued subdomains, can it be unwrapped and used normally again?
  5. Who’s address should beneficiary address be in setupDomain in the SubdomainRentalRegistrar?
  6. What is the gas cost for calling setup domain? I tried doing it and I got 3ETH.

I hope someone from your team can help me out with these questions.

Thanks!

1 Like
  1. No, same contract can be used. And it’s not just for 2LDs.
  2. Any token you want to use as the fee, like WETH
  3. Yes, your name must first be Locked (CANNOT_UNWRAP burned)
  4. No. The name is Locked, see #3
  5. Any address you want. Your address, presumably.
  6. If you’re seeing ridiculously high gas prices, it’s probably because the transaction is expected to revert, so your wallet wasn’t able to estimate gas properly. You probably still need to approve your contract as an operator for the Name Wrapper. Or perhaps there is an issue with your contract.

Note that those subdomain registrar contracts in Jeff’s PR are in a draft state, still need reviewing/testing, and are not yet recommended for use.

3 Likes

Thanks! I managed to set up the domain, however I have two questions:

  1. What units should fee be in?
  2. The contract interface on etherscan shows a ‘register’ input field which asks for ether amount (shown in image). If I leave it blank, I cannot write to the contract. And if I fill in a value the contract cannot estimate gas, which I assume means there’s some issue.

See the top of that rental class in the PR, it denotes that the fee is per-second of duration that a name is registered for. Each token has its own base units that determine what UIs should display, but from the ERC-20 contract perspective you’re just dealing with the smallest unit, 10^-18 I believe.

Not sure if that method is meant to be payable or not since it should be using a separate ERC-20 token contract. Filling in zero should suffice, and of course I think you’ll need to approve that contract to spend said tokens too.

3 Likes

Awesome, thanks!