Struct ethers_contract_abigen::Abigen [−][src]
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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Abigen
impl UnwindSafe for Abigen
Blanket Implementations
Mutably borrows from an owned value. Read more
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