This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Voting.sol": { | |
| "__sources__": { | |
| "Voting.sol": { | |
| "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\ncontract Voting {\r\n // 후보자 구조체\r\n struct Candidate {\r\n string name;\r\n uint voteCount;\r\n }\r\n\r\n address public admin;\r\n mapping(address => bool) public whitelist;\r\n mapping(address => bool) public hasVoted;\r\n Candidate[] public candidates;\r\n bool public votingActive;\r\n\r\n // 관리자만 실행 가능\r\n modifier onlyAdmin() {\r\n require(msg.sender == admin, \"Admin only\");\r\n _;\r\n }\r\n\r\n // 투표 진행 중일 때만 실행 가능\r\n modifier isActive() {\r\n require(votingActive, \"Voting is not active\");\r\n _;\r\n }\r\n\r\n constructor() {\r\n admin = msg.sender;\r\n }\r\n\r\n // 후보자 등록\r\n function addCandidate(string memory _name) public onlyAdmin {\r\n candidates.push(Candidate(_name, 0));\r\n }\r\n\r\n // 유권자 등록 (화이트리스트)\r\n function addVoter(a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "Voting.sol": { | |
| "__sources__": { | |
| "Voting.sol": { | |
| "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\ncontract Voting {\r\n // 후보자 구조체\r\n struct Candidate {\r\n string name;\r\n uint voteCount;\r\n }\r\n\r\n address public admin;\r\n mapping(address => bool) public whitelist;\r\n mapping(address => bool) public hasVoted;\r\n Candidate[] public candidates;\r\n bool public votingActive;\r\n\r\n // 관리자만 실행 가능\r\n modifier onlyAdmin() {\r\n require(msg.sender == admin, \"Admin only\");\r\n _;\r\n }\r\n\r\n // 투표 진행 중일 때만 실행 가능\r\n modifier isActive() {\r\n require(votingActive, \"Voting is not active\");\r\n _;\r\n }\r\n\r\n constructor() {\r\n admin = msg.sender;\r\n }\r\n\r\n // 후보자 등록\r\n function addCandidate(string memory _name) public onlyAdmin {\r\n candidates.push(Candidate(_name, 0));\r\n }\r\n\r\n // 유권자 등록 (화이트리스트)\r\n function addVoter(a |