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

Rust Representation of Solidity’s ABI.

Structs

Generates a concrete contract implementing EIP-712 style signatures.

Wrapper for Error and Warning that provides the source location.

Enums

Chain identifier to use in a domain separator.

Errors that can arise while generating an implementation.

Address of the verifying contract to use in a domain separator.

Warnings that can arise while generating an implementation.

Traits

A trait that handles errors and warnings.