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 user withdraw fund's balance #139

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

[feat] Emit event when user withdraw fund's balance #139

adrianvrj opened this issue Oct 24, 2024 · 15 comments · Fixed by #149
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 withdraw method.
  • The event should contain: fund contract address, owner address, STRKs amount that is withdrawn.
  • 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 I'm a front-end and a blockchain developer and will love to work on this

@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

To solve this issue, I will modify the withdraw method of the Fund contract to emit an event when a withdrawal is made. The event will include the fund contract address (retrieved using get_contract_address()), the owner's address (retrieved using get_caller_address()), and the amount of STRKs withdrawn. I will define an event structure with fields for the contract address, owner address, and the withdrawn STRK amount. After the withdrawal is completed and the STRK tokens are transferred, I will emit this event. Additionally, I will write test cases to ensure that the event is emitted correctly with the appropriate data when a withdrawal occurs.

@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

I'll start by defining the event in the fund contract
I'll implement the withdraw method in the fund contract
I'll create a test file for the fund contract and add a test case
I'll ensure the event is properly defined and emitted, and that the tests pass 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 tackle this issue, I will begin by reviewing the existing withdraw method in the fund contract to identify where the event should be emitted. I will then define a new event struct that includes the fund contract address, owner address, and the amount of STRKs withdrawn, ensuring all required attributes are incorporated. Finally, I will implement the event emission within the withdraw method and test the code to ensure it builds 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 test it to make sure it is working

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

@nickgore
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi, I'm data analyst / SC dev. For last half a year i ve been participating in development of DeFi products on Starknet, thus i have quite extensive hands on experience with Cairo. While I have solid experience with cairo i believe theres always room to learn from new codebases and other developers.

How I plan on tackling this issue

  1. define event structure in the contract. Add struct for withdrawal event with field mentioned in the description of issue.
  2. Add emision of this event to withdraw func.
  3. Add tests with following scenarios:
  • successful withdrawal -> event emitted
  • unsuccessful withdrawal -> event was not emitted
  • several withdraws -> corresponding number of events are emitted.

ETA 1 day

@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 Withdrawn: Withdrawn, and the struct definition of Withdrawn
  • Use self.emit(Withdrawn{}) after the last self.setState() statement in the withdraw function.
  • The Event will contain the fields owner, amount and contract_address
  • Ensure all tests are passing and events are 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 withdraw method, emit an event after the withdrawal occurs. The event should include the fund contract address (get_contract_address()), the owner address (self.getOwner()), and the STRKs amount withdrawn (retrieved from the balance_of function). Update the method to trigger this event with the correct values after successfully transferring the funds.

@jrmncos
Copy link

jrmncos commented Oct 24, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I'm Software Enginer Backend SR in web 2.0. I'm learning Cairo I don't have many experience with the language but i can work on it

How I plan on tackling this issue

I will found the code that receive a new donation and I will add the event as it expected

@aniruddhaaps
Copy link

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
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 for the method that needs the event emitted, follow the guidelines of the contributor guide and test it´s different cases

@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 member of Dojo Coding, 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

  1. Review the Fund Contract
    Start by locating the withdraw method in the fund contract. This method likely handles the logic for withdrawing funds.
  2. Define the Event Structure
    Define an event that will be emitted when a withdrawal occurs. The event should include the fund contract address, owner address, and the amount of STRKs withdrawn.
  3. Modify the withdraw Method
    Modify the withdraw method to emit the WithdrawEvent when the withdrawal happens.
    You will need to pass the necessary values to the event, such as the fund contract address (likely self), the owner address, and the withdrawn amount.
  4. Update the Tests
    Ensure that your test cases are updated or new ones are added to check if the event is emitted correctly during the withdrawal.

@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 withdraw method in the fund contract to emit an event when a new donation is received, including the fund contract address, owner address, and the amount of STRKs withdrawn. I'll work diligently until the desired outcome is achieved, ensuring the code builds successfully and the event struct contains all necessary attributes.

@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 Rust , Cairo and Solidity, experienced in writing and testing smart contracts

How I plan on tackling this issue

Modify the withdrawal function to emit an event containing the contract address, [1]=>owner address, and STRKs amount withdrawn.
[2]=>Define the event struct with the required attributes.
[3]=>Ensure the code builds successfully after the implementation.
[4]=>Run tests to verify that the event emits the correct values during withdrawal.
I’ll ensure the event is emitted correctly and the contract remains functional with passing 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
Development

Successfully merging a pull request may close this issue.