I am unable to reference struct elements which are inside mapping.
Mapping:
struct VoterData {
string iD;
address voterEthAddress;
}
// One to Many mapping; one Eth Address can have many VoterData
mapping(address => VoterData[]) public votersMapping;
Here is the code I am trying to reference the mapping:
emit messageEvent("Voter Address: ",votersMapping[localAddress].voterEthAddress );
Error
TypeError: Member "voterEthAddress" not found or not visible after argument-dependent lookup in struct Voter.VoterData storage ref[] storage ref.
--> contracts/Voter.sol:64:53:
|
64 | emit messageEvent("Voter Address: ",votersMapping[localAddress].voterEthAddress );
|