Skip to content

Commit

Permalink
feat(@contracts): AG-19 added events to smart contract
Browse files Browse the repository at this point in the history
added events to the DECsRegistry smart contract
  • Loading branch information
g3k0 committed Mar 29, 2024
1 parent e709a14 commit a21436c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion contracts/DECsRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ contract DECsRegistry is DEC {
/// @dev the address is related to the Voter's EOA
mapping (address => bytes) registry;

event DECRegistered(address indexed voter, bytes dec);
event DECStamped(address indexed election, address indexed voter);


/// @notice this function is used by the third party authority to register a Voter's DEC in the registry
/// @dev the DEC contains sensitive data that must be encrypted
function registerDEC(decData memory dec, address voter) public onlyOwner {
require(registry[voter].length == 0, "The Voter's DEC has been already registered");
registry[voter] = encryptDEC(dec);
emit DECRegistered(voter, registry[voter]);
return;
}

Expand All @@ -50,6 +54,8 @@ contract DECsRegistry is DEC {
/// @notice this function put the election stamp on the Voter's DEC after the vote
/// @dev the owner of the DECs registry is the same of the election smart contract (third party authority)
function stampsTheDEC(address election, address voter) public onlyOwner {
return electoralStamps[voter].push(election);
electoralStamps[voter].push(election);
emit DECStamped(election, voter);
return;
}
}

0 comments on commit a21436c

Please sign in to comment.