0

I have this code:

struct VotesInfo {
    string name;
    uint256 voteCount;
    bool enabled;
    uint256 check;
}

mapping(address => mapping(uint256 => VotesInfo)) private _votelist;

How can I get the info from the mapping if I know only the second mapping key (uint256) and not the address? As I understood foreach is not an option. Also new to solidity.

Thanks!

0

You can't! The second mapping (uint256 => VotesInfo) is the value of the first mapping. To access that value, you must know its key (the address).

1
  • I had a feeling it is like that but also hoped for a workaround :) Thanks!
    – Cronos
    Apr 13 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.