-
Notifications
You must be signed in to change notification settings - Fork 133
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
📝 Creating a draft for upcoming cross-contract tutorial #857
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@LuffySama-Dev is attempting to deploy a commit to the o1labs Team on Vercel. A member of the Team first needs to authorize it. |
Hi @barriebyron , I have started adding content in Does it needs to be updated some other place in order for it to be visible ? Tomorrow I will push the code on top of which tutorial can be updated further. Thank You 😃 |
Hi @barriebyron , The final change to the tutorial is added.
Thank you 😃 |
Hi @barriebyron , The tutorial draft is ready and code is audited with latest version of o1js and zkApp cli. Thank You 😃 |
To add the tutorial to the sidebars, see https://github.com/o1-labs/docs2/wiki/Markdown-Syntax#sidebar and then a preview of the doc will be available at https://docs2-git-fork-luffysama-dev-issue776luffy-minadocs.vercel.app/ I think you know already you can build the docs locally per https://github.com/o1-labs/docs2/blob/main/README.md#how-to-see-your-local-doc-updates-during-development I am learning more about how to test the code... let me help you get the preview working and then I'll test it! thank you |
Awesome!! Thank you so much ... Great !! Let me know if you need help with testing code 😃. Thank you so much 🙌🏻 |
Hi @barriebyron , I have pushed the changes and added he tutorial in sidebar. The links to code in tutorial won't work as of now as this PR is not merged into main branch yet. (Code is also part of this PR) Can you please help to check if any other changes are required ? Thank You so much ❤️ |
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.
looking so good!
|
||
In this tutorial, you learn how smart contracts on a blockchain can interact by calling functions in each other's code, enabling building modular and complex decentralized applications. | ||
|
||
Cross contract calls allow smart contracts on a blockchain to interact with each other. This enables the building of complex decentralized applications (Dapps) from multiple modular components. In a cross-contract call, a function in one smart contract can call a function in another smart contract to leverage existing code and functionality. |
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.
let's add an example of a complex stack that will benefit from this pattern (can we describe a use case?) @LuffySama-Dev
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 was thinking the same !!
I was thinking of adding a image but an use case example sounds awesome.
Will check and add it in couple of days.
Thank You 🙌🏻
|
||
This tutorial demonstrates passing data between contracts, handling events, and returning values when contracts call each other. | ||
|
||
The full example code is provided in the [12-cross-contract-calls/src/](https://github.com/o1-labs/docs2/tree/main/examples/zkapps/12-cross-contract-calls/src) example files. |
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.
where are the example files? are they in this PR?
let's put the example files mentioned in the tutorial in a new folder here https://github.com/o1-labs/docs2/tree/main/examples/zkapps
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.
The example files are added in initial commit in example folder.
7aa4b14#diff-40a308f55dcc34f6c479b6f2954062c4ef5bac47ad2928204dc9951e78eea6bc
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.
Once this PR get's merges the link will start working.
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 didn't recognize all three smart contracts as being present, since in a single file. Thanks @iregina for testing the code!
adderZkapp.deploy(); | ||
incrementerZkapp.deploy(); | ||
}); | ||
await tx.sign([feePayerKey, zkappKey, adderKey, incrementerKey]).send(); |
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.
@LuffySama-Dev Can you also leave a comment about what is happening here?
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.
Hi @iregina ,
Yes sure. I will add a comment.
Thank You
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 like your question about comments @LuffySama-Dev
Helpful comments in the code is the pathway to sharing knowledge
Please add descriptive comments
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.
Hi @barriebyron , @iregina ,
I have committed the changes, can you please help to check and let me know if any changes are required ?
- Also, I am planning on adding a flow diagram of how call is going from one contract to other an so.
What do you think ?
Thank You 😃
@LuffySama-Dev Yes, please, let's add code comments in the smart contract and include those comments in the code shown in the doc. Comments are the pathway to sharing knowledge. |
on it 🫡 |
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.
lgtm! Before we merge, we should adjust the tutorial and the code to the latest breaking changes that introduce async circuit. see here https://github.com/o1-labs/o1js/blob/main/CHANGELOG.md#breaking-changes
Hi @barriebyron,
I am creating this PR for #776 .
We can keep this in draft.
Today I have tested the code and added the basic layout.
I will keep on committing to this PR until the tutorial is ready.
Thank You 😃