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 #149

Merged
merged 5 commits into from
Oct 25, 2024

Conversation

MPSxDev
Copy link
Contributor

@MPSxDev MPSxDev commented Oct 24, 2024

Pull Request

Changes description

This PR adds DonationWithdraw event for fn withdraw in fund.cairo file, using owner_address as the key and withdrawn_amount as the data.

Current output

The example output is:

"events": [
    {
      "from_address": "0x27d07155a12554d4fd785d0b6d80c03e433313df03bb57939ec8fb0652dbe79", //Contract Address
      "keys": [
        "0x426f6f6b4164646564",  // selector!("DonationWithdraw")
        "0x27d070b6db5703e433313df0939ec8fb0680c155a12554d4fd785d3b52dbe79" // Owner address
      ],
      "data": [
        "0x208b7fff7fff7ffe", //withdrawn_amount (u256 STRK)
      ]
    }
  ]

Where:

  • first key = selector!("DonationWithdraw")
  • second key = Owner address
  • data = withdrawn_amount

Event Struct:

    pub struct DonationWithdraw {
        #[key]
        pub owner_address: ContractAddress,
        pub withdrawn_amount: u256
    }

Time spent breakdown

2 hours aprox spent

Comments

I look forward to any comments or questions.

@EmmanuelAR EmmanuelAR self-requested a review October 24, 2024 22:49
contracts/src/fund.cairo Show resolved Hide resolved
contracts/src/fund.cairo Show resolved Hide resolved
@EmmanuelAR
Copy link
Collaborator

Excellent work @MPSxDev, some request changes!

@MPSxDev
Copy link
Contributor Author

MPSxDev commented Oct 25, 2024

Excellent work @MPSxDev, some request changes!

Thank you @EmmanuelAR. I completed all the requested changes.

Copy link
Collaborator

@EmmanuelAR EmmanuelAR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Excellent!

@EmmanuelAR EmmanuelAR merged commit 85b45cd into undefinedorgcr:dev Oct 25, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feat] Emit event when user withdraw fund's balance
2 participants