eth_storage_slot
Compute the storage slot for a mapping or dynamic array entry in an Ethereum contract. Provide a layout object with slot and kind, plus key or index.
Instructions
Compute the storage slot for a mapping/array entry given a layout.
layout: {"kind": "mapping"|"dynamic_array", "slot": , ...}
mapping -> needs key; "key_type" (default uint256). For nested
mappings pass key (and optionally "key_type") as lists.
dynamic_array -> needs index; optional "element_size" in slots (default 1).
Returns {slot, slot_hex}: the slot as a decimal string and a 0x 32-byte word.
Example: eth_storage_slot({"kind":"mapping","slot":1}, "0x0000000000000000000000000000000000000000") -> slot_hex="0xa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| layout | Yes | Layout object: {"kind":"mapping"|"dynamic_array", "slot": <declared base slot, int/decimal/0x-hex>, ...}. mapping takes optional "key_type" (default "uint256"; lists for nested mappings); dynamic_array takes optional "element_size" in slots (default 1). A stringified JSON object is accepted. | |
| key | No | Mapping key (required for kind=mapping); pass a list of keys outer-to-inner for nested mappings. Ignored for arrays. | |
| index | No | Element index (required for kind=dynamic_array); int/decimal/0x-hex. Ignored for mappings. |