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