From cce54c06b372c22e60d0eae3c04fa0c4816262b1 Mon Sep 17 00:00:00 2001 From: "Serenae.eth" Date: Thu, 14 Nov 2024 15:45:44 -0500 Subject: [PATCH 1/4] Adding L2 notes to Naming Contracts page. Also adding note to subname registrar page. --- docs/web/naming-contracts.mdx | 47 +++++++++++++++++++++ docs/wrapper/creating-subname-registrar.mdx | 2 + 2 files changed, 49 insertions(+) diff --git a/docs/web/naming-contracts.mdx b/docs/web/naming-contracts.mdx index a8c5b6b6..4ace7efc 100644 --- a/docs/web/naming-contracts.mdx +++ b/docs/web/naming-contracts.mdx @@ -82,3 +82,50 @@ You can do so by hitting the `setNameForAddr` function on the [Reverse Registrar From your contract you can execute `setName` function on the [Reverse Registrar](/registry/reverse) + +## L2 Contracts + +If you want to set a primary name for a contract you are deploying on an L2 chain, you need to make sure your contract implements the [Ownable](https://docs.openzeppelin.com/contracts/5.x/api/access#Ownable) interface from OpenZeppelin, and has an account you own set as the owner. + +You will also need to locate the canonical Reverse Resolver for that L2 chain. We currently do not have a way to discover those contracts, but for now, selected deployments are listed here: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NetworkL2ReverseResolver deployment
Base`0x0D3b4af7f0f89C67163e5A301Ba1b37A16C968f1`
Base Sepolia`0xa12159e5131b1eEf6B4857EEE3e1954744b5033A`
Arbitrum Sepolia`0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376`
Linea Sepolia`0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376`
Optimism Sepolia`0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376`
Scroll`0x0d3b4af7f0f89c67163e5a301ba1b37a16c968f1`
Scroll Sepolia`0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62`
+ +Then, after you've deployed your contract, call `setNameForAddr(address addr, string name)` on the L2 Reverse Resolver from your authorized owner account. The `addr` is the address of your contract, and `name` is the ENS name to set it to. diff --git a/docs/wrapper/creating-subname-registrar.mdx b/docs/wrapper/creating-subname-registrar.mdx index 01a15553..4b8496c1 100644 --- a/docs/wrapper/creating-subname-registrar.mdx +++ b/docs/wrapper/creating-subname-registrar.mdx @@ -76,6 +76,8 @@ If you want your subname registrar to set records on a subname in the same regis * Call whatever resolver methods you need to. Perhaps these are records that you want to be pre-set on your subnames (such as an ETH address that the subname points to). Or perhaps these are records that you allow the registrant to pass in, so that they can register their subname and set whatever records they want all in one transaction. * Call `setSubnodeRecord`, but this time set the owner to the actual intended owner of the subname. This is the point at which you should set the appropriate fuses and expiry you want to, as well. +In addition, you will need to make sure your contract follows the ERC-1155 Token Receiver rules. This means implementing the `onERC1155Received` and `onERC1155BatchReceived` methods, and signaling support for them in your ERC-165 `supportsInterface` method. OpenZeppelin has an easy abstract contract you can include for all this: ERC1155Holder.sol + ### Taking fees If you are setting up a "rental" registrar, then your registration function should require a certain amount of ETH to be sent in as well. From cc1932877b52652d8894804bba10be7533f47e7b Mon Sep 17 00:00:00 2001 From: Greg Skriloff <35093316+gskril@users.noreply.github.com> Date: Wed, 20 Nov 2024 21:20:33 -0500 Subject: [PATCH 2/4] Use markdown for table --- docs/web/naming-contracts.mdx | 45 ++++++----------------------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/docs/web/naming-contracts.mdx b/docs/web/naming-contracts.mdx index 4ace7efc..7a6f9517 100644 --- a/docs/web/naming-contracts.mdx +++ b/docs/web/naming-contracts.mdx @@ -89,43 +89,12 @@ If you want to set a primary name for a contract you are deploying on an L2 chai You will also need to locate the canonical Reverse Resolver for that L2 chain. We currently do not have a way to discover those contracts, but for now, selected deployments are listed here: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NetworkL2ReverseResolver deployment
Base`0x0D3b4af7f0f89C67163e5A301Ba1b37A16C968f1`
Base Sepolia`0xa12159e5131b1eEf6B4857EEE3e1954744b5033A`
Arbitrum Sepolia`0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376`
Linea Sepolia`0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376`
Optimism Sepolia`0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376`
Scroll`0x0d3b4af7f0f89c67163e5a301ba1b37a16c968f1`
Scroll Sepolia`0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62`
+| Network | L2ReverseResolver deployment | +| ---------------- | ------------------------------------------ | +| Base Sepolia | 0xa12159e5131b1eEf6B4857EEE3e1954744b5033A | +| OP Sepolia | 0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376 | +| Arbitrum Sepolia | 0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376 | +| Scroll Sepolia | 0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62 | +| Linea Sepolia | 0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376 | Then, after you've deployed your contract, call `setNameForAddr(address addr, string name)` on the L2 Reverse Resolver from your authorized owner account. The `addr` is the address of your contract, and `name` is the ENS name to set it to. From 05e6732b8fe9b0c8700a889888bbcfb17d98e956 Mon Sep 17 00:00:00 2001 From: "Serenae.eth" Date: Thu, 19 Dec 2024 09:19:52 -0500 Subject: [PATCH 3/4] Adding notes on setName --- docs/web/naming-contracts.mdx | 39 +++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/docs/web/naming-contracts.mdx b/docs/web/naming-contracts.mdx index 7a6f9517..0022cc67 100644 --- a/docs/web/naming-contracts.mdx +++ b/docs/web/naming-contracts.mdx @@ -62,6 +62,23 @@ contract ReverseClaimer { } ``` +You can also call the ReverseRegistrar's `setName` function directly. However note that if you do this, you will not be able to change the primary name for that contract ever again. Also remember to set the ETH address on your ENS name to the address at which your contract was deployed. + +```solidity +import {ENS} from "../registry/ENS.sol"; +import {IReverseRegistrar} from "../reverseRegistrar/IReverseRegistrar.sol"; + +contract ReverseClaimer { + bytes32 constant ADDR_REVERSE_NODE = + 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2; + + constructor(ENS ens, string primaryName) { + IReverseRegistrar reverseRegistrar = IReverseRegistrar(ens.owner(ADDR_REVERSE_NODE)); + reverseRegistrar.setName(primaryName); + } +} +``` + You can read more about setting a primary name for a contract in on the [support page](https://support.ens.domains/en/articles/7902626-set-primary-name-for-contract). ## Existing Contracts @@ -85,16 +102,20 @@ From your contract you can execute `setName` function on the [Reverse Registrar] ## L2 Contracts -If you want to set a primary name for a contract you are deploying on an L2 chain, you need to make sure your contract implements the [Ownable](https://docs.openzeppelin.com/contracts/5.x/api/access#Ownable) interface from OpenZeppelin, and has an account you own set as the owner. +### L2 - Ownable -You will also need to locate the canonical Reverse Resolver for that L2 chain. We currently do not have a way to discover those contracts, but for now, selected deployments are listed here: +If you want to set a primary name for a contract you are deploying on an L2 chain, you need to make sure your contract implements the [Ownable](https://docs.openzeppelin.com/contracts/5.x/api/access#Ownable) interface from OpenZeppelin, and has an account you own set as the owner. -| Network | L2ReverseResolver deployment | -| ---------------- | ------------------------------------------ | -| Base Sepolia | 0xa12159e5131b1eEf6B4857EEE3e1954744b5033A | -| OP Sepolia | 0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376 | -| Arbitrum Sepolia | 0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376 | -| Scroll Sepolia | 0xc0497E381f536Be9ce14B0dD3817cBcAe57d2F62 | -| Linea Sepolia | 0x74E20Bd2A1fE0cdbe45b9A1d89cb7e0a45b36376 | +You will also need to locate the canonical Reverse Registry for that L2 chain. We currently do not have a way to discover those contracts, but for now, selected deployments are listed here: [Primary Names](/web/reverse#set) Then, after you've deployed your contract, call `setNameForAddr(address addr, string name)` on the L2 Reverse Resolver from your authorized owner account. The `addr` is the address of your contract, and `name` is the ENS name to set it to. + +### L2 - Manually + +Another option is to call the L2ReverseRegistry's `setName(string name)` function directly, in the constructor of your contract. However note that if you do this, you will not be able to change the primary name for that contract ever again. + + + Make sure that the ENS name also resolves to your contract address for the appropriate cointype. + + For example, if you are deploying a contract on Base, make sure you set the Base address on your ENS name to your contract address. + From 296e55473aa8c4cb74f7a89ca30f25dadc91b637 Mon Sep 17 00:00:00 2001 From: "Serenae.eth" <95138671+serenae-fansubs@users.noreply.github.com> Date: Thu, 9 Jan 2025 15:13:04 -0500 Subject: [PATCH 4/4] Update docs/web/naming-contracts.mdx Co-authored-by: Greg <35093316+gskril@users.noreply.github.com> --- docs/web/naming-contracts.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/web/naming-contracts.mdx b/docs/web/naming-contracts.mdx index 0022cc67..6d13a859 100644 --- a/docs/web/naming-contracts.mdx +++ b/docs/web/naming-contracts.mdx @@ -102,6 +102,8 @@ From your contract you can execute `setName` function on the [Reverse Registrar] ## L2 Contracts +Primary Names are not yet supported on L2s. In the meantime, the following sections only apply to testnet ENS deployments. Mainnet support should be coming by the end of January 2025. + ### L2 - Ownable If you want to set a primary name for a contract you are deploying on an L2 chain, you need to make sure your contract implements the [Ownable](https://docs.openzeppelin.com/contracts/5.x/api/access#Ownable) interface from OpenZeppelin, and has an account you own set as the owner.