stack-orchestrator/app/data/container-build/cerc-optimism-contracts/hardhat-tasks/verify-contract-deployment.ts
prathamesh0 464ef89a01 Handle restarts for services in fixturenet-optimism stack (#282)
* Check existing L1 contracts deployment

* Rename volume used for generated L2 config

* Check for existing L2 geth data directory

* Cross check existing L2 config against L1 deployment config

* Verify sequencer key in existing L2 geth data directory

* Add instructions to troubleshoot corrupt L2 geth dir

* Separate out instructions to run L2 with external L1

* Update docs

Former-commit-id: 9ffa9bb5a9
2023-04-05 10:25:50 +05:30

31 lines
940 B
TypeScript

import { task } from 'hardhat/config'
import '@nomiclabs/hardhat-ethers'
task(
'verify-contract-deployment',
'Verifies the given contract deployment transaction'
)
.addParam('contract', 'Address of the contract deployed')
.addParam('transactionHash', 'Hash of the deployment transaction')
.setAction(async ({ contract, transactionHash }, { ethers }) => {
const provider = new ethers.providers.JsonRpcProvider(
`${process.env.L1_RPC}`
)
// Get the deployment tx receipt
const receipt = await provider.getTransactionReceipt(transactionHash)
if (
receipt &&
receipt.contractAddress &&
receipt.contractAddress === contract
) {
console.log(
`Deployment for contract ${contract} in transaction ${transactionHash} verified`
)
process.exit(0)
} else {
console.log(`Contract ${contract} deployment verification failed`)
process.exit(1)
}
})