bal-layout
solc storageLayout → slot arithmetic and typed decoding. Give it a path
like balances[0xabc…], totals.index, items[2] and it answers with a
slot, byte offset and size; give it a 32-byte word and it decodes the
value. Works the other way too: describe_slot names everything in a slot
except mapping entries (keccak is one-way).
use ;
use ;
let layout = from_json?;
// packed: `paused` is byte 0 of slot 1, `owner` bytes 1..21
let owner = layout.locate?;
assert_eq!;
// mapping key → slot = keccak(pad32(key) ‖ slot)
let bal = layout.locate?;
assert_ne!;
let word = B256from;
assert_eq!;
# Ok::
The layout comes from your compiler — forge inspect C storageLayout, or
extra_output = ["storageLayout"] and the whole artifact — not from the
ABI. typescript(name) emits a TypeScript interface for the same shape;
kind_of(path) says whether a path is a value, struct, mapping or array.
Part of balq.