diff --git a/ethers-contract/src/factory.rs b/ethers-contract/src/factory.rs index 621ca23f..bca08aea 100644 --- a/ethers-contract/src/factory.rs +++ b/ethers-contract/src/factory.rs @@ -1,7 +1,7 @@ use crate::{Contract, ContractError}; use ethers_core::{ - abi::{Abi, Tokenize}, + abi::{Abi, Token, Tokenize}, types::{transaction::eip2718::TypedTransaction, BlockNumber, Bytes, TransactionRequest}, }; use ethers_providers::Middleware; @@ -148,17 +148,8 @@ impl ContractFactory { Self { client, abi, bytecode } } - /// Constructs the deployment transaction based on the provided constructor - /// arguments and returns a `Deployer` instance. You must call `send()` in order - /// to actually deploy the contract. - /// - /// Notes: - /// 1. If there are no constructor arguments, you should pass `()` as the argument. - /// 1. The default poll duration is 7 seconds. - /// 1. The default number of confirmations is 1 block. - pub fn deploy(self, constructor_args: T) -> Result, ContractError> { + pub fn deploy_tokens(self, params: Vec) -> Result, ContractError> { // Encode the constructor args & concatenate with the bytecode if necessary - let params = constructor_args.into_tokens(); let data: Bytes = match (self.abi.constructor(), params.is_empty()) { (None, false) => return Err(ContractError::ConstructorError), (None, true) => self.bytecode.clone(), @@ -184,4 +175,16 @@ impl ContractFactory { block: BlockNumber::Latest, }) } + + /// Constructs the deployment transaction based on the provided constructor + /// arguments and returns a `Deployer` instance. You must call `send()` in order + /// to actually deploy the contract. + /// + /// Notes: + /// 1. If there are no constructor arguments, you should pass `()` as the argument. + /// 1. The default poll duration is 7 seconds. + /// 1. The default number of confirmations is 1 block. + pub fn deploy(self, constructor_args: T) -> Result, ContractError> { + self.deploy_tokens(constructor_args.into_tokens()) + } }