Conversion from Cairo 1.X to Cairo 2.X for Starknet-Cairo-101 Exercises and Utilities
omarespejel opened this issue Β· 23 comments
Hey hey, starknet community! ππ
The starknet-cairo-101
repository, a valuable resource for Starknet developers, needs to be updated to reflect the new syntax introduced with the Cairo 2.X compiler.
A great resource to get you up to speed with the new Cairo syntax in a Starknet context is Chapter 2 of the Starknet Book.
This task involves converting a series of exercises (from 1 to 14) and a handful of utilities, all currently written in Cairo 1.X.
Below youβll find a list of the exercises and the utilities that need to be converted:
Exercises:
- Exercise 1 - @ccolorado
- Exercise 2 - @ginika-chinonso
- Exercise 3 - @ginika-chinonso
- Exercise 4 - @ccolorado
- Exercise 5 - @ccolorado
- Exercise 6- @Nonnyjoe
- Exercise 7 - @Nonnyjoe
- Exercise 8 - @banch12
- Exercise 9 - @banch12
- Exercise 10 - @0xd3bs
- Exercise 11 - @0xd3bs
- Exercise 12 - @ptisserand
- Exercise 13 - @ptisserand
- Exercise 14
Utilities from the "token" directory:
- ERC20_base.cairo - @dbejarano820
- IERC20.cairo - @dbejarano820
- ITDERC20.cairo - @dbejarano820
- TDERC20.cairo - @dbejarano820
Utilities from the "utils" directory:
- IAccountContract.cairo
- Iex10.cairo
- Iex10b.cairo
- Iplayers_registry.cairo
- ex00_base.cairo - @codeWhizperer
- ex11_base.cairo
- helper.cairo
- players_registry.cairo
To avoid overlap in efforts, please comment on this issue indicating which file(s) you'd like to convert. This will allow @omarespejel to assign and tag you accordingly.
Once your work is complete, we kindly ask you to submit your contributions as a pull request to this repository's existing cairo2
branch. If you're not familiar with the process of creating a pull request, please follow these steps:
- Fork this repository (top right button on this page).
- Clone your forked repository to your local machine (
git clone https://github.com/yourusername/starknet-cairo-101.git
). - Check out your local repositoryβs existing
cairo2
branch (git checkout cairo2
). - Make your changes in this branch.
- Commit your changes (
git commit -m 'Converted files to Cairo 2.X'
). - Push your changes to your forked repository (
git push origin cairo2
). - Return to your fork on GitHub, and click the 'Compare & pull request' button next to your
cairo2
branch. - Ensure the base fork is set to
starknet-edu/starknet-cairo-101
and the base branch is set tocairo2
. - Submit your pull request!
Thank you so much for your contribution! Your time and effort are greatly appreciated.
Happy coding! π»π
I will like to take on exercises 2 and 3
Hey! I can take on all of the files in Utilities from the "token" directory
Great @ginika-chinonso! I added your name to the main comment on the issue to set them apart.
Great @ginika-chinonso! I added your name to the main comment on the issue to set them apart.
Thank you @omarespejel
I can take 1, 4 and 5.
hey @ccolorado @dbejarano820 ! Thank you! I added you to those files in the main comment of the issue.
I'll take 6 & 7
Thanks, @Nonnyjoe! Added you to the main list π
Hey, can I take ex 8 and 9?
Yes, please @banch12! I added you to the main comment. Thanks!
I will work on Utilities from the "utils" directory
Can I take exercises 10 and 11?
Hi @omarespejel can I take exercises 12 & 13 ?
@ptisserand @0xd3bs, thanks! I added you to the main comment.
@codeWhizperer, that particular directory is extensive. Is it ok if I add you first to the ex00_base.cairo file? It is a crucial one.
@omarespejel could I take some of the utils from the utils directory?
@omarespejel okay, i will work on it and raise a PR soon
Hey @omarespejel and others contributing to this effort, I have question(s):
- Where can I find syntax of Cairo 2.X?
- Chapter 2 of Starknet book does not mention Cairo2.X. Is the Voting contract (in chapter 2 of Starknet book) in Cairo 2.X syntax?
Your inputs are appreciated. Thanks in Advance! :)
Hey @omarespejel and others contributing to this effort, I have question(s):
- Where can I find syntax of Cairo 2.X?
- Chapter 2 of Starknet book does not mention Cairo2.X. Is the Voting contract (in chapter 2 of Starknet book) in Cairo 2.X syntax?
Your inputs are appreciated. Thanks in Advance! :)
Hey @omarespejel and others contributing to this effort, I have question(s):
- Where can I find syntax of Cairo 2.X?
- Chapter 2 of Starknet book does not mention Cairo2.X. Is the Voting contract (in chapter 2 of Starknet book) in Cairo 2.X syntax?
Your inputs are appreciated. Thanks in Advance! :)
Thanks for quick reply :)
What is the difference between Cairo 1.X and Cairo 2.X syntax? To me it looks same.
What I meant to say is that these Cairo-101 exercises appear to be in the format described in the link you have mentioned.
Or I am missing something.
Hey @omarespejel and others contributing to this effort, I have question(s):
- Where can I find syntax of Cairo 2.X?
- Chapter 2 of Starknet book does not mention Cairo2.X. Is the Voting contract (in chapter 2 of Starknet book) in Cairo 2.X syntax?
Your inputs are appreciated. Thanks in Advance! :)Thanks for quick reply :) What is the difference between Cairo 1.X and Cairo 2.X syntax? To me it looks same. What I meant to say is that these Cairo-101 exercises appear to be in the format described in the link you have mentioned. Or I am missing something.
It is best you go through the book, the syntax is similar but there are slight changes. I think the most pronounced changes are in declaring external and internal functions. There are also smaller changes like rather than annotating traits with [abi] its now [starknet::interface] and from [contract] it is now [starknet::contract].
Additional: https://community.starknet.io/t/cairo-1-contract-syntax-is-evolving/94794
Hey @omarespejel and others contributing to this effort, I have question(s):
- Where can I find syntax of Cairo 2.X?
- Chapter 2 of Starknet book does not mention Cairo2.X. Is the Voting contract (in chapter 2 of Starknet book) in Cairo 2.X syntax?
Your inputs are appreciated. Thanks in Advance! :)Thanks for quick reply :) What is the difference between Cairo 1.X and Cairo 2.X syntax? To me it looks same. What I meant to say is that these Cairo-101 exercises appear to be in the format described in the link you have mentioned. Or I am missing something.
It is best you go through the book, the syntax is similar but there are slight changes. I think the most pronounced changes are in declaring external and internal functions. There are also smaller changes like rather than annotating traits with [abi] its now [starknet::interface] and from [contract] it is now [starknet::contract].
Additional: https://community.starknet.io/t/cairo-1-contract-syntax-is-evolving/94794
Thanks @TosinJs !!! Really appreciate it
Hi @omarespejel , i'd like to work on ex11_base.cairo in the utils directory
hi @omarespejel i would like to take on exercise 14 for a start