This project is one of many components of NameKit. The goal of this contract template is helping ENS grow by incentivizing more wallets and apps to promote ENS name registration and renewal to their users. The contract enables those wallets & apps to define a custom price premium on top of the base rate for .eth names. This enables the creation of recurring revenue streams for builders who help ENS grow. We hope this creates more incentives for wallets & apps to onboard their users into ENS.
Each wallet and app should deploy their own instance of this contract that defines their specialized treasury address.
This contract only works for the registration and renewal of direct subnames of ".eth".
The contract is designed and optimized to spend as little gas overhead as possible. Users pay a little more for the app to have this revenue opportunity.
sequenceDiagram
autoNumber
App ->> User: Request base price + custom fee
User ->> NameKit: Register tx
NameKit ->> ENS: Forward register tx
ENS -->> User: Send ENS name
ENS -->> NameKit: Send refund (custom fee)
- The app gets the base price of the desired ".eth" name and adds their customized price premium. The app then requests this total value in the registration transaction to be approved by the user.
- The user approves the transaction, interacting with app's custom deployment of the NameKit Controller contract.
- The app's custom deployment of the NameKit Controller forwards the transaction to ETHRegistrarController with all the user-provided parameters.
- ETHRegistrarController sends the ENS name NFT to the user.
- The app's custom deployment of the NameKit Controller accrues their customized price premium, which can be withdrawn to their custom treasury address whenever desired.
- Node and Yarn, to run the scripts
- Infura API key, to deploy and interact with contracts
- Etherscan API key, to verify contracts
-
Install all the dependencies with Node and Yarn.
yarn
-
Copy the
sample.env
file and rename it to.env
, then complete all missing variables. -
If having the same contract address in testnet and mainnet is important to you, then the following steps are needed.
- Same treasury address across networks.
- If it's an EOA (address that comes from private key), no worries.
- If you want a Safe Multisig, then create your treasury here.
- The deployer private key must be a fresh account, with zero transactions. Make sure to send some ETH to this account in order to pay for fees on contract deployment.
- Same treasury address across networks.
-
Deploying contracts
- Sepolia
yarn deploy:sepolia
- Mainnet
yarn deploy:mainnet
-
Fork this repo and change the NamekitController and treasury addresses on README, for internal documentation.
🎉 Congrats, now you have a new way to generate revenue!!
Before running these commands, make sure to:
- Generate the typechain interfaces:
yarn compile
- Change CHAIN_ID in
.env
to the desired network you want to interact with. 1 = Mainnet, 11155111 = Sepolia.
- Make sure to fill the environment variables
- PLATFORM_URL: For making your registrations to count on ENSIP-14 standard.
- NAME_TO_REGISTER
yarn register-name
yarn withdraw
- Example NamekitController:
0x232332263e6e4bd8a134b238975e2200c8b7dac1
- Example NameKit Treasury:
0xC362EB2dDCde1866b263fF59778c0a6eF69eF4F3
- ENS ETHRegistrarController:
0x253553366Da8546fC250F225fe3d25d0C782303b
- ENS Public resolver:
0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41
- ENS Registry with fallback:
0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e
- Chainlink ETH/USD data feed
0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
- Example NamekitController:
0x1cf7735B2e2641274f6d038701c561010D2fCf46
- Example NameKit Treasury:
0xb3C70b0FEeFfE0F3a540514C8080147c296982d3
- ENS ETHRegistrarController:
0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72
- ENS Public resolver:
0x8FADE66B79cC9f707aB26799354482EB93a5B7dD
- ENS Registry with fallback:
0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e
- Chainlink ETH/USD data feed:
0x694AA1769357215DE4FAC081bf1f309aDC325306
ABIs are avaiable on Etherscan
Licensed under the MIT License, Copyright © 2023-present NameHash Labs.
See LICENSE for more information.