-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from Consensys/chore/post-deployment-scripts
feat: added scripts to set PohVerifier signer and transfer ownership
- Loading branch information
Showing
4 changed files
with
120 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
packages/linea-ens-contracts/scripts/setPohVerifierSigner.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
63 changes: 63 additions & 0 deletions
63
packages/linea-ens-contracts/scripts/transferOwnershipToSafe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |