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 fund contract receives donation #144

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

[test] Test event emit when fund contract receives donation #144

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

Comments

@adrianvrj
Copy link
Member

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 please assign

How I plan on tackling this issue

  • I will ensure that my development environment is set up with the required dependencies and testing tools for Cairo. This includes confirming that I have the necessary libraries to handle event testing in Cairo contracts.

  • I will closely review the fund.cairo contract to find the function that handles receiving a donation. I will take note of the event being emitted, including all expected parameters and their data types. I will also look into any specific conditions or logic that need to be fulfilled for the event to be emitted.

  • I will document the parameters and values that should be emitted with the event. This will help me determine what assertions I need to make in the test.

  • I will create or update a test file to include a new function that:

    • Deploys the fund.cairo contract.
    • Simulates receiving a donation by calling the relevant function on the contract.
    • Verifies if the correct event is emitted with all the expected values. I will use assertions to compare the actual event data with what is expected.
  • I will run the test to confirm that it passes. If the event is not emitted correctly or if values do not match, I will review both the test code and the contract logic to identify and fix the issue.

@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 first review the implementation of the event in question to understand its expected values and parameters. Following this, I will create a comprehensive unit test that ensures the event is emitted correctly with all the required values, aligning with the acceptance criteria, and subsequently verify that all tests pass 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

@Oshioke-Salaki
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a cairo developer with alot of contributions in the starknet ecosystem. I belive i would be a perfect fit for this issue and i would love to show case my skills in this repo if given the chance.

How I plan on tackling this issue

I would first of all go through the code base to understand how everything works. then identify all functions that implements a donation to the fund contract.

then i would create the event and attach it to such functions. then i would write test cases to make sure the event is fired off when all goes well.

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

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, as well as its expected values are properly emitted using the assert_emitted method when the fund contract receives a donation

@anonfedora
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm Eleazar and I'm applying to issue #144.

I estimate this will take 6hours max to complete.

How I plan on tackling this issue

This is how I would tackle this issue:

Review the implementation of the function and Event struct

Ensure that the needed attributes of the Event struct are in place

Ensure code builds successfully and tests are passed successfully

@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..Leveraging my experience in smart contract testing, I would ensure that the test covers all possible scenarios to confirm the event's correctness and would run the tests to ensure they pass successfully.

How I plan on tackling this issue

To address the issue of ensuring the correct emission of an event as outlined in issue #138, I would start by reviewing the relevant context in that issue to understand the expected event structure and values. I would then write a comprehensive unit test targeting the function responsible for emitting the event. This test would verify that the event is emitted with all the necessary attributes and that the emitted values match the expected outcomes.

@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

I bring 2 years of hands-on experience in writing and optimizing tests for Solidity smart contracts, which has given me strong foundation in blockchain testing patterns. Recently, I've expanded my expertise into Cairo development, actively writing contracts and their corresponding tests. My combination of established testing experience in Solidity and fresh perspective in Cairo, along with deep theoretical knowledge, positions me well to tackle this testing challenge effectively.

How I plan on tackling this issue

Setup: Add event structure to Fund contract

Test Creation: Write a focused test function with user donating a contract

Validation: Verify that event is emitted with correct details

@aniruddhaaps
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a cairo 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 needs to emit an event, follow the contributor guidelines, do the feature and test all it´s cases.

@ryzen-xp
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I’m experienced in developing and testing smart contracts using Cairo and Solidity. I’ve worked on projects like ARK and Worldlines Bridge

How I plan on tackling this issue

Review the donation logic in the contract to understand the event emitted when funds are received.
[1] Write a test case to simulate a donation to the contract and capture the emitted event.
[2] Verify that the event contains the correct data for all expected fields.
[3] Run the test to ensure it passes and the event emits the correct values.
[4] I’ll ensure the event is emitted properly with all the required data and passes the tests.
Plaese /assign

@mimiprosper
Copy link

mimiprosper commented Oct 24, 2024

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 a graduate of starknet-cairo developer bootcamp. 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
(fund contract receives donation 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 fund contract receives donation events are expected to emit are correctly emitted.

@salazarsebas
Copy link

My background
As a member of the Dojo Coding community, I have experience in web2 and traditional technologies, as for web3 I have only been working for a few months and I have not yet managed to make my first contribution, however, it is not an impediment for me to do my best in this issue, I will devote the necessary effort to contribute to the OSS.

How I plan on tackling this issue
To solve this issue, I will perform the following steps:

  • Understand in depth the context with issue 138 and also understanding in depth the contribution guide.
  • Identify the values to be emitted and the event.
  • Write the tests.
  • Execute the test and verify that everythings works correctly.
  • Deliver the prototype for the maintainers to give me feedback.

@blessingbytes
Copy link

Could I be assigned to this?

@GideonBature
Copy link

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

I estimate this will take 2 days to complete.

This is how I would tackle this issue:

based on the issue #138 that emits an event when a fund contract receives a new donation in the receiveDonation method, I am going to do the following:

  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.

@obacollins-lab
Copy link

May I be assigned to this?

@Akshola00
Copy link

Is it okay if I take this?

@jaiminRaiyani
Copy link

I'd be happy to do this.

@shubha-me
Copy link

Can I handle this task?

@SoarinSkySagar
Copy link

SoarinSkySagar commented Oct 25, 2024

gm! I am Sagar Rana, and I am experienced in writing Cairo smart contracts along with snforge tests. you can check my contributions and my works on my github and onlydust profile. here is how I would approach this issue:
Once issue #138 is resolved, I will add the function test_receiveDonation in test_fund.cairo. I will add test cases to ensure that the function is working and the events are being emitted and will make sure the tests are passing before opening the PR.

@Pvsaint
Copy link

Pvsaint commented Oct 25, 2024

Mind if I take this issue?

@EmmanuelAR
Copy link
Collaborator

Hello @salazarsebas this ticket is ready to work! Any questions let us know :)

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