-
Notifications
You must be signed in to change notification settings - Fork 81
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] #327 Add Legacy Map to Fund Contract for Donation Tracking #334
Conversation
Hello @EmmanuelAR, I wanted to confirm if I'm to provide test cases for my implementations considering there is an issue #328 to address creating unit test for legacy map. let me Know if I'm to provide this test case for clarity. Thank you I will love to get your telegram handle or the projects telegram handle, or any means in which I can reach out to you or any member of the team, that's if its ok |
Hey @CollinsC1O, yes the unit test will be work in other issue. Our discord channel: https://discord.gg/sEpnC6JB2U tks for the pr, let me check it |
Hey @CollinsC1O could you please add the evidence of scarb build please :) |
Also @CollinsC1O, please check this important note attach to the ticket: |
ok I will provide all that you require of me |
Hello @EmmanuelAR, below are the provided evidences as also included in the description above, updating the comment
|
src/fund.cairo
Outdated
@@ -88,6 +88,7 @@ pub mod Fund { | |||
reason: ByteArray, | |||
up_votes: u32, | |||
voters: LegacyMap::<ContractAddress, u32>, | |||
donator_totals: LegacyMap::<ContractAddress, u256>, // Track total donations per address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please called the legacy map as: donators
Also remove the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/fund.cairo
Outdated
@@ -205,6 +206,12 @@ pub mod Fund { | |||
} | |||
fn update_receive_donation(ref self: ContractState, strks: u256) { | |||
let current_balance = self.get_current_goal_state(); | |||
// Get caller address |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/fund.cairo
Outdated
@@ -205,6 +206,12 @@ pub mod Fund { | |||
} | |||
fn update_receive_donation(ref self: ContractState, strks: u256) { | |||
let current_balance = self.get_current_goal_state(); | |||
// Get caller address | |||
let caller: ContractAddress = get_caller_address(); | |||
// Read donor's existing total |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/fund.cairo
Outdated
let caller: ContractAddress = get_caller_address(); | ||
// Read donor's existing total | ||
let prev_total = self.donator_totals.read(caller); | ||
// Add current donation to their running total (adding donation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing all comments
…donators and remove coments
Hello @EmmanuelAR all requested changes have been observed and implemented. Thanks for your review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Description:
This pull request implements donor tracking functionality in the fund contract as requested in issue #327. The implementation introduces a permanent record of donor contributions while maintaining the contract's existing behavior.
Changes Made:
Storage Addition:
Added legacy map for donor addresses and totals
The update_receive_donation function now:
Requirements Fulfilled:
Current output
Note: