Skip to content

Commit

Permalink
feat: reuse the same PohVerifier contract when deploying new Linea EN…
Browse files Browse the repository at this point in the history
…S contracts
  • Loading branch information
Julink-eth committed Aug 22, 2024
1 parent 4a3a888 commit aded472
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
7 changes: 1 addition & 6 deletions packages/linea-ens-contracts/.env.org
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
PRIVATE_KEY=
DEPLOYER_PRIVATE_KEY=
OWNER_PRIVATE_KEY=
ETHERSCAN_API_KEY=
LINEASCAN_API_KEY=
INFURA_API_KEY=
METADATA_ADDRESS=
WRAPPER_ADDRESS=
RESOLVER_ADDRESS=
BATCH_GATEWAY_URLS=
BATCH_GATEWAY_URLS=[""]
BASE_DOMAIN="linea-test"
POH_ADDRESS_KEY=

WEB3_SIGNER_URL="http://localhost:9000"
WEB3_SIGNER_PUBLIC_KEY=0xd755fd6692d5065f387b263dd969118d01c34bcf04146e52653d52dc9fe96cdf2cc30f537db2557149ba50662957162fb2b2247e0e9941db43d41c336f350736
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@ import { DeployFunction } from 'hardhat-deploy/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { getNamedAccounts, deployments } = hre
const { getNamedAccounts, deployments, network } = hre
const { deploy } = deployments
const { owner } = await getNamedAccounts()

if (network.tags.reuse_poh_verifier) {
console.log('Reusing PohVerifier')
return true
}

const pohVerifierDeployment = await deploy('PohVerifier', {
from: owner,
log: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,25 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
)
const reverseRegistrar = await ethers.getContract('ReverseRegistrar', owner)
const nameWrapper = await ethers.getContract('NameWrapper', owner)
const pohVerifier = await ethers.getContract('PohVerifier', owner)
let pohVerifierAddress
if (network.tags.reuse_poh_verifier) {
switch (network.name) {
case 'lineaMainnet':
// PohVerifier deployed on Linea Mainnet
pohVerifierAddress = '0xBf14cFAFD7B83f6de881ae6dc10796ddD7220831'
break
case 'lineaSepolia':
// PohVerifier deployed on Linea Sepolia
pohVerifierAddress = '0x576754D133C02B2E229F2630Baa2F06110cE9a9A'
break
default:
throw 'Network not supported with reuse_poh_verifier tag'
}
console.log(`Reusing PohVerifier at address ${pohVerifierAddress}`)
} else {
pohVerifierAddress = (await ethers.getContract('PohVerifier', owner))
.address
}
const pohRegistrationManager = await ethers.getContract(
'PohRegistrationManager',
owner,
Expand All @@ -43,7 +61,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
reverseRegistrar.address,
nameWrapper.address,
registry.address,
pohVerifier.address,
pohVerifierAddress,
pohRegistrationManager.address,
baseNode,
baseDomainStr,
Expand Down
4 changes: 2 additions & 2 deletions packages/linea-ens-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const config: HardhatUserConfig = {
},
lineaSepolia: {
url: `https://linea-sepolia.infura.io/v3/${process.env.INFURA_API_KEY}`,
tags: ['test', 'legacy', 'use_root'],
tags: ['test', 'legacy', 'use_root', 'reuse_poh_verifier'],
chainId: 59141,
accounts: real_accounts,
},
Expand All @@ -102,7 +102,7 @@ const config: HardhatUserConfig = {
},
lineaMainnet: {
url: `https://linea-mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
tags: ['use_root'],
tags: ['use_root', 'reuse_poh_verifier'],
chainId: 59144,
accounts: real_accounts,
},
Expand Down

0 comments on commit aded472

Please sign in to comment.