From a97255a8acd7ce474991723ad97d9912dafe9071 Mon Sep 17 00:00:00 2001 From: Jeff Lau Date: Thu, 21 Dec 2023 13:43:54 +0800 Subject: [PATCH] Add namespace to deploy script --- contracts/reverseRegistrar/README.md | 4 ++++ deploy/reverseregistrar/01_deploy_l2_reverse_registrar.ts | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/contracts/reverseRegistrar/README.md b/contracts/reverseRegistrar/README.md index 169c7623..050a50ee 100644 --- a/contracts/reverseRegistrar/README.md +++ b/contracts/reverseRegistrar/README.md @@ -19,3 +19,7 @@ You can set records using one of the follow functions: `setNameForAddrWithSignature()`/`setTextForAddrWithSignature()` - uses the address parameter instead of `msg.sender` and allows authorisation via a signature `setNameForAddrWithSignatureAndOwnable()`/`setTextForAddrWithSignatureOwnable()` - uses the address parameter instead of `msg.sender`. The sender is authorised by checking if the contract's owner (via the Ownable pattern) is the msg.sender, which then checks that the signer has authorised the record on behalf of msg.sender using `ERC1271` + +## Signatures for setting records + +Signatures use a double keccak256 structure that first hashes the function id with the variables that you are passing to that function. It then hashes the result of that with the rest of the parameters. diff --git a/deploy/reverseregistrar/01_deploy_l2_reverse_registrar.ts b/deploy/reverseregistrar/01_deploy_l2_reverse_registrar.ts index e4d2870f..83f4793e 100644 --- a/deploy/reverseregistrar/01_deploy_l2_reverse_registrar.ts +++ b/deploy/reverseregistrar/01_deploy_l2_reverse_registrar.ts @@ -4,7 +4,7 @@ import { DeployFunction } from 'hardhat-deploy/types' import { HardhatRuntimeEnvironment } from 'hardhat/types' // Replace with coinid of L2 -const NAMESPACE = 'optimism' +const COINTYPE = 123 const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { const { getNamedAccounts, deployments, network } = hre @@ -13,7 +13,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { await deploy('L2ReverseRegistrar', { from: deployer, - args: [namehash(`${NAMESPACE}.reverse`)], + args: [namehash(`${COINTYPE}.reverse`), COINTYPE], log: true, }) }