slither
slither copied to clipboard
slither-constellation / slither-composability: create a mapping of connected contracts
We can extend what we did with slither-read-storage to create a graph of contracts that are connected to each others:
- From an address, fetch the source code, detect all the
address/contract - Read the addresses onchain, and fetch the new source code
- Iterate, and create a graph
We might need to limit the iteration in case the graph is becoming too large. We could also have different types of edges (to highlight the type of calls, transfer of funds, etc..).
We might need some heuristics, or user configuration, for array/mapping, in case there are too many elements to check.
A test contract full of abundance for one-level deeper (also grabbing & iterating on addresses in storage) is UniswapV2Factory.
If you'd like to experiment with reading mappings w/o replaying historical txs or relying on event gathering to find mapping keys, using a tool like erigon-db to walk_storage() can provide results for you.