UPDATE:
struct TotalVotes {
uint256 value;
}
mapping(uint256 => TotalVotes) public allVotes;
This works, BUT WHY DO I NEED TO use a struct? I only want single value which is an integer? Can't i do it without the struct?
Basically i need to store a dynamic amount of uint256 - which are IDs(unique identifiers).
How do I do this so I could then access numbers for each ID?
for example, i want to get uint256 values for ID, like this
myArray[123] and myArray[9843594]
TLDR: Need to store multiple uint256, that differ by ID which is an uint256. How do I create a mapping for it? An array where values are uint256, but you don't identify it by an address but by ID(uint256?)
I tried doing it like this
uint256 public numberOfVotes;
mapping(uint256 => numberOfVotes) public totalVotes;
but this doesn't work...
But if i create a struct with a single value that is uint256 and map the struct, then it works. So i need the struct for it?
– smenir443 Sep 29 '21 at 07:29mapping(uint256 => uint256) public totalVotesworks. – Ismael Oct 02 '21 at 04:21