Is it possible to see the stacktrace on reverts inside instantiated contracts? #3552
-
I am trying to debug an error inside a chain of contract callbacks. There is one contract I deploy myself ( The problem I am having is that when I get an error, the stacktrace only recognizes and shows functions inside of my own contract, such as for instance:
My question is, whether there would be any way to make Hardhat recognize all the contracts in the stack trace? I assume they are not recognized because they are already deployed on mainnet and thus were not previously compiled with hardhat. Is there any way to work around this? The only solution I can come up with would be to deploy copies of them and then call these copies, but this is not ideal since replicating their exact mainnet state is nontrivial. I would be grateful for any suggestions on how to achieve a full stack trace with Hardhat or for any general ideas that may help. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
You can also download the sources from etherscan or an equivalent explorer, add them to your Please report back if it does or not? |
Beta Was this translation helpful? Give feedback.
-
Thank you @alcuadrado, indeed this works. Was not aware Hardhat would be able to recognize the trace then, amazingly it does 🙏 |
Beta Was this translation helpful? Give feedback.
-
Sorry to append to a solved discussion, but would you @alcuadrado happen to know if there was some Hardhat magic that would allow inserting Hardhat's I tried doing that by adding logs to the sources, but that led to the contract no longer being recognized in the stack trace (probably due to the resulting change in its bytecode?) and no logs were showing. |
Beta Was this translation helpful? Give feedback.
You can also download the sources from etherscan or an equivalent explorer, add them to your
contracts/
and it should work.Please report back if it does or not?