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 fund contract #147

Open
adrianvrj opened this issue Oct 24, 2024 · 30 comments
Open

[test] Test event emit when deploying a fund contract #147

adrianvrj opened this issue Oct 24, 2024 · 30 comments
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
@ooochoche
Copy link

ooochoche 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 smart contract developer and I have read the description and contribution guide and would love to work on this issue

How I plan on tackling this issue

I would make sure the Acceptance Criteria are met.

@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 @adrianvrj I'm a frontend and a blockchain developer. I will love to work on this issue

How I plan on tackling this issue

Here is how I would approach this testing task:

  • I will first ensure that my development environment is configured for writing and running Cairo tests. I will make sure I have all the dependencies and testing tools set up.

  • I will take a close look at the fund.cairo contract, paying particular attention to where and how the event is emitted. I need to understand what triggers the event and what values are included.

  • Based on the contract, I will identify the specific event being emitted and the values it should carry. I will make note of the parameter names, data types, and any specific conditions that need to be met for the event to emit correctly.

  • I will create a new test file or extend an existing one in the test suite. In this test function:

    • I will deploy the fund.cairo contract.
    • I will trigger the action that emits the event.
    • I will verify if the event is emitted with all the expected values. For this, I will use assertions to check if the emitted event matches the expected data.

To run and debug the test,

  • I will execute the test and carefully review the results. If the event is not being emitted as expected or values aren’t matching, I will debug the contract or my test function to identify and fix the issues.
  • Lastly I will add comments to my test code explaining what I’m testing and why. This helps other contributors understand the purpose of the test and the event being validated.

@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 tackle this issue, I will start by reviewing the relevant code and the specific event that needs testing, as outlined in #136. I will then implement a unit test that verifies the event is emitted with all expected values, ensuring that it adheres to the specified acceptance criteria, and finally, I will run the tests to confirm that they 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

@No-bodyq
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi I am Asher and I will be working on issue #147
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

@jsandinoDev
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a full-stack developer with web3 experience, specializing in smart contracts and decentralized applications. I've worked on projects using React, Solidity, Cairo, and blockchain tools. My skills in both front-end and back-end development allow me to build scalable and secure solutions for web3 ecosystems.

How I plan on tackling this issue

o approach testing event emission during the deployment of a fund contract, follow these steps:

  1. Understand the Event You Want to Test
    When deploying smart contracts, certain actions or milestones should trigger events. For example, in your fund contract, you might have an event called FundCreated that signals successful contract deployment. You want to ensure this event is emitted correctly during deployment.
  2. Set Up Testing Framework
  3. Structure the Test
    Now, you want to structure the test to capture and verify that the event is triggered as expected. This involves the following:

Deploy the Contract: You simulate the contract deployment process in your test environment.
Verify the Event: After deployment, check that the FundCreated event is triggered with the correct parameters (e.g., contract owner and amount).
4. Run the Test
After writing the test, you can run it in your development environment:

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

@od-hunter
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, please can I be assigned this please? This would be my first time contributing to this project and I would love to be the given the opportunity to contribute. I have experience in html, css, JavaScript,TypeScript and solidity, and Cairo.

How I plan on tackling this issue

To successfully run tests, I’ll take the following steps:

  1. Once the contract in [feat] Emit event when fund contract is deployed #136 is set up, I’ll write unit tests to ensure the FundContractDeployed event is emitted correctly with the expected values.
  2. ⁠Then after writing the tests, I’ll run them using my testing framework to ensure they pass.

Please assign me, I’m ready to work.

@ShantelPeters
Copy link

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 utilize my experience in smart contract testing to ensure that the tests are comprehensive and pass successfully, confirming the correct behavior of the event emission functionality.

How I plan on tackling this issue

To address the issue of testing the event emission, I would first review issue #136 for context and understand the specifics of the event and its expected values. I would then create a unit test that verifies whether the event is emitted correctly in the relevant function. This test will check that all expected values (e.g., donor address, donation amount, current balance, fund contract address) are present and accurate in the emitted event.

@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 and modify constructor to emit event upon deployment

Test Creation: Write a focused test function that deploys the contract and captures the deployment event

Validation: Assert that the emitted event contains correct fund details (id, owner, name, goal) matching the constructor parameters

@Emmanex01
Copy link

Emmanex01 commented Oct 24, 2024

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

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.

@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 first of all go through the code to get an understanding of what the code those, then use test driven development method to write tests cases that solves ensure the events arie being emitted correctly.

@danielcdz
Copy link
Contributor

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello! I’m Daniel Calderón. In the last ODHack, I contributed to your project. I have over 3 years of experience as a software engineer and 6 months of experience working with Cairo for smart contract development.

How I plan on tackling this issue

In the last ODHack I contributed by adding unit tests to your project, I have experience and an understanding of your codebase,and to solve the issue I will use spy_events cheatcode from snfoundry to check the emitted event and assert if it is the correct

@LazarusAA
Copy link

LazarusAA commented Oct 24, 2024

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 fun first contribution to the GoStarkMe project.

How I plan on tackling this issue

  • Write unit tests to verify that the FundContractDeployed event is emitted with the correct values once the contract is set up.
  • Run the tests using the testing framework to confirm they pass.

Thank you for your consideration

ETA: 48 hrs

@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 (deploying a fund 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 fund contract events are expected to emit are correctly emitted.

@GideonBature
Copy link

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

I estimate this will take 2 days to complete.

This is how I would tackle this issue:

  1. Once issue [feat] Emit event when fund contract is deployed #136 have been worked on, I will write a test using the spy events method to make sure it 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 work on this, please?

@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 passion for blockchain technology. While this will be my first project in web3, I’m eager to apply my problem-solving skills and quickly learn the required tools.

How I plan on tackling this issue:

  1. I will start by reviewing the existing fund manager contract to understand how contracts are deployed and where the event needs to be emitted.
  2. I will add the necessary logic to emit the event when the fund contract is successfully deployed. The event will contain the owner address, the new contract address, and the ID.
    3.I will write tests to ensure that the event is emitted correctly with all the expected values, using a framework like Hardhat or Truffle.
  3. I’ll run the tests to ensure the event is being emitted as expected and that no existing functionality is broken.
  4. Finally, I will create a pull request and provide a detailed explanation of the changes, including use cases for the newly added event.

@Akshola00
Copy link

I'd be happy to do this.

@jaiminRaiyani
Copy link

Would love to tackle this!

@sasasamaes
Copy link

May I take this issue on?

ETA: 2 days

First review issue #147 and analyze the code and how it works
Create a test to emit when deploying a fund contract
Document the process

@shubha-me
Copy link

Could I take a shot at this?

@SoarinSkySagar
Copy link

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 #136 is resolved, I will add the function test_emitDeployment in test_fund.cairo. I would mock-deploy the contract in snforge using the declare and deploy mehtods and then check for emits. I will add test cases to ensure that the function is working and will make sure the tests are passing before opening the PR.

@Pvsaint
Copy link

Pvsaint commented Oct 25, 2024

I’d like to work on this.

@EmmanuelAR
Copy link
Collaborator

Hello @sasasamaes 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
Labels
ODHack9 ODHack9.0 issue
Projects
None yet
Development

No branches or pull requests