dappuniversity / election

A Decentralized Ethereum Voting Application Tutorial
566 stars 508 forks source link

app.candidate() #33

Open kmmr12 opened 4 years ago

kmmr12 commented 4 years ago

I got stuck on this

truffle(development)> app.candidate() Thrown: evalmachine.:0 app.candidate() ^

TypeError: app.candidate is not a function at evalmachine.:0:5 at sigintHandlersWrap (vm.js:269:15) at Script.runInContext (vm.js:124:14) at runScript (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:222:1) at Console.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/console.js:237:1) at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/repl.js:131:1) at bound (domain.js:419:14) at REPLServer.runBound [as eval] (domain.js:432:12) at REPLServer.onLine (repl.js:716:10) at REPLServer.emit (events.js:223:5)

msali123 commented 4 years ago

Have you first done => Election.deployed().then(function(instance) {app = instance})

pramadman commented 4 years ago

make a change in addCandidate funtion

mapping(uint=>candidate) public candidates1; uint public candidateCount; function addCandidate(string memory _name) private { candidateCount++; candidates1[candidateCount] = candidate(candidateCount,_name,0); }