Skip to content
Snippets Groups Projects
Commit 6a5d1859 authored by adorda's avatar adorda
Browse files

A terminar el deploy de smart contracts con parametros

parent d56ed42e
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,8 @@ class Command(BaseCommand): ...@@ -18,6 +18,8 @@ class Command(BaseCommand):
parser.add_argument('--bytecode', help='Path del bytecode', action=str) parser.add_argument('--bytecode', help='Path del bytecode', action=str)
parser.add_argument('--abi', help='Path del abi', 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('--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) parser.set_defaults(node_url=None, account=None, bytecode=None, abi=None, gas=None, is_poa=False)
def handle(self, *args, **options): def handle(self, *args, **options):
...@@ -55,7 +57,7 @@ class Command(BaseCommand): ...@@ -55,7 +57,7 @@ class Command(BaseCommand):
deployer = ContractDeployer(gateway) deployer = ContractDeployer(gateway)
gas = deployer.estimate_deploy(abi, bytecode) gas = deployer.estimate_deploy(abi, bytecode, None)
logger.info("Gas estimado: {}".format(str(gas))) logger.info("Gas estimado: {}".format(str(gas)))
if options['gas'] is not None: if options['gas'] is not None:
gas_aux = options['gas'] gas_aux = options['gas']
...@@ -64,7 +66,7 @@ class Command(BaseCommand): ...@@ -64,7 +66,7 @@ class Command(BaseCommand):
if gas_aux is not '': if gas_aux is not '':
gas = int(gas_aux) 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("Contract address: {0}".format(tx_receipt['contractAddress']))
logger.info("tx_receipt: {}".format(str(tx_receipt))) logger.info("tx_receipt: {}".format(str(tx_receipt)))
except Exception as e: except Exception as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment