Struct ethers_contract::ContractDeploymentTx
source · pub struct ContractDeploymentTx<B, M, C> {
pub deployer: Deployer<B, M>,
/* private fields */
}
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>
impl<B, M, C> ContractDeploymentTx<B, M, C>
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
sourcepub fn block<T: Into<BlockNumber>>(self, block: T) -> Self
pub fn block<T: Into<BlockNumber>>(self, block: T) -> Self
Sets the block at which RPC requests are made
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
.