1.0.0 • Published 9 months ago

slot-reader v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Contract Storage Slot Reader

Currently only supports Ethereum contracts and first 20 slots.

./bin contains a prebuilt binary of Forge.

Usage

Create a foundry.toml file in the root directory with the following config:

[profile.slots]
src = 'node_modules/slot-reader/src'
out = 'node_modules/slot-reader/out'
libs = ['node_modules/slot-reader/lib']
test= 'node_modules/slot-reader/test'
cache_path='node_modules/slot-reader/cache'
rpc_endpoints = { eth = "https://rpc.ankr.com/eth"}

Alternatvely copy the foundry.toml from this package.

Set FOUNDRY_PROFILE=slots within your env.

Reads storage slots at latest block

import {readAllStorageSlots} from 'slot-reader'
readAllStorageSlots("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2")

Reads storage slots at given block

import {readAllStorageSlots} from 'slot-reader'
readAllStorageSlots("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", 17000000)
1.0.0

9 months ago