How wevm/ox works
Main System Components
• Core Library Modules – Represent the bulk of the functionality within the src/core folder. This includes modules for:
– Ethereum data structures such as ABIs (Abi, AbiConstructor, AbiEvent, etc.)
– Cryptographic utilities (Secp256k1, P256, Bls, etc.)
– Transaction envelopes (various EIP-specific envelopes)
– Polymorphic utilities like Hex, Bytes, JSON-RPC, RLP, and more.
• Specialized Modules – Include additional directories and implementations such as:
– ERC modules: Separate subdirectories like src/erc4337 and src/erc6492 that build on the core primitives.
– Trusted setups: Located under src/trusted-setups for cryptographic parameters and protocols.
• Smart Contracts Integration – The contracts directory holds Solidity smart contracts and related scripts. This area forms the bridge with Ethereum on-chain logic.
• Examples and Documentation – The examples folder (e.g., webauthn-p256) demonstrates how to use Ox in realistic scenarios. Also, the site and scripts/docgen directories are used for generating and hosting documentation.
• Testing & Internal Utilities – Multiple _test directories within src/core, src/erc4337, src/erc6492, and additional tests in the root test folder illustrate the project’s emphasis on robust testing.
Relationships and Interactions
• The Core Library is the backbone and is used by all the specialized modules and examples.
• The ERC modules (ERC4337, ERC6492) are layered on top of the core primitives to provide additional functionalities related to Ethereum proposals.
• The Contracts segment interacts with the on-chain world and the TypeScript API (e.g., deployment scripts in the contracts/scripts folder).
• Testing components (found in src/core/_test, test, and vectors) should be represented as parallel blocks ensuring robustness; they “drive” the development of the main modules.
Treat Architectural Patterns and Design Principles
• Modularity – Each major feature (e.g., ABIs, Cryptography, Transactions) is encapsulated in its own module.
• Unopinionated & Stateless APIs – Show that functions (such as interface constructors, signing, and serialization) remain pure and stateless.
• The Functional Core (src/core)
• Extended functionality (ERC modules and Trusted setups)
• External interactions (Provider and contracts)
• Developer tooling and documentation (scripts, site)
• Testing/Validation – Include a testing block that interacts with nearly every module to affirm functionality.
Representing Technologies and Frameworks
• That the code is written in TypeScript, with Foundry-related configuration (contracts/foundry.toml, forge-std in contracts/lib) for Solidity contracts.
• The actions and GitHub workflows indicate continuous integration practices; you might include a “CI/CD” cloud component if desired.
• Documentation generation via scripts/docgen and site pages can be shown as a separate “Docs & Tooling” unit.