Crate ethers_contract
source · [−]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
Macros
abigenProc macro to generate type-safe bindings to a contract(s). This macro
accepts one or more Ethereum contract ABI or a path. Note that relative paths are
rooted in the crate’s root CARGO_MANIFEST_DIR.
Environment variable interpolation is supported via $ prefix, like
"$CARGO_MANIFEST_DIR/contracts/c.json"
Structs
abigenBuilder 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.
Helper which manages the deployment transaction of a smart contract.
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
abigenCollects Abigen structs for a series of contracts, pending generation of the contract bindings.
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
abigenDerives the AbiEncode, AbiDecode and traits for the labeled type.
abigenDerives the AbiType and all Tokenizable traits for the labeled type.
abigenDerives the EthCall and Tokenizeable trait for the labeled type.
abigenDerives fmt::Display trait and generates a convenient format for all the
underlying primitive types/tokens.
abigenDerives the EthEvent and Tokenizeable trait for the labeled type.