From d56ed42e5d5129fa21b211b38ee291cd5062318b Mon Sep 17 00:00:00 2001 From: adorda <angdmz@gmail.com> Date: Fri, 12 Jul 2019 16:45:21 -0300 Subject: [PATCH] Arreglados problemas de parametros en constructor --- gateway/gateway.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gateway/gateway.py b/gateway/gateway.py index 85cf65a..a363acd 100644 --- a/gateway/gateway.py +++ b/gateway/gateway.py @@ -204,21 +204,23 @@ class ContractDeployer: def __init__(self, gateway): self.gateway = gateway - def deploy_contract(self, abi, bytecode, gas, from_account, wait=False): + def deploy_contract(self, abi, bytecode, gas, from_account, params, wait): + if params is None: + params = {} logger.debug("Deploying contract from account: {}".format(str(from_account))) contrato = self.gateway.get_undeployed_contract(abi, bytecode) # Submit the transaction that deploys the contract - tx_hash = contrato.constructor().transact({'from': from_account, 'gas': gas, 'gasLimit': gas}) + tx_hash = contrato.constructor(**params).transact({'from': from_account, 'gas': gas, 'gasLimit': gas}) logger.debug("Transaction hash for contract deploy : {}".format(str(tx_hash.hex()))) # Wait for the transaction to be mined, and get the transaction receipt tx_receipt = self.gateway.get_receipt(tx_hash, wait) logger.debug("Receipt for contract deploy: {}".format(str(tx_receipt))) return tx_receipt - def estimate_deploy(self, abi, bytecode): + def estimate_deploy(self, abi, bytecode, params): contrato = self.gateway.get_undeployed_contract(abi, bytecode) - return contrato.constructor().estimateGas() + return contrato.constructor(**params).estimateGas() class HTTPFastLogSearcher: -- GitLab