Skip to content

Commit

Permalink
add get_contributor (amount) func
Browse files Browse the repository at this point in the history
  • Loading branch information
Nenad committed Jun 12, 2024
1 parent 347e930 commit e581234
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions listings/applications/crowdfunding/src/campaign.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub trait ICampaign<TContractState> {
fn claim(ref self: TContractState);
fn close(ref self: TContractState, reason: ByteArray);
fn contribute(ref self: TContractState, amount: u256);
fn get_contribution(self: @TContractState, contributor: ContractAddress) -> u256;
fn get_contributions(self: @TContractState) -> Array<(ContractAddress, u256)>;
fn get_details(self: @TContractState) -> Details;
fn start(ref self: TContractState);
Expand Down Expand Up @@ -217,6 +218,10 @@ pub mod Campaign {
self.emit(Event::ContributionMade(ContributionMade { contributor, amount }));
}

fn get_contribution(self: @ContractState, contributor: ContractAddress) -> u256 {
self.contributions.get(contributor)
}

fn get_contributions(self: @ContractState) -> Array<(ContractAddress, u256)> {
self.contributions.get_contributions_as_arr()
}
Expand Down

0 comments on commit e581234

Please sign in to comment.