1
0
stack-orchestrator/app/data/container-build/cerc-optimism-contracts/hardhat-tasks/verify-contract-deployment.ts
prathamesh0 c2a3ffe0dd Add an option to pass env file to deploy command (#304)
* Add an option to pass env file to deploy command

* Use env variable mapping in fixturenet-optimism stack

* Use default values from checked in env files

* Use env variable mapping in mobymask-v2 stack

* Update instructions

* Add extra hosts in app compose files and update instructions

* Add CERC prefix to env variables in fixturenet-optimism stack

* Add CERC prefix to env variables in mobymask-v2 stack

Former-commit-id: 6b62247ef7a32e20e55c529afa0b80fadb6873a1
2023-04-11 16:21:03 +05:30

31 lines
945 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.CERC_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)
}
})