Upgrade to Pro — share decks privately, control downloads, hide ads and more …

NameWrapper

Makoto Inoue
October 18, 2021

 NameWrapper

Makoto Inoue

October 18, 2021
Tweet

More Decks by Makoto Inoue

Other Decks in Programming

Transcript

  1. #ensworkshop • ENS released in May 2017 predating ERC721. It

    is an NFT but not standard • .eth names used deed contracts to deal with ownership • During the ENS migration we updated .eth namespace to ERC721 • Subdomains remain are registry controlled (not ERC721) • .eth = ERC721 subdomains ≠ ERC721/1155 Aren’t .eth names already NFTs?
  2. #ensworkshop • Initially we wanted to rewrite the subdomain registrar

    (now.ens.domains) to make all subdomains NFTs • Original contract allows committing .eth name ◦ allows other users to register a subdomain of that name ◦ E.g. commit gimmethe.eth and let users register sub.gimmethe.eth Why create the NameWrapper?
  3. #ensworkshop • We wanted *all* ENS names to be a

    standards compliant NFTs • So we decided to create a new base level contract to wrap any ENS name • This would allow the ENS subdomains and .eth NFTs to all be part of the same collection, instead of separate tokens (such as dcl.eth) and fragmenting the ENS world. Why create the NameWrapper?
  4. #ensworkshop • The Name Wrapper is a base level contract

    that can wrap any ENS name (similar to the WETH contract) • Names can be wrapped and unwrapped • Names have the ability to burn permissions ◦ E.g. replacing subdomains so parent owners cannot take names What is the Name Wrapper?
  5. #ensworkshop • It wraps registry functionality such as setResolver() •

    It becomes the source of truth for name ownership for wrapped names • Wrapped names follow the ERC1155 token standard • .eth names will be wrapped by default on registration (old names can optionally migrate) • on-chain preimage - the name is passed as a string ◦ The preimage is a namehash => name dictionary What is the Name Wrapper?
  6. #ensworkshop • It takes a bit of extra gas to

    register a name, but we have been as gas efficient as possible and increased the efficiency of the registrar controller for registration • Wrapping is not forced so there will likely be two tokens representing .eth names • Expiry of .eth names can unwrap and unburn permissions ◦ To insure names can’t be rugged, the parent name must be renewed (names can be renewed by anyone) Caveats of the NameWrapper
  7. #ensworkshop How to wrap a .eth name 1. Transfer your

    .eth ERC721 to the NameWrapper How to interact with the NameWrapper
  8. #ensworkshop How to wrap other names (DNSSEC/subdomains) 1. Call wrap()

    a. Approve the wrapper on the registry b. Call wrap() How to interact with the NameWrapper
  9. #ensworkshop Checking ownership of a .eth name: 1. Check owner

    on registrar a. BaseRegistrar.ownerOf(tokenId) 2. If owner is NameWrapper contract, check owner on NameWrapper a. NameWrapper.ownerOf(tokenId) How to interact with the NameWrapper
  10. #ensworkshop Checking permissions 1. Check if name is wrapped: 2.

    NameWrapper.getFuses(namehash) 3. Returns a number representing permissions and NameSafety How to interact with the NameWrapper
  11. #ensworkshop • Create your own subdomain registrar contract • Our

    plan is to create a generalised version of this • E.g cod.eth wants to create subdomains for all call of duty users What can you do with the NameWrapper?
  12. #ensworkshop ENS subdomains as art collections • fruit.eth is a

    hypothetical art collection • apple.fruit.eth and banana.fruit.eth are pieces in that collection • Since subdomains are now ERC1155, we can allow custom metadata and images • But each art piece is also a fully functional ENS name • Each piece can point to a website that explains some easter egg information about it, or set cryptocurrency addresses. What can you do with the NameWrapper?
  13. #ensworkshop • Contracts have been written and audited • Basic

    UI support is in development • Controller contracts (registration of .eth) have been edited and are currently being made more gas efficient. This includes reverse record on registration and wrapping on registration • Advanced support for the wrapper is planned for the new redesign. What’s left?
  14. #ensworkshop Q&A Questions? Feel free to DM me any questions

    at @_jefflau on Twitter on Jeff on the ENS discord