Crate eip712

Source
Expand description

§eip712

EIP-712 is a standard for signing structured data in the Ethereum ecosystem. This crate is a tool for generating Solidity code for verifying EIP-712 style signatures based on a JSON description of a contract’s ABI.

§Example

use eip712::Eip712;

use std::io::Write;

let mut output = String::new();

// Configure and run the generator.
Eip712::<()>::new("EIP712Demo")         // Name of the base contract.
    .signing_domain("EIP712Demo")       // Name for the EIP-712 domain.
    .version("1")                       // Contract version.
    .read_str(abi)
    .unwrap()
    .generate(&mut output)
    .unwrap();

§Features

This crate has a couple optional features:

  • backtraces: Collect backtraces on error types.
  • std: Use the Rust standard library.

Modules§

abi
Rust Representation of Solidity’s ABI.

Structs§

Eip712
Generates a concrete contract implementing EIP-712 style signatures.
Locate
Wrapper for Error and Warning that provides the source location.

Enums§

ChainId
Chain identifier to use in a domain separator.
Error
Errors that can arise while generating an implementation.
VerifyingContract
Address of the verifying contract to use in a domain separator.
Warning
Warnings that can arise while generating an implementation.

Traits§

Reporter
A trait that handles errors and warnings.