0

when I run this code I get the error "call to Voting.candidates errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="", code=INVALID_ARGUMENT, version=bignumber/5.0.8)" anybody know how to fix this or what is means??

contract Voting { ///@dev keeps track of the voter candidates' info struct VoterCandidate { string voterName; uint voterAge; } ///@dev keeps track of all the candidates VoterCandidate[] public candidates; ///@dev creates a new "VoterCandidate" and adds a the candidate to the array of candidates function candidateRegistration(string memory _voterName, uint _voterAge) public { VoterCandidate memory newCandidate; newCandidate.voterName = _voterName; newCandidate.voterAge = _voterAge; candidates.push(newCandidate); } } 

1 Answer 1

0

Are you compiling in Remix or with something like Truffle? What does your function call look like? If you are calling the function with javascript/web3 it could potentially be that you're not using '' around the number and instead passing it in as an integer. You might be doing

Voting.methods.candidateRegistration("billy", 25); 

as opposed to

Voting.methods.candidateRegistration("billy",'25'); 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.