에러가 뜨는데..
714
작성한 질문수 1
버전은 0.5.1입니다.
영상과 똑같이 작성했고 뭐가 문제인지 잘 모르겠어서 질문 드립니다~
function addCandidator ~ public owner {
function upVote~ public {
function finishvote~public onlyowner{이 세부분이 에러났습니다.
brower/vote.sol : 40:5 DeclarationError: Identifier already declared.
function addCandidator(string _name) public onlyowner {
^(relevant source part starts here and spans across multiple lines).
brower/vote.sol : 20:5: the previous declaration is here:
event addCandidator(string name);
^---------------------------------------------^
이라고 써져 있고요. 볼드 처리한 곧은 전부 동일한 에러입니다.
pragma solidity 0.5.1; //버전 명시
contract vote {
//structure
struct candidator {
string name;
uint upVote;
}
//variable
bool live;
address owner;
candidator[] public candidatorlist;
//napping
mapping(address => bool) voted;
//event
event addCandidator(string name);
event upVote(string candidator, uint upVote);
event finishvote(bool live);
event voting(address owner);
//modifier
modifier onlyowner {
require(msg.sender == owner);
_;
}
//constructor
constructor() public {
owner = msg.sender;
live = true;
emit voting(owner);
}
//candidator
function addCandidator(string _name) public onlyowner {
require(live == true);
require(candidatorlist.length < 5);
candidatorlist.push(candidator(_name, 0));
//emit event
emit addCandidator (_name);
}
//voting
function upVote(uint _indexOfcandidator) public {
require(_indexOfcandidator < candidatorlist.length);
require(voted[msg.sender] == false);
candidatorlist[_indexOfcandidator].upVote++;
voted[msg.sender] = true;
emit upVote(candidatorlist[_indexOfcandidator].name, candidatorlist[_indexOfcandidator].upVote);
}
//finish vote
function finishvote() public onlyowner{
live = false;
emit finishvote(live);
}
}
}
답변 2
2025년으로 업데이트된 이더리움 마스터링 강의 내용에 대한 문의
0
49
2
실습하는 영상은 없는 건가요?
0
76
3
ova 구글 드라이브 404
0
44
1
질문이 있습니다.
1
56
2
Web3개발자2 헬로우 월드
0
60
1
LAYER2
0
91
1
질문이요
0
84
1
Web3.js1
0
124
2
질문이요
0
90
1
컴파일 및 배포
0
174
1
컴파일 및 배포
0
188
4
rinkeby testnet 사용
0
133
1
localhost 전환이 안됩니다.
0
166
1
pendding이 유지 됩니다.
0
275
0
argument 넣을 때 memory or calldata 지정
0
382
1
candidatorList 호출 에러떠요 ...에러 invalid bignumber string 뭔가요 ..ㅜ
0
506
1
deploy 이후 candidatorList 확인 시 오류가 발생합니다.
0
281
0
컴파일 창이 뜨지 않습니다.
0
230
0
거래 검증 질문이요
0
254
0
후보가 다섯명이 아니라 4명인것 같네요+기타질문
0
336
1
안녕하세요. 좋은강의 올려주셔서 감사합니다.
1
348
1
가치 전달?
0
258
0
트랜잭션 스피드 관련
0
312
1
require(live == true)관련하여.
0
233
1





