Skip to content
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

Ludo Game Contracts: Improve function signatures #140

Closed
gianalarcon opened this issue Jan 22, 2025 · 20 comments · Fixed by #148
Closed

Ludo Game Contracts: Improve function signatures #140

gianalarcon opened this issue Jan 22, 2025 · 20 comments · Fixed by #148
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers ODBoost

Comments

@gianalarcon
Copy link
Collaborator

Issue Overview

Some functions need to refactor, we have fn create_session

    fn create_session(
        ref self: ContractState, token: ContractAddress, amount: u256, required_players: u32,
    ) -> u256;

Currently when we play ludo we have 2 options, play with token or play for free, if we play with token, we have to pass the token address and the amount, if we play for free we have to input zero on both fields, and it is not a good way to handle the free option game play

Proposed Solutions or Ideas

  1. Update the input parameters and make them optional
    fn create_session(
        ref self: ContractState, option_token: Option<ContractAddress>, option_amount: Option<u256>, required_players: u32,
    ) -> u256;
  • Use match pattern to handle the Some and None cases
  • Fix other sections of code in case this change breaks somewhere else feature
  • Update tests based on this new fn signature
  • Spot other sections of the code when you can suggest a improvement similar like the mentioned above.
@gianalarcon gianalarcon added enhancement New feature or request good first issue Good for newcomers ODBoost labels Jan 22, 2025
@aidenwong812
Copy link

Can I attempt this issue?

@PoulavBhowmick03
Copy link

May I take this issue on?

i am an active contributor in the starknet and ethereum ecosystem

I have a robust experience working on Rust, having contributed to Dojo, AFK, and written tons of Cairo contracts and even built a dojo game

ETA- 2 days

@aurlic
Copy link

aurlic commented Jan 22, 2025

I'd be happy to work on this issue. I've been learning cairo through NodeGuardians, have completed Starklings, and have had the occasion to work on some Cairo projects. I will soon participate in the Starknet Denver Hacker House, and I think that this issue would be great for me to practice my skills and further improve. I hope you'll consider my application, thanks in advance !

@RomThpt
Copy link

RomThpt commented Jan 22, 2025

I’d love to work on this task and contribute to the project. I’ll be participating in the ETHDenver hackathon, and I see this as a great opportunity not only to help improve the project but also to grow my skills by tackling this issue.

@omsant02
Copy link

i would like to take this issue

i will make more arguments in the function signature, with match pattern to handle the cases

ETA : 1 day

@ShantelPeters
Copy link

Can I take this from here?

@Wendyalbert
Copy link

Can I take care of this issue?

@No-bodyq
Copy link

Can I be assigned to this?

@ryzen-xp
Copy link

Hi,
I am proficient Blockchain developer expert in Cairo , Rust and Solidity and also in web development.
I have contributed many starknet project and more .
please /assign this issue .
Thank You !!

@crood-xp
Copy link

I'd be happy to do this.

@Birdmannn
Copy link
Contributor

Gm dev Stark. Could I be assigned this issue? I shall implement this as stated as I have already gone through the code. And I shall fix all test cases to implement this new feature and make sure they pass successfully. I'll communicate on discord if I have any questions sir.

@suhas-sensei
Copy link

Could I grab this task?
The create_session function currently requires the token address and amount, even for free gameplay, where the user has to input zero for both fields, which isn't ideal.
I propose updating the function to make these fields optional and using a match pattern to handle the cases where they are provided or not. I'll also need to refactor any impacted sections of the code and update the tests accordingly.

@Supa-mega
Copy link

Could I be assigned to this?

@FrankiePower
Copy link

Hello Team,

My name is SuperFranky, and I am excited to be participating in the first edition of ODBoost. I am a frontend and blockchain developer with over 3+ years of experience and have contributed to a variety of interesting projects in the Web3 space. My expertise in React, Next.js, Solidity, Cairo, responsive design, and an array of other programming languages makes me confident in delivering high-quality solutions.

I have contributed to and hacked on several blockchains, including Base, Arbitrum, Scroll, Ethereum, Stellar, and StarkNet, which has deepened my understanding of blockchain ecosystems and development.

I am passionate about contributing to open-source Web3 projects and committed to delivering exceptional results.

Thank you for considering my application.

@1nonlypiece
Copy link

Application for Contribution

I am excited about the opportunity to contribute to this issue and am confident that my expertise aligns well with the requirements. With a strong background in Cairo programming and decentralized application development on StarkNet, I bring a well-rounded skill set to deliver an effective solution.

Relevant Expertise

  • Blockchain & Smart Contracts: Extensive experience with StarkNet, Stellar, and Rust, specializing in developing secure and optimized smart contracts, blockchain integrations, and high-performance backend infrastructure.
  • Backend Development: Well-versed in API design, server-side logic, and scalable system architecture, ensuring efficient and seamless backend performance.
  • Frontend Engineering: Skilled in crafting interactive and responsive UI components using React and Next.js, enhancing the user experience for blockchain-based platforms.

Why Consider My Application?

My proven track record of delivering high-quality, optimized solutions in blockchain and full-stack development sets me apart. I have a deep understanding of smart contract security, decentralized architectures, and the synergy between frontend, backend, and blockchain layers—ensuring a seamless and efficient implementation.

ETA

I expect to have a working solution ready within 48 hours. Please let me know if I can proceed with the implementation.

@gianalarcon
Copy link
Collaborator Author

All yours @FrankiePower. We expect a draft PR on the next 36 hours. Thanks!

@gianalarcon
Copy link
Collaborator Author

Hi @FrankiePower , any updates on this issue pls? Otherwise we will give the opportunity to solve this issue to other applicant

@Jake1698
Copy link
Contributor

Could I try solving this?

@Jagadeeshftw
Copy link

Hi @gianalarcon,
I have the required knowledge and experience with Cairo, smart contracts, and the SnFoundry framework to effectively implement the requested improvements for the Ludo Game Contracts. Additionally, I have contributed to similar projects, such as this pull request, which reflects my expertise in optimizing Ludo game functionality.

Plan:

  1. Update Function Signature:

    • Refactor create_session to use Option for token and amount, making these parameters optional:
      fn create_session(
          ref self: ContractState, 
          option_token: Option<ContractAddress>, 
          option_amount: Option<u256>, 
          required_players: u32,
      ) -> u256;
  2. Handle Optional Parameters:

    • Implement logic using a match pattern for Some and None cases.
  3. Refactor & Test:

    • Update dependent code and write tests to validate the updated function.
  4. Suggest Improvements:

    • Identify and recommend further enhancements to related sections of the code.

ETA:

I estimate completing the task within 2 days, including implementation, testing, and reviewing the code for additional improvements.

@ekumamatthew
Copy link
Contributor

Can I take this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment