From 69daeb9cf8294c6ab1d1a6c4495f792a621145be Mon Sep 17 00:00:00 2001 From: Jorge Zerpa Date: Fri, 25 Oct 2024 11:45:00 -0400 Subject: [PATCH] [test] #137 add new values to event --- contracts/src/fund.cairo | 14 ++++++++++++-- contracts/tests/test_fund_manager.cairo | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/contracts/src/fund.cairo b/contracts/src/fund.cairo index 65f59ae..4fc7a0f 100644 --- a/contracts/src/fund.cairo +++ b/contracts/src/fund.cairo @@ -79,10 +79,13 @@ mod Fund { #[derive(Drop, starknet::Event)] pub struct NewVoteReceived { + #[key] pub voter: ContractAddress, + pub fund: ContractAddress, + pub votes: u32 } - + // ************************************************************************* // EXTERNALS // ************************************************************************* @@ -121,7 +124,14 @@ mod Fund { self.state.write(FundStates::RECOLLECTING_DONATIONS); } - self.emit(NewVoteReceived { voter: get_caller_address() }); + self + .emit( + NewVoteReceived { + voter: get_caller_address(), + fund: get_contract_address(), + votes: self.up_votes.read() + } + ); } fn getUpVotes(self: @ContractState) -> u32 { return self.up_votes.read(); diff --git a/contracts/tests/test_fund_manager.cairo b/contracts/tests/test_fund_manager.cairo index a9a862b..91c647b 100755 --- a/contracts/tests/test_fund_manager.cairo +++ b/contracts/tests/test_fund_manager.cairo @@ -77,5 +77,5 @@ fn test_new_fund() { let expected_fund_class_hash = get_class_hash(fund_manager_contract.getFund(1)); let current_id = fund_manager_contract.getCurrentId(); assert(expected_fund_class_hash == fund_class_hash, 'Invalid fund address'); - assert(current_id == 2 , 'Invalid current ID'); + assert(current_id == 2, 'Invalid current ID'); }