#abi #solidity #evm #ethereum #encoding #codec

no-std linera-alloy-sol-types

Compile-time ABI and EIP-712 implementations

1 unstable release

0.7.4 May 30, 2024

#30 in #evm

Download history 106/week @ 2024-06-11 62/week @ 2024-06-18 24/week @ 2024-06-25 71/week @ 2024-07-02 48/week @ 2024-07-09 84/week @ 2024-07-16 106/week @ 2024-07-23 82/week @ 2024-07-30 99/week @ 2024-08-06 150/week @ 2024-08-13 99/week @ 2024-08-20 187/week @ 2024-08-27 191/week @ 2024-09-03 277/week @ 2024-09-10 350/week @ 2024-09-17 239/week @ 2024-09-24

1,067 downloads per month
Used in 21 crates (9 directly)

MIT/Apache

650KB
14K SLoC

linera-alloy-sol-types

Compile-time representation of Ethereum's type system with ABI and EIP-712 support.

This crate provides a developer-friendly interface to Ethereum's type system, by representing Solidity types. See type_system.md for a rundown, and the crate docs for more information

Features

  • static representation of Solidity types
  • ABI encoding and decoding
  • EIP-712 encoding and decoding
  • EIP-712 Domain object w/ serde support

Usage

See the crate docs for more details.

// Declare a solidity type in standard solidity
sol! {
    struct Foo {
        bar: u256;
        baz: bool;
    }
}

// A corresponding Rust struct is generated!
let foo = Foo {
    bar: 42.into(),
    baz: true,
};

// Works for UDTs
sol! { type MyType is uint8; }
let my_type = MyType::from(42u8);

// For errors
sol! {
    error MyError(
        string message,
    );
}

// And for functions!
sol! { function myFunc() external returns (uint256); }

Licensing

This crate is an extensive rewrite of the ethabi crate by the parity team. That codebase is used under the terms of the MIT license. We have preserved the original license notice in files incorporating ethabi code.

Dependencies

~5–8MB
~158K SLoC