Skip to content

Commit

Permalink
Merge pull request #27 from sum1t-here/feat/rejectEther
Browse files Browse the repository at this point in the history
add: reject ether functionality
  • Loading branch information
ishita-43 authored Oct 16, 2024
2 parents ac5f19e + 380c60c commit 99faec5
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Foundry_Contracts/src/Voting.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ modifier electionOngoing() {
_;
}

receive() external payable {
revert("This contract does not accept Ether");
}

function addCandidate(string memory _name) public ownerOnly {
// Check if a candidate with the same name already exists
for (uint i = 0; i < candidates.length; i++) {
Expand Down

0 comments on commit 99faec5

Please sign in to comment.