πŸ“–
Pulse Domains
  • πŸ‘‹Introduction
  • 🟒Registration FAQ
  • πŸ“’Terminology
  • Guides
    • πŸͺ„Domain Registration
    • πŸ§β€β™€οΈUpdating Your Profile
    • πŸ₯·Preserving Your Privacy
    • πŸ‘₯Creating Subdomains
    • πŸ›©οΈDomain Transfer
    • 🀝DNS Domain Setup
    • 🍭Brand Guidelines
    • πŸ’ΈReferrals
    • πŸ“œWhitelist & Claims
    • 🌟Registration Widget
    • πŸͺ…CCIP & PNS
    • πŸͺ…Name Renewal
  • Deep Dives
    • 🍬Name Wrapper
      • πŸ”₯Fuses
      • ⏳Expiry
      • βœ…Approved Operators
    • πŸ‘¨β€πŸ”§Managing a Name
    • πŸ”€Homoglyphs
  • pls.fyi Profile
    • ✨Your Web3 Profile
  • PLS.TO dWeb
    • πŸͺInterPlanetary FileSystem (IPFS)
    • 🌐Your Decentralized Website
    • πŸ’»IPFS & PLS.TO Guide
  • Partner Sites
    • πŸ“ˆPulseCoinList.com
    • πŸ’±PulseSwap.io: The Aggregator of Aggregators
      • πŸ“ˆ Integration for Developers and Projects
  • Dapp Developer Guide
    • πŸ› οΈGetting Started
      • PNS Enabling your DApp
      • PNS Libraries
      • Working with PNS
      • Resolving Names
      • Managing Names
      • Registering & Renewing Names
      • PNS Front-End Design Guidelines
      • PNS as NFT
      • PNS Data guide
    • πŸ›Bug Bounty Program & Audit
  • βš™οΈContract Api Reference
    • πŸ“œDeployed Contracts
    • Name Processing
    • Registry
    • ReverseRegistrar
    • TestRegistrar
    • PublicResolver
    • .pls Permanent Registrar
      • Registrar
      • Controller
    • DNS Registrar
    • Name Wrapper
      • Expiry
      • Fuses
      • Wrapped States
    • Subgraph
      • Entities
      • Queries
  • πŸ“™Contract Developer Guide
    • Resolving Names On-chain
    • Writing a Resolver
    • Writing a Registrar
  • πŸ¦Έβ€β™‚οΈCommunity
    • Community Dev Resources
  • Links
    • πŸ•ΉοΈPNS App
    • 🐦Twitter
    • ✈️Telegram
    • πŸ’‘PNS Name Ideas (Community Site)
Powered by GitBook
On this page

Was this helpful?

  1. Contract Developer Guide

Writing a Registrar

A registrar in PNS is simply any contract that owns a name, and allocates subdomains of it according to some set of rules defined in the contract code. A trivial first in first served contract is demonstrated below:

contract FIFSRegistrar {
    PNS pns;
    bytes32 rootNode;

    function FIFSRegistrar(address pnsAddr, bytes32 node) {
        pns = PNS(ensAddr);
        rootNode = node;
    }

    function register(bytes32 subnode, address owner) {
        var node = sha3(rootNode, subnode);
        var currentOwner = ens.owner(node);

        if (currentOwner != 0 && currentOwner != msg.sender) throw;

        pns.setSubnodeOwner(rootNode, subnode, owner);
    }
}

You may wish to set custom rules for the allocation of new names to your users; the rules you set are entirely up to you.

You should also bear in mind that as long as you retain ownership of the parent name - either directly or through another contract - your users have no guarantee that you will not take back ownership of their names and change what they resolve to. You may wish to consider committing ownership of the name to a contract that restricts your ability to control it.

PreviousWriting a ResolverNextCommunity Dev Resources

Last updated 1 year ago

Was this helpful?

πŸ“™