Read storage data of a “mapping (address => bool)” from another contract


This Content is from Stack Overflow. Question asked by daisy

I’m trying to read the storage data of another contract, and get all of the addresses in testData:

contract XXX {
   mapping (address => bool) public testData;

According to the Mappings and Dynamic Arrays document, each value is stored with a storage location keccak256(key).

Since this mapping is keyed with address, I’m unable to predicate the key, how can I retrieve all the keys?


Check the Answers

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?