-
Notifications
You must be signed in to change notification settings - Fork 4
/
Sample-Events.sol
42 lines (34 loc) Β· 2.02 KB
/
Sample-Events.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// SPDX-License-Identifier: MIT LICENSE
/*
Follow/Subscribe Youtube, Github
for more amazing content!!
@Net2Dev
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
THIS CONTRACT IS AVAILABLE FOR EDUCATIONAL
PURPOSES ONLY. YOU ARE SOLELY REPONSIBLE
FOR ITS USE. I AM NOT RESPONSIBLE FOR ANY
OTHER USE. THIS IS TRAINING/EDUCATIONAL
MATERIAL. ONLY USE IT IF YOU AGREE TO THE
TERMS SPECIFIED ABOVE.
*/
pragma solidity 0.8.7;
contract Dao {
struct RecordVote {
uint256 voteAmount;
uint256 choiceSelect;
}
mapping(address => RecordVote) public _voted;
// Create the event and specify the event parameters:
event AddVote(address wallet, uint256 numVotes, uint256 choice);
function vote(uint256 numVotes, uint256 choice) external {
_voted[msg.sender].voteAmount = numVotes;
_voted[msg.sender].choiceSelect = choice;
// Call the event with the emit action and pass the values from the function
emit AddVote(msg.sender, numVotes, choice);
}
}