Struct ethers_contract::ContractDeployer
source · [−]pub struct ContractDeployer<M, C> {
pub deployer: Deployer<M>,
/* private fields */
}Expand description
Helper which manages the deployment transaction of a smart contract.
This is just a wrapper type for [Deployer] with an additional type to convert the Contract that the deployer returns when sending the transaction.
Fields
deployer: Deployer<M>the actual deployer, exposed for overriding the defaults
Implementations
sourceimpl<M: Middleware, C: From<Contract<M>>> ContractDeployer<M, C>
impl<M: Middleware, C: From<Contract<M>>> ContractDeployer<M, C>
sourcepub fn new(deployer: Deployer<M>) -> Self
pub fn new(deployer: Deployer<M>) -> Self
Create a new instance of this ContractDeployer
sourcepub fn confirmations<T: Into<usize>>(self, confirmations: T) -> Self
pub fn confirmations<T: Into<usize>>(self, confirmations: T) -> Self
Sets the number of confirmations to wait for the contract deployment transaction
pub fn block<T: Into<BlockNumber>>(self, block: T) -> Self
sourcepub fn legacy(self) -> Self
pub fn legacy(self) -> Self
Uses a Legacy transaction instead of an EIP-1559 one to do the deployment
sourcepub fn from<T: Into<Address>>(self, from: T) -> Self
pub fn from<T: Into<Address>>(self, from: T) -> Self
Sets the from field in the deploy transaction to the provided value
sourcepub fn to<T: Into<NameOrAddress>>(self, to: T) -> Self
pub fn to<T: Into<NameOrAddress>>(self, to: T) -> Self
Sets the to field in the deploy transaction to the provided value
sourcepub fn gas<T: Into<U256>>(self, gas: T) -> Self
pub fn gas<T: Into<U256>>(self, gas: T) -> Self
Sets the gas field in the deploy transaction to the provided value
sourcepub fn gas_price<T: Into<U256>>(self, gas_price: T) -> Self
pub fn gas_price<T: Into<U256>>(self, gas_price: T) -> Self
Sets the gas_price field in the deploy transaction to the provided value
sourcepub fn value<T: Into<U256>>(self, value: T) -> Self
pub fn value<T: Into<U256>>(self, value: T) -> Self
Sets the value field in the deploy transaction to the provided value
sourcepub fn data<T: Into<Bytes>>(self, data: T) -> Self
pub fn data<T: Into<Bytes>>(self, data: T) -> Self
Sets the data field in the deploy transaction to the provided value
sourcepub fn nonce<T: Into<U256>>(self, nonce: T) -> Self
pub fn nonce<T: Into<U256>>(self, nonce: T) -> Self
Sets the nonce field in the deploy transaction to the provided value
sourcepub fn chain_id<T: Into<U64>>(self, chain_id: T) -> Self
pub fn chain_id<T: Into<U64>>(self, chain_id: T) -> Self
Sets the chain_id field in the deploy transaction to the provided value
sourcepub async fn call(&self) -> Result<(), ContractError<M>>
pub async fn call(&self) -> Result<(), ContractError<M>>
Dry runs the deployment of the contract
Note: this function does not send a transaction from your account
sourcepub fn call_raw(&self) -> CallBuilder<'_, M::Provider>
pub fn call_raw(&self) -> CallBuilder<'_, M::Provider>
Returns a CallBuilder, which when awaited executes the deployment of this contract via
eth_call. This call resolves to the returned data which would have been stored at the
destination address had the deploy transaction been executed via send().
Note: this function does not send a transaction from your account
sourcepub async fn send(self) -> Result<C, ContractError<M>>
pub async fn send(self) -> Result<C, ContractError<M>>
Broadcasts the contract deployment transaction and after waiting for it to be sufficiently confirmed (default: 1), it returns a new instance of the contract type at the deployed contract’s address.
sourcepub async fn send_with_receipt(
self
) -> Result<(C, TransactionReceipt), ContractError<M>>
pub async fn send_with_receipt(
self
) -> Result<(C, TransactionReceipt), ContractError<M>>
Broadcasts the contract deployment transaction and after waiting for it to
be sufficiently confirmed (default: 1), it returns a new instance of the contract type at
the deployed contract’s address and the corresponding
TransactionReceipt.
Trait Implementations
sourceimpl<M, C> Clone for ContractDeployer<M, C>
impl<M, C> Clone for ContractDeployer<M, C>
Auto Trait Implementations
impl<M, C> RefUnwindSafe for ContractDeployer<M, C> where
C: RefUnwindSafe,
M: RefUnwindSafe,
impl<M, C> Send for ContractDeployer<M, C> where
C: Send,
M: Send + Sync,
impl<M, C> Sync for ContractDeployer<M, C> where
C: Sync,
M: Send + Sync,
impl<M, C> Unpin for ContractDeployer<M, C> where
C: Unpin,
impl<M, C> UnwindSafe for ContractDeployer<M, C> where
C: UnwindSafe,
M: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more