Skip to content

How to detect failure of contract deployment? #2002

Answered by zemse
emclab asked this question in Q&A
Discussion options

You must be logged in to vote

You can get the deploy transaction and check its success:

const contractFS = await factory.deploy(value, item.name, item.id);
const tx = contractFS.deployTransaction
const receipt = await provider.getTransactionReceipt(tx.hash);
receipt.success // false means the deploy tx failed, due to some sort of revert.

There can be other reasons for deploy failure like network failure, seems that it will be caught in your try/catch.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@emclab
Comment options

@zemse
Comment options

zemse Sep 6, 2021
Collaborator

@emclab
Comment options

@zemse
Comment options

zemse Sep 7, 2021
Collaborator

Answer selected by emclab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants