pub struct ContractDeploymentTx<B, M, C> {
    pub deployer: Deployer<B, M>,
    /* private fields */
}
Available on crate feature providers only.
Expand description

Helper which manages the deployment transaction of a smart contract. It wraps a deployment transaction, and retrieves the contract address output by it.

Currently, we recommend using the ContractDeployer type alias.

Fields§

§deployer: Deployer<B, M>

the actual deployer, exposed for overriding the defaults

Implementations§

source§

impl<B, M, C> ContractDeploymentTx<B, M, C>
where B: Borrow<M> + Clone, M: Middleware, C: From<ContractInstance<B, M>>,

source

pub fn new(deployer: Deployer<B, M>) -> Self

Create a new instance of this from a deployer.

source

pub fn confirmations<T: Into<usize>>(self, confirmations: T) -> Self

Sets the number of confirmations to wait for the contract deployment transaction

source

pub fn block<T: Into<BlockNumber>>(self, block: T) -> Self

Sets the block at which RPC requests are made

source

pub fn legacy(self) -> Self

Uses a Legacy transaction instead of an EIP-1559 one to do the deployment

source

pub fn from<T: Into<Address>>(self, from: T) -> Self

Sets the from field in the deploy transaction to the provided value

source

pub fn to<T: Into<NameOrAddress>>(self, to: T) -> Self

Sets the to field in the deploy transaction to the provided value

source

pub fn gas<T: Into<U256>>(self, gas: T) -> Self

Sets the gas field in the deploy transaction to the provided value

source

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

source

pub fn value<T: Into<U256>>(self, value: T) -> Self

Sets the value field in the deploy transaction to the provided value

source

pub fn data<T: Into<Bytes>>(self, data: T) -> Self

Sets the data field in the deploy transaction to the provided value

source

pub fn nonce<T: Into<U256>>(self, nonce: T) -> Self

Sets the nonce field in the deploy transaction to the provided value

source

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

source

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

source

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

source

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.

source

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.

source

pub fn abi(&self) -> &Abi

Returns a reference to the deployer’s ABI

source

pub fn client(&self) -> &M

Returns a pointer to the deployer’s client

Trait Implementations§

source§

impl<B, M, C> Clone for ContractDeploymentTx<B, M, C>
where B: Clone,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<B: Debug, M: Debug, C: Debug> Debug for ContractDeploymentTx<B, M, C>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<B, M, C> RefUnwindSafe for ContractDeploymentTx<B, M, C>

§

impl<B, M, C> Send for ContractDeploymentTx<B, M, C>
where B: Send, C: Send, M: Send,

§

impl<B, M, C> Sync for ContractDeploymentTx<B, M, C>
where B: Sync, C: Sync, M: Sync,

§

impl<B, M, C> Unpin for ContractDeploymentTx<B, M, C>
where B: Unpin, C: Unpin, M: Unpin,

§

impl<B, M, C> UnwindSafe for ContractDeploymentTx<B, M, C>
where B: UnwindSafe, C: UnwindSafe, M: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> JsonSchemaMaybe for T