From 6a5d1859a2e2e6f26bbe5bb69fab57362f160a4e Mon Sep 17 00:00:00 2001
From: adorda <angdmz@gmail.com>
Date: Fri, 12 Jul 2019 16:53:04 -0300
Subject: [PATCH] A terminar el deploy de smart contracts con parametros

---
 gateway/management/commands/deployar_smart_contract.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gateway/management/commands/deployar_smart_contract.py b/gateway/management/commands/deployar_smart_contract.py
index 485901a..e0600c5 100644
--- a/gateway/management/commands/deployar_smart_contract.py
+++ b/gateway/management/commands/deployar_smart_contract.py
@@ -18,6 +18,8 @@ class Command(BaseCommand):
         parser.add_argument('--bytecode', help='Path del bytecode', action=str)
         parser.add_argument('--abi', help='Path del abi', action=str)
         parser.add_argument('--gas', help='Gas a usar', action=int)
+        parser.add_argument('--constructor_args', help='Parametros del constructor en formato json', nargs='*',
+                            default='{}')
         parser.set_defaults(node_url=None, account=None, bytecode=None, abi=None, gas=None, is_poa=False)
 
     def handle(self, *args, **options):
@@ -55,7 +57,7 @@ class Command(BaseCommand):
 
             deployer = ContractDeployer(gateway)
 
-            gas = deployer.estimate_deploy(abi, bytecode)
+            gas = deployer.estimate_deploy(abi, bytecode, None)
             logger.info("Gas estimado: {}".format(str(gas)))
             if options['gas'] is not None:
                 gas_aux = options['gas']
@@ -64,7 +66,7 @@ class Command(BaseCommand):
             if gas_aux is not '':
                 gas = int(gas_aux)
 
-            tx_receipt = deployer.deploy_contract(abi, bytecode, gas, True)
+            tx_receipt = deployer.deploy_contract(abi, bytecode, gas, True, None, False)
             logger.info("Contract address: {0}".format(tx_receipt['contractAddress']))
             logger.info("tx_receipt: {}".format(str(tx_receipt)))
         except Exception as e:
-- 
GitLab