diff --git a/packages/linea-ens-contracts/.env.org b/packages/linea-ens-contracts/.env.org index ef5ea0f1a..fa570e6ba 100644 --- a/packages/linea-ens-contracts/.env.org +++ b/packages/linea-ens-contracts/.env.org @@ -10,5 +10,12 @@ RESOLVER_ADDRESS= BATCH_GATEWAY_URLS= BASE_DOMAIN="linea-test" POH_ADDRESS_KEY= + WEB3_SIGNER_URL="http://localhost:9000" -WEB3_SIGNER_PUBLIC_KEY=0xd755fd6692d5065f387b263dd969118d01c34bcf04146e52653d52dc9fe96cdf2cc30f537db2557149ba50662957162fb2b2247e0e9941db43d41c336f350736 \ No newline at end of file +WEB3_SIGNER_PUBLIC_KEY=0xd755fd6692d5065f387b263dd969118d01c34bcf04146e52653d52dc9fe96cdf2cc30f537db2557149ba50662957162fb2b2247e0e9941db43d41c336f350736 + +SAFE_LINEA_SEPOLIA=0x30B45d3fB50B33996f4Db6F0e4Fe82fa6CF8d753 +SAFE_LINEA_MAINNET=0xf5cc7604a5ef3565b4d2050d65729a06b68aa0bd + +POH_SIGNER_LINEA_SEPOLIA=0xC5276dd25195825f73e8729C63E65c969865D7C1 +POH_SIGNER_LINEA_MAINNET=0xdeFc3a33e18Dd479c5936F31497bc8650Dcfa070 \ No newline at end of file diff --git a/packages/linea-ens-contracts/scripts/ownerRegister.ts b/packages/linea-ens-contracts/scripts/ownerRegister.ts index edbc36734..8d85d020d 100644 --- a/packages/linea-ens-contracts/scripts/ownerRegister.ts +++ b/packages/linea-ens-contracts/scripts/ownerRegister.ts @@ -78,11 +78,11 @@ async function main(hre: HardhatRuntimeEnvironment) { resolverAbi = loadAbi('../deployments/LineaSepolia/PublicResolver.json') rpcUrl = `https://linea-sepolia.infura.io/v3/${process.env.INFURA_API_KEY}` break - case 'mainnet': + case 'lineaMainnet': registrarControllerAbi = loadAbi( '../deployments/mainnet/ETHRegistrarController.json', ) - resolverAbi = loadAbi('../deployments/mainnet/PublicResolver.json') + resolverAbi = loadAbi('../deployments/lineaMainnet/PublicResolver.json') rpcUrl = `https://linea-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}` break default: diff --git a/packages/linea-ens-contracts/scripts/setPohVerifierSigner.ts b/packages/linea-ens-contracts/scripts/setPohVerifierSigner.ts new file mode 100644 index 000000000..a1a0cf16b --- /dev/null +++ b/packages/linea-ens-contracts/scripts/setPohVerifierSigner.ts @@ -0,0 +1,47 @@ +import { ethers } from 'hardhat' +import { HardhatRuntimeEnvironment } from 'hardhat/types' +import 'dotenv/config' +import pohVerifierLineaSepolia from '../deployments/lineaSepolia/PohVerifier.json' +import { Contract } from 'ethers' +// TODO: Uncomment when deployed on linea mainnet +// import pohVerifierLineaMainnet from '../deployments/lineaMainnet/PohVerifier.json' + +async function main(hre: HardhatRuntimeEnvironment) { + const network = hre.network.name + const { deployer, owner } = await hre.getNamedAccounts() + const signer = await ethers.getSigner(owner) + + let pohVerifier: Contract + let pohSignerAddr: string + + switch (network) { + case 'lineaSepolia': + if (!process.env.POH_SIGNER_LINEA_SEPOLIA) { + throw 'Env POH_SIGNER_LINEA_SEPOLIA can not be undefined' + } + pohSignerAddr = process.env.POH_SIGNER_LINEA_SEPOLIA + pohVerifier = new ethers.Contract( + pohVerifierLineaSepolia.address, + pohVerifierLineaSepolia.abi, + signer, + ) + break + case 'lineaMainnet': + if (!process.env.POH_SIGNER_LINEA_MAINNET) { + throw 'Env POH_SIGNER_LINEA_MAINNET can not be undefined' + } + pohSignerAddr = process.env.POH_SIGNER_LINEA_MAINNET + // TODO: Uncomment when deployed on mainnet + // pohVerifier = new ethers.Contract(pohVerifierLineaMainnet.address,pohVerifierLineaMainnet.abi,owner) + throw 'Network not supported' + default: + throw 'Network not supported' + } + + const tx = await pohVerifier.setSigner(pohSignerAddr) + await tx.wait(1) + + console.log(`PohVerifier signer set to ${pohSignerAddr}`) +} + +main(require('hardhat') as HardhatRuntimeEnvironment).catch(console.error) diff --git a/packages/linea-ens-contracts/scripts/transferOwnershipToSafe.ts b/packages/linea-ens-contracts/scripts/transferOwnershipToSafe.ts new file mode 100644 index 000000000..4cfe953fb --- /dev/null +++ b/packages/linea-ens-contracts/scripts/transferOwnershipToSafe.ts @@ -0,0 +1,63 @@ +import { ethers } from 'hardhat' +import { HardhatRuntimeEnvironment } from 'hardhat/types' +import 'dotenv/config' +import { Contract } from 'ethers' + +const contractsToTransfer = [ + 'SimplePublicSuffixList', + 'BaseRegistrarImplementation', + 'ETHRegistrarController', + 'ReverseRegistrar', + 'Root', + 'UniversalResolver', + 'NameWrapper', + 'PohRegistrationManager', + 'PohVerifier', +] + +async function main(hre: HardhatRuntimeEnvironment) { + const network = hre.network.name + const { deployer, owner } = await hre.getNamedAccounts() + const signer = await ethers.getSigner(owner) + + const deployments = await hre.deployments.all() + + let lineaSafeAddr: string + + switch (network) { + case 'lineaSepolia': + if (!process.env.LINEA_SEPOLIA_SAFE) { + throw 'Env LINEA_SEPOLIA_SAFE can not be undefined' + } + lineaSafeAddr = process.env.LINEA_SEPOLIA_SAFE + break + case 'lineaMainnet': + if (!process.env.LINEA_MAINNET_SAFE) { + throw 'Env LINEA_MAINNET_SAFE can not be undefined' + } + lineaSafeAddr = process.env.LINEA_MAINNET_SAFE + break + default: + throw 'Network not supported' + } + + for (const contractToTransfer of contractsToTransfer) { + const currentContract = deployments[contractToTransfer] + console.log(contractToTransfer) + const contract = new Contract( + currentContract.address, + currentContract.abi, + signer, + ) + const tx = await contract.transferOwnership(lineaSafeAddr) + await tx.wait(1) + + console.log( + `${contractToTransfer} ownership transferred to ${lineaSafeAddr}`, + ) + } + + console.log("All contracts's ownership have been transferred") +} + +main(require('hardhat') as HardhatRuntimeEnvironment).catch(console.error)