Skip to main content

Module token_layout

Module token_layout 

Source
Expand description

Trace-guided discovery of the storage slots a token keys its balances and allowances on. Trace-guided ERC-20 storage-layout discovery.

State overrides only help when they land on the slots a token actually reads. Most ERC-20s use Solidity’s keccak256(holder || base_slot) mapping convention, but real tokens also use Vyper’s reversed order, deep inheritance slots, proxies whose storage lives elsewhere, and rebasing shares. This module traces the token’s read-only access, validates the observed slot with a sentinel override, then recovers the mapping convention needed to fund a simulated swap.

Modules§

IERC20LayoutProbe
Module containing a contract’s types and functions.
ISharesToken
The view a share-accounted rebasing token keeps its mapping under. stETH is the one in the Tycho set; the rest of the family answers the same call.

Structs§

TokenLayout
The slots needed to fund and approve one simulated token input.

Enums§

DiscoveryError
Why a token’s storage layout could not be resolved.
KeyOrder
Mapping-key convention used by a token implementation.
MappingPosition
The base of one balance or allowance mapping.

Functions§

discover_layout
Resolves the storage a quote’s input token reads, so an override can fund it.