Struct ethers::contract::BaseContract [−][src]
pub struct BaseContract {
pub methods: HashMap<[u8; 4], (String, usize), RandomState>,
// some fields omitted
}
Expand description
A reduced form of Contract
which just takes the abi
and produces
ABI encoded data for its functions.
Fields
methods: HashMap<[u8; 4], (String, usize), RandomState>
A mapping from method signature to a name-index pair for accessing functions in the contract ABI. This is used to avoid allocation when searching for matching functions by signature.
Implementations
Returns the ABI encoded data for the provided function and arguments
If the function exists multiple times and you want to use one of the overloaded
versions, consider using encode_with_selector
Returns the ABI encoded data for the provided function selector and arguments
Decodes the provided ABI encoded function arguments with the selected function name.
If the function exists multiple times and you want to use one of the overloaded
versions, consider using decode_with_selector
pub fn decode_event<D>(
&self,
name: &str,
topics: Vec<H256, Global>,
data: Bytes
) -> Result<D, AbiError> where
D: Detokenize,
pub fn decode_event<D>(
&self,
name: &str,
topics: Vec<H256, Global>,
data: Bytes
) -> Result<D, AbiError> where
D: Detokenize,
Decodes for a given event name, given the log.topics
and
log.data
fields from the transaction receipt
Decodes the provided ABI encoded bytes with the selected function selector
pub fn into_contract<M>(
self,
address: H160,
client: impl Into<Arc<M>>
) -> Contract<M> where
M: Middleware,
pub fn into_contract<M>(
self,
address: H160,
client: impl Into<Arc<M>>
) -> Contract<M> where
M: Middleware,
Upgrades a BaseContract
into a full fledged contract with an address and middleware.
Trait Implementations
Creates a new BaseContract
from the abi.
Auto Trait Implementations
impl RefUnwindSafe for BaseContract
impl Send for BaseContract
impl Sync for BaseContract
impl Unpin for BaseContract
impl UnwindSafe for BaseContract
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
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