Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1.44 KB

rust.md

File metadata and controls

60 lines (41 loc) · 1.44 KB

Rust

VERBS acts a Python interface to a rust evm (the revm project) and rust simulation engine. This engine can be used to write rust simulations purely in Rust for a general gain in performance over native Python.

Structure

The core Rust library can be found in the crates/ folder. It currently consists of 2 sub-crates

Note that rust/ is Rust-Python API.

The crates are organised as a workspace so cargo commands can be run from the repo root.

Rust Examples

Examples of the libraries use can be found in crates/verbs_rs/examples.

The examples can be run using cargo:

  • Basic sim demonstrating agents moving around an ERC20 token

    cargo run --release --example basic_sim -- -s <N-steps> -n <N-agents>
    
  • Initialising EVM state from mainet

    cargo run --release --example forked_sim -- -key <ALCHEMY-API-KEY>
    

Loading Contracts

Contracts deployment requires the ABI and deployment bytecode:

  • An ABI rust representation can generated using the sol! macro, e.g.

    use alloy_sol_types::sol;
    
    // From and abi string
    sol!(
      SomeABI,
      r#"<ABI-JSON-STRING>"#
    )
    
    // Or from an ABI file
    sol!(
      SomeABI,
      <PATH-TO-ABI-FILE>
    )