Skip to content

Commit

Permalink
Merge pull request #150 from Gerson2102/emit-event
Browse files Browse the repository at this point in the history
feat: Adding events to donatorManager contract
  • Loading branch information
EmmanuelAR authored Oct 25, 2024
2 parents 27a2ca7 + 153fe74 commit 71938b2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions contracts/src/donatorManager.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,22 @@ mod DonatorManager {
self.donator_class_hash.write(donator_class_hash.try_into().unwrap());
}

// *************************************************************************
// EVENTS
// *************************************************************************
#[event]
#[derive(Drop, starknet::Event)]
enum Event {
DonatorContractDeployed: DonatorContractDeployed,
}

#[derive(Drop, starknet::Event)]
struct DonatorContractDeployed {
new_donator: ContractAddress,
owner: ContractAddress
}


// *************************************************************************
// EXTERNALS
// *************************************************************************
Expand All @@ -54,6 +70,10 @@ mod DonatorManager {
)
.unwrap();
self.donators.write(get_caller_address().try_into().unwrap(), address_0);
self
.emit(
DonatorContractDeployed { owner: get_caller_address(), new_donator: address_0 }
)
}
fn getOwner(self: @ContractState) -> ContractAddress {
return self.owner.read();
Expand Down

0 comments on commit 71938b2

Please sign in to comment.