Skip to content
This repository has been archived by the owner on Aug 8, 2024. It is now read-only.

Conversion from Cairo 1.X to Cairo 2.X for Starknet-Cairo-101 Exercises and Utilities #61

Open
omarespejel opened this issue Jul 8, 2023 · 23 comments
Assignees

Comments

@omarespejel
Copy link
Collaborator

omarespejel commented Jul 8, 2023

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:

Utilities from the "token" directory:

Utilities from the "utils" directory:

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:

  1. Fork this repository (top right button on this page).
  2. Clone your forked repository to your local machine (git clone https://github.com/yourusername/starknet-cairo-101.git).
  3. Check out your local repository’s existing cairo2 branch (git checkout cairo2).
  4. Make your changes in this branch.
  5. Commit your changes (git commit -m 'Converted files to Cairo 2.X').
  6. Push your changes to your forked repository (git push origin cairo2).
  7. Return to your fork on GitHub, and click the 'Compare & pull request' button next to your cairo2 branch.
  8. Ensure the base fork is set to starknet-edu/starknet-cairo-101 and the base branch is set to cairo2.
  9. Submit your pull request!

Thank you so much for your contribution! Your time and effort are greatly appreciated.

Happy coding! 💻🎉

@omarespejel omarespejel self-assigned this Jul 8, 2023
@ginika-chinonso
Copy link

I will like to take on exercises 2 and 3

@dbejarano820
Copy link

Hey! I can take on all of the files in Utilities from the "token" directory

@omarespejel
Copy link
Collaborator Author

Great @ginika-chinonso! I added your name to the main comment on the issue to set them apart.

@ginika-chinonso
Copy link

Great @ginika-chinonso! I added your name to the main comment on the issue to set them apart.

Thank you @omarespejel

@ccolorado
Copy link

I can take 1, 4 and 5.

@omarespejel
Copy link
Collaborator Author

hey @ccolorado @dbejarano820 ! Thank you! I added you to those files in the main comment of the issue.

@Nonnyjoe
Copy link

Nonnyjoe commented Jul 9, 2023

I'll take 6 & 7

@omarespejel
Copy link
Collaborator Author

Thanks, @Nonnyjoe! Added you to the main list 🚀

@banch12
Copy link

banch12 commented Jul 9, 2023

Hey, can I take ex 8 and 9?

@omarespejel
Copy link
Collaborator Author

Yes, please @banch12! I added you to the main comment. Thanks!

@codeWhizperer
Copy link

I will work on Utilities from the "utils" directory

@0xd3bs
Copy link

0xd3bs commented Jul 10, 2023

Can I take exercises 10 and 11?

@ptisserand
Copy link

Hi @omarespejel can I take exercises 12 & 13 ?

@omarespejel
Copy link
Collaborator Author

@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.

@TosinJs
Copy link

TosinJs commented Jul 10, 2023

@omarespejel could I take some of the utils from the utils directory?

@codeWhizperer
Copy link

@omarespejel okay, i will work on it and raise a PR soon

@banch12
Copy link

banch12 commented Jul 18, 2023

Hey @omarespejel and others contributing to this effort, I have question(s):

  1. Where can I find syntax of Cairo 2.X?
  2. 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! :)

@TosinJs
Copy link

TosinJs commented Jul 18, 2023

Hey @omarespejel and others contributing to this effort, I have question(s):

  1. Where can I find syntax of Cairo 2.X?
  2. 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! :)

https://book.cairo-lang.org/title-page.html

@banch12
Copy link

banch12 commented Jul 18, 2023

Hey @omarespejel and others contributing to this effort, I have question(s):

  1. Where can I find syntax of Cairo 2.X?
  2. 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! :)

https://book.cairo-lang.org/title-page.html

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.

@TosinJs
Copy link

TosinJs commented Jul 18, 2023

Hey @omarespejel and others contributing to this effort, I have question(s):

  1. Where can I find syntax of Cairo 2.X?
  2. 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! :)

https://book.cairo-lang.org/title-page.html

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

@banch12
Copy link

banch12 commented Jul 18, 2023

Hey @omarespejel and others contributing to this effort, I have question(s):

  1. Where can I find syntax of Cairo 2.X?
  2. 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! :)

https://book.cairo-lang.org/title-page.html

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

@Akinbola247
Copy link

Hi @omarespejel , i'd like to work on ex11_base.cairo in the utils directory

@faytey
Copy link

faytey commented Sep 22, 2023

hi @omarespejel i would like to take on exercise 14 for a start

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests