-
Notifications
You must be signed in to change notification settings - Fork 26
Hedera forking tutorials #375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Kiran Pachhai <kiran.pachhai@hashgraph.com>
Signed-off-by: Kiran Pachhai <kiran.pachhai@hashgraph.com>
jasuwienas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this is a great job!
(most importantly the testing scenario works : ))
There are just a few things I’d like to clarify.
(
I’m not a fan of including the full contents of JavaScript test files (especially when theyre hundreds of lines long) directly in README files. Don’t you think it would be better to keep them elsewhere and simply reference them from the README (or copy only relevant parts when there’s a need to point to a specific place)?
P.S. just for context: I’ve been working with the forking library for some time, so I understand how it works under the hood and what it’s meant for. I read this guide from that perspective
hedera/core-concepts/smart-contracts/forking-hedera-network-for-local-testing.mdx
Outdated
Show resolved
Hide resolved
...utorials/smart-contracts/foundry/how-to-fork-the-hedera-network-with-foundry-basic-erc20.mdx
Outdated
Show resolved
Hide resolved
...utorials/smart-contracts/foundry/how-to-fork-the-hedera-network-with-foundry-basic-erc20.mdx
Outdated
Show resolved
Hide resolved
...utorials/smart-contracts/foundry/how-to-fork-the-hedera-network-with-foundry-basic-erc20.mdx
Show resolved
Hide resolved
...utorials/smart-contracts/foundry/how-to-fork-the-hedera-network-with-foundry-basic-erc20.mdx
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdx
Outdated
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-basic-erc20.mdx
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdx
Outdated
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdx
Outdated
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdx
Show resolved
Hide resolved
...utorials/smart-contracts/foundry/how-to-fork-the-hedera-network-with-foundry-basic-erc20.mdx
Outdated
Show resolved
Hide resolved
Signed-off-by: Kiran Pachhai <kiran.pachhai@hashgraph.com>
So, the reason we wanna include as much code as we want in the documentation is because we want users to be able to follow along with the tutorials word for word. This will prevent some weird discrepancies if we decide to update the github repo that hosts the code or worse yet, the repo gets moved or whatever the reason. Also, one important reason we wanna have as much detail as we can as part of our documentation(especially for tutorials) going forward has to do with the fact that these days, everyone uses AI to ask questions about code and this includes the AI we have integrated within our documentation. This is to feed all the relevant data to the LLMs so they're aware of everything needed to help users on their journey in case they aren't reading the tutorial on our documentation page but rather asking their favorite AI instead. |
jasuwienas
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! LGTM!
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdx
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdx
Outdated
Show resolved
Hide resolved
|
|
||
| ## HTS Supported Methods | ||
|
|
||
| The emulation layer supports a subset of HTS functionality. Refer to [https://github.com/hashgraph/hedera-forking#hedera-token-service-supported-methods](https://github.com/hashgraph/hedera-forking#hedera-token-service-supported-methods) for the latest list. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpicking: Instead of pasting the raw URL, can we give it a word like "list of HTS supported methods"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had this before and then I removed it again.
I can put it back again but note that this list is constantly updated as new methods are supported and we should be sure to always update the same thing in 2 places(in github repo and doc).
So, to remove this dependency, I just added the authoritative source of truth(which is the github repo README itself).
What do you think?
hedera/core-concepts/smart-contracts/forking-hedera-network-for-local-testing.mdx
Show resolved
Hide resolved
...utorials/smart-contracts/foundry/how-to-fork-the-hedera-network-with-foundry-basic-erc20.mdx
Show resolved
Hide resolved
...utorials/smart-contracts/foundry/how-to-fork-the-hedera-network-with-foundry-basic-erc20.mdx
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-basic-erc20.mdx
Outdated
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-basic-erc20.mdx
Outdated
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-basic-erc20.mdx
Show resolved
Hide resolved
hedera/tutorials/smart-contracts/how-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdx
Show resolved
Hide resolved
Signed-off-by: Kiran Pachhai <kiran.pachhai@hashgraph.com>
@jasuwienas @kpachhai You can use expandaples to show/hide code (hide them by default: https://www.mintlify.com/docs/components/expandables It might be helpful for long code files |
Description:
This PR adds comprehensive tutorials for fork testing on Hedera using both Hardhat and Foundry frameworks. These tutorials enable developers to test smart contracts against real Hedera network state locally without spending gas or affecting the live network.
Tutorials added:
how-to-fork-the-hedera-network-with-hardhat-basic-erc20.mdxhow-to-fork-the-hedera-network-with-hardhat-advanced-hts.mdxhow-to-fork-the-hedera-network-with-foundry-basic-erc20.mdxforking-hedera-network-for-local-testing.mdx(core concepts)Example projects added:
hardhat/basic-erc20-fork-test/- Complete Hardhat ERC-20 examplehardhat/advanced-hts-fork-test/- Complete Hardhat HTS examplefoundry/basic-erc20-fork-test/- Complete Foundry ERC-20 exampleRelated issue(s):
Fixes #361
Notes for reviewer:
Key concepts covered in these tutorials:
hardhat_impersonateAccount/vm.prank)hardhat_setBalance/vm.deal)Checklist