Expand description
ERC-7201 namespaced storage layouts.
solcβs storageLayout output only covers conventional storage. Namespaces declared with
@custom:storage-location erc7201:<id> are computed with Solar and appended to it, so storage
decoding labels namespaced fields as <id>.<field>.
Re-exportsΒ§
use alloy_primitives::U256;πuse eyre::Result;πuse foundry_compilers::ArtifactId;πuse foundry_compilers::ProjectCompileOutput;πuse foundry_compilers::artifacts::Remapping;πuse foundry_compilers::artifacts::Sources;πuse foundry_compilers::artifacts::StorageLayout;πuse path_slash::PathExt;πuse solar::ast::NatSpecKind;πuse solar::interface::ColorChoice;πuse solar::interface::Session;πuse solar::interface::config::CompileOpts;πuse solar::interface::config::ImportRemapping;πuse solar::interface::source_map::FileLoader;πuse solar::interface::source_map::FileName;πuse solar::interface::source_map::SourceMap;πuse solar::sema::Compiler;πuse solar::sema::CompilerRef;πuse solar::sema::Gcx;πuse solar::sema::hir;πuse solar::sema::output::StorageLayoutOutput;πuse std::collections::BTreeMap;πuse std::collections::HashMap;πuse std::io;πuse std::ops::ControlFlow;πuse std::path::Path;πuse std::path::PathBuf;πuse std::sync::Arc;π
StructsΒ§
- NoFile
Loader π - Rejects filesystem access, so Standard JSON imports only resolve to the supplied sources.
- Storage
Namespace π - A storage namespace declared by a struct in a contract or one of its bases.
ConstantsΒ§
- ANNOTATION π
- The NatSpec tag content that marks a namespace; cheap to search for in source text.
FunctionsΒ§
- collect_
storage_ πlayouts - Returns namespaces declared in
contractand its linearized bases, once per declaration. - contracts_
by_ πsource - Maps
(source, name)to contracts, with sources relative torootand slash-separated. - extend_
storage_ layout - Appends the ERC-7201 namespaces of
contractand its bases to its storage layout. - extend_
storage_ layouts - Returns
layoutswith the ERC-7201 namespaces of each contract appended. - find_
contract - Returns the contract
namedeclared in the sourcepath, relative toroot. - has_
annotation π - Returns whether
sourcementions an ERC-7201 storage location. - has_
annotations - Returns whether any parsed source mentions an ERC-7201 storage location.
- lower
- Lowers the parsed sources to HIR unless that has already happened.
- merge_
storage_ πnamespaces - Merges namespaces, rejecting duplicate declarations before
layoutis modified. - parse_
namespace π - parse_
standard_ json - Parses Standard JSON
sources, keyed by source unit name, without touching the filesystem. - project_
storage_ layouts - Returns the storage layouts of
outputβs artifacts with ERC-7201 namespaces appended. - scope_
layout π - Scopes type IDs to
namespaceand attributes every entry tocontract. - solar_
error π - storage_
namespace π - Returns the ERC-7201 namespace declared by a structβs
@custom:storage-locationtag.