10 Comments

Hey Nick, just wanted to mention there's a typo in your example. Where you're defining the FriendsFacet.sol file, you're naming the contract PersonsFacet and I think you want it to be FriendsFacet.

Expand full comment

Hi Josh. You are right. I fixed it. Thanks for that.

Expand full comment

Hi Nick, when using an upgraded facet where you have added a new function with the DiamondCut is it common to get an error: "Error: missing revert data in call exception; Transaction reverted without a reason." When printing out the contract it looks like the newly added function did make it but I am unable to use any functions that were added added.

Expand full comment

I don't know why you are getting that error. Just a guess, maybe you are trying to call the function at the wrong contract address.

Expand full comment

hm, I can call any function from the facets first deployment. However, when I try to call functions that were added to the facet with an upgrade they error out. Is there an example of upgrading an existing facet I can check out?

Expand full comment

Are you calling functions on the diamond address or facet address? Functions are added to a diamond, not a facet. So you have to call functions on the diamond address.

Expand full comment

I am calling functions on the diamond address.

Expand full comment

Great. Make sure that you are calling functions with enough gas. Beyond that try some of the debugging techniques in this article: https://dev.to/mudgen/how-to-debug-code-2850

Also, one or more of the tutorials in Awesome Diamonds may help: https://github.com/mudgen/awesome-diamonds

Expand full comment

I did see these tests: https://github.com/mudgen/diamond-1-hardhat/blob/main/test/diamondTest.js#L70

How would you continue to add functions to the Test1Facet after this?

Expand full comment
Comment deleted
Oct 21, 2022
Comment deleted
Expand full comment

Thanks for telling me this. I fixed it.

Expand full comment