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

[feat] Emit event when fund receives a donation #138

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

[feat] Emit event when fund receives a donation #138

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

Comments

@adrianvrj
Copy link
Member

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

  • Emit an event when a fund contract receives a new donation in the receiveDonation method.
  • The event should contain: address that is donating (caller address), the number of STRKs donated, the current STRKs balance (contract balance), and the fund contract address that is receiving the donation.
  • Please read contributors guide before asking for an issue

Acceptance Criteria

  • Code builds successfully.
  • Event struct has all the attributes needed.
@CollinsC1O
Copy link

Hello @adrianvrj I'm a Frontend and a blockchain developer. I love to work on this and get it done. Please assign

@PoulavBhowmick03
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm Poulav Bhowmick, a Starknet Wolf. I am a software engineer at Invisible Studios, and a blockchain engineer with a robust background in TypeScript, Rust, Solidity Cairo, fullstack development and blockchain technology. My experience includes building robust applications, optimizing functionalities and blockchain integration. I have actively participated in events and open source contributions, enhancing my capability to tackle real-world tech challenges. My projects can be viewed on my GitHub Profile and OnlyDust Profile. Plus I´m active member of Starknet, Ethereum, Stellar ecosystem.

How I plan on tackling this issue

I will update the receiveDonation method of the Fund contract to emit an event each time a new donation is received. The event will include the address of the donor (retrieved using get_caller_address()), the number of STRKs donated, the current STRK balance of the contract after the donation, and the fund contract address (retrieved using get_contract_address()). I will define an event structure with fields for the donor's address, donated amount, current balance, and contract address. After successfully updating the contract's donation state, I will emit this event. Additionally, I will ensure that test cases are written to validate that the event is emitted correctly with the appropriate data whenever a donation is made.

@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. I need to implement an event in a fund contract that gets triggered when a new donation is received. The event should contain specific information about the donation and the contract.
  2. I'll start by defining the event structure in the contract
  3. Next, I'll implement the receiveDonation method that will emit the event
  4. I've made sure that the event struct contains all the required attributes: donor address, donation amount, current STRKs balance, and fund contract address.
  5. I'll review the code to ensure it meets all the requirements:
  • The event is properly defined and emitted.
  • The receiveDonation method is implemented correctly.
  • The event contains all the required attributes.
  • The code builds successfully.

@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 receiveDonation method in the fund contract to identify the appropriate location for the event emission. I will then define the event struct to include the donor's address, the amount of STRKs donated, the current STRKs balance of the contract, and the fund contract address. Finally, I will implement the event emission within the receiveDonation method, ensuring the code builds successfully and meets all acceptance criteria.

@coxmars
Copy link
Contributor

coxmars commented Oct 24, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm a software developer with 2+ years of experience and I have worked with backend technologies such as Cairo, Java, C# and frontend with React, NextJS, JS/TS. Also, I'm a member of the Dojo Coding community here in CR and I have made contributions in Cairo VM Go, Cairo VM TS, Cairo Lints etc. Likewise, I’m a Cairo developer working on ByteBeasts, a fully on-chain RPG game built using the Dojo.

How I plan on tackling this issue

  • First, I will review the receiveDonation method in the fund contract to understand the flow and where exactly the event should be emitted.
  • I will define the event struct with the necessary attributes: donor’s address, the amount of STRKs donated, the updated contract balance, and the fund contract address.
  • Then, I will modify the receiveDonation method to emit this event every time a donation is received.
  • Finally, I’ll run tests to confirm the event is emitted correctly and all the attributes are captured as expected.

ET: 1-3 days

@bruhhgnik
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm nik, i want to contribute to this issue

How I plan on tackling this issue

ill make sure it works.
eta: 1 DAY

@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 solve this issue, I’ll take the following steps:

  1. I’ll define the DonationReceived event with necessary attributes.
  2. ⁠ Next, I’ll update the receiveDonation function to emit the event after receiving a donation.
  3. ⁠I’ll ensure that the contract builds successfully.
  4. ⁠Lastly, I’ll write tests to validate that the event is emitted correctly with the right data.

Please assign me, I’m ready to work.

@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..My background in smart contract development will enable me to efficiently implement this feature while adhering to best practices.

How I plan on tackling this issue

To tackle the issue of emitting an event when a fund contract receives a new donation in the receiveDonation method, I would first define an event struct that includes the donor's address, the amount of STRKs donated, the current STRK balance of the contract, and the fund contract address. In the receiveDonation method, I would implement the necessary logic to emit this event every time a donation is received. I will ensure that the code compiles without errors and that the event struct encompasses all required attributes.

@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 add the necessary Starknet event and will make sure to emit it correctly where it is required.

@SoarinSkySagar
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

GM @adrianvrj, I am Sagar Rana, a smart contract developer and full stack engineer. I have 3 years of experience building robust full stack applications and over a year of writing smart contracts. You can see my projects and contributions to some major repos on my GitHub profile. The tech stack I use mainly includes Solidity, Rust, Cairo and Typescript. I am also contributing to the Starknet and Rust ecosystems and building on Cairo and Rust languages. I am interested in contributing to projects like this to learn more about these technologies and help make these projects better. Please assign me as I would be really glad to be a contributor in this project! :)

How I plan on tackling this issue

  • Add the Event enum in fund.cairo with an event called DonationReceived: DonationReceived, and the struct definition of DonationReceived
  • Use self.emit(DonationReceived{}) before the last if statement in the receiveDonationfunction to emit the event when the function is called.
  • The Event will contain the fields donator (fetched using get_caller_address), contract_address, amount and balance
  • Ensure all tests are passing and events are being emitted

ETA: 2 Days

@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

In the receiveDonation method, emit an event when a donation is received. The event should include:

The donor's address (get_caller_address()),
The amount of STRKs donated (passed as a parameter),
The current STRKs balance (dispatcher.balance_of(get_contract_address())),
The fund contract address (get_contract_address()).

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

@MPSxDev
Copy link
Contributor

MPSxDev commented Oct 24, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello, I am Manuel, a process engineer and web3 developer. I have participated in Starknet Bootcamps, ETHGlobal and am an Elite winner of Speedrunstark. I have a high capacity to solve problems. I am a member of the DojoCoding community.

How I plan on tackling this issue

Modify the receiveDonation method in the fund contract to emit an event when a new donation is received. The event should include the donor's address, the number of STRKs donated, the current contract balance, and the fund contract address. I'll work diligently until the desired outcome is achieved, ensuring the code builds successfully.

@ryzen-xp
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I’m a blockchain developer with expertise in Cairo and Solidity, experienced in writing and testing smart contracts. Recently, I’ve worked on projects like ARK and Worldlines Bridge.

How I plan on tackling this issue

[1]=>Modify the receiveDonation method to emit an event that captures the caller’s [2]=>address, the amount of STRKs donated, the contract’s current balance, and the receiving fund contract’s address.
[3]=>Define the event struct to include all necessary attributes.
[4]=>Ensure that the code builds without errors and the event emits correctly.
[5]=>Write and run tests to verify the correct data is captured and the event behaves as expected.
I’ll ensure the event emits correctly, is well-structured, and passes all tests.
please /assign

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