я использую remix IDE для развертывания смарт-контракта и передаю строку [], которая будет содержать имена кандидатов, например [alice, bob] ...
это мой смарт-контракт
pragma solidity ^0.4.18;
// We have to specify what version of compiler this code will compile with
contract Voting {
/* mapping field below is equivalent to an associative array or hash.
The key of the mapping is candidate name stored as type bytes32 and value is
an unsigned integer to store the vote count
*/
mapping (bytes32 => uint8) public votesReceived;
/* Solidity doesn't let you pass in an array of strings in the constructor (yet).
We will use an array of bytes32 instead to store the list of candidates
*/
bytes32[] public candidateList;
/* This is the constructor which will be called once when you
deploy the contract to the blockchain. When we deploy the contract,
we will pass an array of candidates who will be contesting in the election
*/
function Voting(string[] candidateNames) public {
for(uint i = 0; i < candidateNames.length; i++) {
candidateList[i]= stringToBytes32(candidateNames[i]);
}
}
function totalVotesFor(bytes32 candidate) view public returns (uint8) {
return votesReceived[candidate];
}
function stringToBytes32(string memory source) returns (bytes32 result) {
bytes memory tempEmptyStringTest = bytes(source);
if (tempEmptyStringTest.length == 0) {
return 0x0;
}
assembly {
result := mload(add(source, 32))
}
}
function voteForCandidate(bytes32 candidate) public {
votesReceived[candidate] += 1;
}
}
но у меня возникла эта ошибка, которую я не знал, как решить
UnimplementedFeatureError: Nested arrays not yet implemented.
Может кто-нибудь помочь мне, плз