Crate ethers_contract[][src]

Expand description

Type-safe abstractions for interacting with Ethereum smart contracts

Interacting with a smart contract requires broadcasting carefully crafted transactions where the data field contains the function’s selector along with the arguments of the called function.

This module provides the Contract and ContractFactory abstractions so that you do not have to worry about that. It also provides typesafe bindings via the abigen macro and the Abigen builder.

Modules

This module exposes low lever builder structures which are only consumed by the type-safe ABI bindings generators.

Macros

abigenabigen

Proc macro to generate type-safe bindings to a contract(s). This macro accepts one or more Ethereum contract ABI or a path. Note that this path is rooted in the crate’s root CARGO_MANIFEST_DIR.

Structs

Abigenabigen

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

A reduced form of Contract which just takes the abi and produces ABI encoded data for its functions.

A Contract is an abstraction of an executable program on the Ethereum Blockchain. It has code (called byte code) as well as allocated long-term memory (called storage). Every deployed Contract has an address, which is used to connect to it so that it may be sent messages to call its methods.

To deploy a contract to the Ethereum network, a ContractFactory can be created which manages the Contract bytecode and Application Binary Interface (ABI), usually generated from the Solidity compiler.

Metadata inside a log

A Multicall is an abstraction for sending batched calls/transactions to the Ethereum blockchain. It stores an instance of the Multicall smart contract and the user provided list of transactions to be made.

Enums

ABI codec related errors

An Error which is thrown when interacting with a smart contract

Traits

A helper trait for types that represent all call input parameters of a specific function

A trait for implementing event bindings

A trait for types (events) that can be decoded from a RawLog

Functions

Helper for ABI decoding raw data based on a function’s input or output.

Decodes a series of logs into a vector

Helper for ABI encoding arguments for a specific function

Derive Macros

Derives the Tokenizable trait for the labeled type.

EthCallabigen

Derives the EthCall and Tokenizeable trait for the labeled type.

Derives fmt::Display trait and generates a convenient format for all the underlying primitive types/tokens.

EthEventabigen

Derives the EthEvent and Tokenizeable trait for the labeled type.