web3wagers / gostarkme

Funds recollection project in Starknet ecosystem
http://web3wagers.github.io/gostarkme/
GNU Affero General Public License v3.0
15 stars 51 forks source link

[feat] Emit event when fund receives a vote #137

Closed adrianvrj closed 1 week ago

adrianvrj commented 1 week ago

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

Acceptance Criteria

mexes20 commented 1 week ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello I want to be assigned to work on this as a first time contributor to the project.

I am a developer with over 4 years of experience.

PoulavBhowmick03 commented 1 week ago

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

To solve this issue, I will modify the receiveVote method of the Fund contract to emit an event whenever a new vote is received. The event will contain the voter's address (retrieved using get_caller_address()), the fund contract address (retrieved using get_contract_address()), and the current number of upvotes after the vote is cast. I will define an event structure that includes the fields voter, contract_address, and current_votes. After the vote is successfully recorded and the upvote count is updated, I will emit this event. Additionally, I will write tests to ensure that the event is correctly emitted with the appropriate data when a new vote is received.

ETA - 4 hours

Lukman-01 commented 1 week ago

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 first analyze the receiveVote method in the fund contract to understand where to integrate the event emission. Next, I will define the event struct to include the voter address, fund contract address, and current vote count. Finally, I will implement the event emission in the receiveVote method, ensuring that the code builds successfully and meets the acceptance criteria.

anonfedora commented 1 week ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm Eleazar and I'll be working on issue #137.

I estimate this will take 4hours max to complete.

How I plan on tackling this issue

This is how I would tackle this issue:

Review the implementation of receiveVote function and Event struct and emit event with attributes as required

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

Ensure code builds successfully

evgongora commented 1 week ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hello my name is Erick! I am a systems engineering student with a focus on fullstack web development, currently working on various blockchain-based projects, including those utilizing Cairo and ZK proofs. My experience includes working with Cairo, and contributing to the open-source community through OnlyDust. My familiarity with these tools equips me to understand the nuances of these systems and ensure clean code.

I am part of Dojo Coding, and here is my OnlyDust profile: https://app.onlydust.com/u/evgongora.

How I plan on tackling this issue

To approach this problem, I would follow these steps: Define a new event struct in the fund.cairo file with the required attributes: voter (ContractAddress), fund contract address (ContractAddress), and current votes (u32). Modify the receiveVote function in the fund.cairo file to emit this event after successfully recording a vote. Update the unit tests in test_fund.cairo to verify that the event is emitted correctly.

Here's a more detailed breakdown

Define the event struct:

#[starknet::contract]
mod Fund {

After these lines, I would add something like:
#[event]
#[derive(Drop, starknet::Event)]
struct VoteReceived {
    voter: ContractAddress,
    fund_address: ContractAddress,
    current_votes: u32
}

Modify the receiveVote function:

        fn receiveVote(ref self: ContractState) {
            assert(self.voters.read(get_caller_address()) == 0, 'User already voted!');
            assert(
                self.state.read() == FundStates::RECOLLECTING_VOTES, 'Fund not recollecting votes!'
            );
            self.up_votes.write(self.up_votes.read() + 1);
            self.voters.write(get_caller_address(), self.up_votes.read());
            if self.up_votes.read() >= FundConstants::UP_VOTES_NEEDED {
                self.state.write(FundStates::RECOLLECTING_DONATIONS);
            }
        }

At the end of this function, just before the closing brace, I would add:

self.emit(VoteReceived {
    voter: get_caller_address(),
    fund_address: starknet::get_contract_address(),
    current_votes: self.up_votes.read()
});

And finally update the unit tests as needed.

Gianfranco99 commented 1 week ago

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 am going to create the event structure with the necessary parameters and when the function has been carried out correctly I am going to emit this event. It is an easy issue to solve

ShantelPeters commented 1 week ago

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 experience with smart contracts will guide me in creating a robust and efficient implementation.

How I plan on tackling this issue

To address the issue of emitting an event when a fund contract receives a new vote in the receiveVote method, I would start by defining an event structure that includes the caller's address (voter), the fund contract address receiving the vote, and the current vote count. In the receiveVote method of the fund contract, I would implement the logic to emit this event each time a new vote is cast. I will ensure the code compiles successfully and that the event struct includes all necessary attributes.

saimeunt commented 1 week ago

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 https://github.com/ArkProjectNFTs/bridge/pull/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 commented 1 week ago

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

ETA: 2 Days

jorgezerpa commented 1 week ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi! Dojo here🙋⛩️⛩️

I have 4 years of experience in full-stack development and a couple months in web3 development with Cairo and Starknet.

How I plan on tackling this issue

I will work into the contracts/src/fund.cairo on the receiveVote function.

Here is how I will implement event emition:

I'll be happy to be assigned🤠, I'm attentive⛩️

0xprivateChaos commented 1 week ago

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 receiveVote method, emit an event when a vote is received. The event should include:

  1. The voter's address (get_caller_address()),
  2. The fund contract address (get_contract_address()),
  3. The current number of votes (self.up_votes.read()).
aniruddhaaps commented 1 week ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

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

BrunoAmbricca commented 1 week ago

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 commented 1 week ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I am a blockchain developer specializing in Solidity, Cairo, and Rust, and testing contract .

How I plan on tackling this issue

[1]=>Modify the receiveVote method to emit an event when a vote is cast. The event will [2]=>include the caller’s address, the fund contract address, and the current vote count. [3]=>Define the event struct with the required attributes. [4]=>Ensure the code builds successfully without errors. [5]=>Test the event emission to verify it captures the correct data and passes all tests. I’ll ensure the event emits correctly, contains the right data, and the code remains functional with passing tests. Please /assign

jorgezerpa commented 1 week ago

🚀🚀