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

[test] Test event emit when deploying a donator contract #146

Closed
adrianvrj opened this issue Oct 24, 2024 · 24 comments · Fixed by #157
Closed

[test] Test event emit when deploying a donator contract #146

adrianvrj opened this issue Oct 24, 2024 · 24 comments · Fixed by #157
Assignees
Labels
ODHack9 ODHack9.0 issue

Comments

@adrianvrj
Copy link
Member

adrianvrj commented Oct 24, 2024

This issue will be part of ODHack9.0, please apply via Onlydust app

Acceptance Criteria

  • Event is being emitted correctly.
  • Tests pass successfully.
@adrianvrj adrianvrj added good first issue Good for newcomers ODHack9 ODHack9.0 issue and removed good first issue Good for newcomers labels Oct 24, 2024
@CollinsC1O
Copy link

CollinsC1O commented Oct 24, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello I'm a front-end and a blockchain developer and will love to work on this issue and get is solved

How I plan on tackling this issue

Here’s the approach I will take for this testing task:

  • I will make sure my environment is configured for writing and running tests for Cairo smart contracts. This includes verifying that I have the required dependencies and testing tools in place.

  • I will carefully analyze the donator.cairo contract to locate the code that emits the event. I will look at the function or section responsible for emitting the event and take note of the event parameters and their expected data types.

  • I will identify the event being emitted and understand the context in which it is triggered. I will document the expected values and the conditions that lead to the event being emitted correctly.

  • I will create a test file or add to an existing one to write my test case. In the test:

    • I will deploy the donator.cairo contract.
    • I will trigger the action that should emit the event by interacting with the appropriate function.
    • I will assert that the event is emitted with the correct values, checking each parameter in the event against what is expected.
  • I will execute the test to see if it passes. If there are any discrepancies or if the event is not emitted as expected, I will debug the issue by reviewing both the contract and the test code.

  • After confirming that the test passes and the event is emitted correctly, I will commit my changes with a clear message, push and create a pull request and wait for review and a possible merge.
    Thanks for the opportunity

@Mystic-Nayy
Copy link

Mystic-Nayy commented Oct 24, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

@adrianvrj I am a web3 developer, I have expertise in smart contracts, decentralized technologies, and frameworks like React. I can build innovative dApps, contribute to open-source projects, educate others, and network with industry leaders to advance my career in the decentralized space.

ETA => 2 days after being assign

How I plan on tackling this issue

I will Add a test to verify that the event is emitted correctly by triggering the relevant function and checking the event parameters. Ensure the test follows the coding standards in the contributors guide. Run the tests to confirm that your new test passes successfully alongside existing tests.

@DiegoB1911
Copy link
Contributor

DiegoB1911 commented Oct 24, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a Full Stack Developer with two years of experience. I'm also a member of Dojo Coding, where I'm expanding my expertise in Cairo and Web3 technologies. I'm enthusiastic about learning, and becoming a part of this project.

How I plan on tackling this issue

To solve this, I will:

  1. Analyze the contract functionality.
  2. Develop a test to verify that the event is emitted correctly using assert_emitted.
  3. Verify that everything works as expected and document the code.
    ETA: 2 days

@Lukman-01
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello! My name is Lukman, and I am a passionate Smart Contract Developer with two years of experience in writing smart contracts. My hands-on experience spans various blockchain platforms, including Ethereum and Starknet. I’m eager to leverage my skills in developing efficient, secure, and innovative solutions in the blockchain space.

How I plan on tackling this issue

To address this issue, I will start by reviewing the relevant code to understand the event emission mechanism and ensure I know what parameters should be emitted. Then, I'll implement a test case that specifically checks the event emission using the Cairo testing framework, ensuring that the emitted event matches the expected values. After running the tests to confirm they pass successfully, I will document my findings and submit my changes for review.

@NueloSE
Copy link
Contributor

NueloSE commented Oct 24, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

As a skilled solidity and cairo developer with experience in blockchain technologies and contribution to previous testing of smart contracts. Link to previous test: scaffoldstark testing

How I plan on tackling this issue

  1. Implement the Event Emission
  • I'll define the event structure from the main contract
  • Implement the method that handles donator contract deployment and emits the event
    2 Add a Test
    I will create a test for the donator contract.
    And write a test case to verify the event emission
  1. Verify Implementation
    I will ensure the event is properly defined and emitted.
    I will finaly check that the test passes successfully.

@martinvibes
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

hello @ i'm an experienced frontend developer and a blockchain developer i would love to work on this issue
Pleasee kindly assign :)

How I plan on tackling this issue

i would make sure it is working and also test it to confirm

@No-bodyq
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm Asher and I'll be working on issue #146.

I estimate this will take less than 2 days to complete.

How I plan on tackling this issue

I will go through the code to get accustomed with its functionality then write tests to assert that the correct event when deploying a donator contract, as well as its expected values are properly emitted using the assert_emitted method

@Gianfranco99
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have been a developer for over 4 years and have been contributing to the Starknet ecosystem for more than a year. My recent contributions include work on cairo-lint and scaffold-starknet. I’m eager to participate in this project as I see a lot of potential in it and believe it adds valuable functionality to the Starknet ecosystem. Also I'm part of dojo-coding comunity!

How I plan on tackling this issue

I already commented to make the issue in which the event must be emitted, I would also like to make this issue since they are related, the ideal would be for the same person to do it so as not to have conflicts and not affect the development of the project.

@ShantelPeters
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a blockchain developer with vast knowledge in languages as cairo, typescript, javascript, Html, Css , solidity, React etc.I would leverage my experience in smart contract development and testing to ensure thorough coverage and that all tests pass successfully, demonstrating the reliability of the event emission

How I plan on tackling this issue

To address the issue of ensuring correct event emission, I would start by reviewing issue #135 to gather all necessary context regarding the event and its expected parameters. I would then create a unit test focused on the specific function responsible for emitting the event. This test will assert that the event is emitted with all expected attributes and values, verifying that it matches the intended structure and data.

@saimeunt
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have contributed to several Cairo projects on OnlyDust and I've worked on very similar issues in the past such as ArkProjectNFTs/bridge#236

How I plan on tackling this issue

I will carefully craft a test to make sure the event is emitted using Starknet Foundry and assert_emitted.

@0xprivateChaos
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

As a smart contract developer who has worked extensively with reward-based systems and gamification contracts, I've gained deep insights into testing state-progression mechanics. My transition from Solidity to Cairo has been hands-on, specifically focusing on testing complex DeFi mechanics. The donator contract's leveling system reminds me of a recent project where I implemented similar progression logic, making me well-equipped to ensure proper event emission and testing coverage for this contract.

How I plan on tackling this issue

Setup: Create test environment focusing on constructor's interaction with DonatorConstants

Validation Chain: Test deployment event alongside initial state verification, leveraging my experience with level-based contracts

Integration Testing: Structure tests to complement Fund contract event tests, ensuring cohesive system behavior

@Emmanex01
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm Emmanuel Tochukwu, smart contract developer. I recently graduated from starknet developer bootcamp which lasted for 8 weeks. During the bootcamp, I have written a lot of contract. An also testing whether contract behaves as expected is one the things I did.

How I plan on tackling this issue

First, I would look at the event struct to note the variables to be emitted, and also check whether the annotations and required importations are made.

secondly, I would write a unit test for every function that emits an event using a spy_event() cheatcode which will allow me to be able to assert whether the right is emitted.

@aniruddhaaps
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a python dev. A new-comer here, willing and ready to contribute to contribute to solve the issue.

@BrunoAmbricca
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello guys, I have been working for the past 4 years as a developer with multiple languages such as ts, and for the past 3 months learning and working with cairo on my own projects.

How I plan on tackling this issue

I would look the method that emits an event, follow the contributor guidelines and test all it´s cases.

@dimka90
Copy link

dimka90 commented Oct 24, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a backend engineer with half a decade years of experience in creating and developing applications and smart contract that solves real life problems

How I plan on tackling this issue

I will go through the whole code to get an understanding of what it is all about, then use test driven development to write test cases that will ensure that event are being emitted successfully

@ryzen-xp
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I have experience in Cairo and Solidity, focusing on event handling and smart contract testing. My past projects, like ARK and Worldlines Bridge, involved ensuring correct event emissions during various contract actions.

How I plan on tackling this issue

[1]=>Review the contract’s deployment logic to identify when and how the event is emitted.
[2]=>Write a test case to deploy the donator contract and capture the emitted event.
[3]=>Validate that the event contains all expected values.
[4]=>Run the test to ensure it passes and the event emits the correct data.
I’ll ensure the deployment event is emitted properly and that all tests pass successfully.
Please /assign

@mimiprosper
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Am a smart contract developer (solidity & starknet cairo). Am also a smart contract auditor and technical writer. As a smart contract auditor, testing is what i know in-depth and understand. I have audited lots of code bases. I understand how important thorough testing are in the web3 space.

How I plan on tackling this issue

I would follow the guideline in the repo for fork, clone & pull request. I would clone the project on my local machine. I would study the code base (deploying a donator contract events). Reading the code base will make me understand what events are expected to be emitted. Then i write test to make sure that what the deploying a donator contract events are expected to emit are correctly emitted.

@LazarusAA
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm Alvaro Lazarus a blockchain developer and a new member of Dojo Coding, I've worked with testing Cairo contracts in the past which makes me confident I can complete this issue. Also it seem like a cool first contribution to the GoStarkMe project.

How I plan on tackling this issue

  • Analyze the contract functionality.
  • Develop a test to verify that the event is emitted correctly.
  • Run the tests using the testing framework to confirm they pass.

Thank you for your consideration

ETA: 48 hrs

@stevencartavia
Copy link
Contributor

My background and how it can be leveraged
I have contributed to several Cairo projects on OnlyDust and I've worked on very similar issues.

How I plan on tackling this issue
I will create a test to check that the event is emitted using Starknet Foundry and assert_emitted.

@Eka1210
Copy link

Eka1210 commented Oct 24, 2024

My background and how it can be leveraged:

I'm currently a Computer Science student with a strong foundation in software development and a growing interest in blockchain technology. Although this will be my first time working on a web3 project, I’m highly motivated to learn and contribute.

How I plan on tackling this issue:

  1. I’ll start by reviewing the existing donator manager contract to see how new donator contracts are deployed and where to implement the event emission logic.
  2. I will add the logic to emit an event when a donator contract is successfully deployed. The event will include the owner (caller address) and the new donator contract address.
  3. I’ll create automated tests to ensure that the event is emitted correctly with the required values.
  4. After implementing the changes, I’ll run tests to ensure everything works as expected and that no existing functionality is affected.
  5. Finally, I will open a pull request with a detailed explanation of the changes, including the new event and its use cases.

@GideonBature
Copy link

Hi, I'm Gideon Bature, a Software Engineer and I'll be working on issue #146.

I estimate this will take 2 days to complete.

This is how I would tackle this issue:

  1. I will write a test using the spy events method and a mock up event to test and make sure that the event is emitting correctly all the expected values.
  2. I will test using snforge from snfoundry to make sure the test passes successfully.

@blessingbytes
Copy link

I’d like to work on this.

@obacollins-lab
Copy link

Can I be assigned to this?

@Akshola00
Copy link

I’d like to help with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ODHack9 ODHack9.0 issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.