def deploy_montyhall_mc(_tester, chain): mc_path = META_CONTRACT head_files = [ PATH_TO_HEADS + 'MontyHall_florian.sol', PATH_TO_HEADS + 'MontyHall_florian.se', ] pyeth_deploy = PyEthereumHydraDeployment(chain, _tester.k0, _tester.a0, mc_path, head_files, instrument=True) deployed_contracts = pyeth_deploy.build_and_deploy() hydra = deployed_contracts[0][1] heads = [addr for (addr, abi) in deployed_contracts[1:]] print('MetaContract deployed at: 0x{}'.format(utils.encode_hex(hydra.address))) for i in range(len(heads)): print('Head {} deployed at: 0x{}'.format(i, utils.encode_hex(heads[i]))) ct = get_contract_translator(head_files[0]) for function_name in ct.function_data: hydra_kall = lambda _, *args, function_name=function_name, **kwargs: \ kall(_tester, chain, ct, hydra.address, function_name, *args, **kwargs) function = hydra_kall method = types.MethodType(function, hydra) setattr(hydra, function_name, method) return hydra, heads, ct
def deploy_erc20_mc(_tester, chain): mc_path = META_CONTRACT head_files = [ PATH_TO_CONTRACTS + '/nonviper/ERC20_solidity_1.sol', PATH_TO_CONTRACTS + '/nonviper/ERC20_solidity_2.sol', PATH_TO_CONTRACTS + '/nonviper/ERC20_serpent.se', PATH_TO_CONTRACTS + '/ERC20.v.py' ] pyeth_deploy = PyEthereumHydraDeployment(chain, _tester.k0, _tester.a0, mc_path, head_files, instrument=True, instrumenter_path=INSTRUMENTER_PATH) deployed_contracts = pyeth_deploy.build_and_deploy(include_constructor=False, debug=False) hydra = deployed_contracts[0][1] heads = [addr for (addr, abi) in deployed_contracts[1:]] print('MetaContract deployed at: 0x{}'.format(utils.encode_hex(hydra.address))) for i in range(len(heads)): print('Head {} deployed at: 0x{}'.format(i, utils.encode_hex(heads[i]))) ct = get_contract_translator(head_files[0]) for function_name in ct.function_data: hydra_kall = lambda _, *args, function_name=function_name, **kwargs: \ kall(_tester, chain, ct, hydra.address, function_name, *args, **kwargs) function = hydra_kall method = types.MethodType(function, hydra) setattr(hydra, function_name, method) return hydra, heads, ct