Struct ethers::contract::Abigen[]

pub struct Abigen { /* fields omitted */ }
Expand description

Builder struct for generating type-safe bindings from a contract’s ABI

Note: Your contract’s ABI must contain the stateMutability field. This is still not supported by Vyper, so you must adjust your ABIs and replace constant functions with view or pure.

Example

Running the command below will generate a file called token.rs containing the bindings inside, which exports an ERC20Token struct, along with all its events.

Abigen::new("ERC20Token", "./abi.json")?.generate()?.write_to_file("token.rs")?;

Implementations

Creates a new builder with the given ABI JSON source.

Manually adds a solidity event alias to specify what the event struct and function name will be in Rust.

Manually adds a solidity method alias to specify what the method name will be in Rust. For solidity methods without an alias, the snake cased method name will be used.

Specify whether or not to format the code using a locally installed copy of rustfmt.

Note that in case rustfmt does not exist or produces an error, the unformatted code will be used.

Add a custom derive to the derives for event structs and enums.

This makes it possible to for example derive serde::Serialize and serde::Deserialize for events.

Generates the contract bindings.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more