Crate ethers_contract

source ·
Expand description

§ethers-contract

Type-safe abstractions for interacting with Ethereum smart contracts.

Warning

This library is in the process of being deprecated. See #2667 for more information.

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.

For more information, please refer to the book.

Modules§

  • The Multicall contract bindings. Auto-generated with abigen.
  • Contains the EventStream type which aids in streaming access to contract events

Macros§

  • abigenabigen
    Generates type-safe bindings to an Ethereum smart contract from its ABI.

Structs§

  • Abigenabigen
    Programmatically generate type-safe Rust bindings for an Ethereum smart contract from its ABI.
  • A reduced form of Contract which just takes the abi and produces ABI encoded data for its functions.
  • Callproviders and abigen
    Helper struct for managing calls to be made to the function in smart contract target with data.
  • Helper which manages the deployment transaction of a smart contract. It wraps a deployment transaction, and retrieves the contract address output by it.
  • 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.
  • Eventproviders
    Helper for managing the event filter before querying or streaming its logs
  • A Contract Filter that exclude certain contracts
  • FunctionCallproviders
    Helper for managing a transaction before submitting it to a node
  • Helper to match ethabi::Params with structs and nested structs
  • Metadata inside a log
  • Collects Abigen structs for a series of contracts, pending generation of the contract bindings.
  • Multicallproviders and abigen
    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 called or executed on chain.
  • MulticallContractabigen and providers
  • A Contract Filter that only includes certain contracts.

Enums§

Constants§

Traits§

  • A trait for enums unifying EthError types. This trait is usually used to represent the errors that a specific contract might throw. I.e. all solidity custom errors + revert strings.
  • A helper trait for types that represent all call input parameters of a specific function
  • A helper trait for types that represents a custom error type
  • A trait for implementing event bindings
  • A trait for types (events) that can be decoded from a RawLog

Functions§

Type Aliases§

  • Contractproviders
    Contract is a ContractInstance object with an Arc middleware. This type alias exists to preserve backwards compatibility with less-abstract Contracts.
  • ContractCallproviders
    ContractCall is a FunctionCall object with an std::sync::Arc middleware. This type alias exists to preserve backwards compatibility with less-abstract Contracts.
  • ContractDeployer is a ContractDeploymentTx object with an Arc middleware. This type alias exists to preserve backwards compatibility with less-abstract Contracts.
  • ContractFactory is a DeploymentTxFactory object with an Arc middleware. This type alias exists to preserve backwards compatibility with less-abstract Contracts.

Derive Macros§