def main(yaml_fname): with open(yaml_fname, 'r') as f: y = yaml.load(f) for afactory in y['factories']: if afactory["address"] == "UNDEFINED": mapdict = {} workers = [] for aworker in afactory['workers']: workers.append({"address": aworker['address'], "micro_ether_price": int(aworker['ether_price'] * 1000000), "token_price": aworker['token_price']}) mapdict['workers'] = workers (contract_address, abi) = solcwrap.tmpl('Factory', y['settings']['provider'], mapdict) print(contract_address) afactory["address"] = contract_address afactory["abi"] = pickle.dumps(abi) afactory["sources"] = ["Factory.sol.in"] with open(yaml_fname, "w") as f: yaml.dump(y, f)
def main(yaml_fname): with open(yaml_fname, 'r') as f: y = yaml.load(f) if y["action_chain_monitor"]["address"] == "UNDEFINED": mapdict = {} workers = [] for aworker in y['factories'][0][ 'workers']: # a sort of hack, we handle first Factory only workers.append({"name": aworker['name']}) mapdict['workers'] = workers (contract_address, abi) = solcwrap.tmpl('ActionChainMonitor', y['settings']['provider'], mapdict) y["action_chain_monitor"]["address"] = contract_address y["action_chain_monitor"]["abi"] = pickle.dumps(abi) y["action_chain_monitor"]["sources"] = ['ActionChainMonitor.sol.in'] with open(yaml_fname, "w") as f: yaml.dump(y, f)
def main(yaml_fname): with open(yaml_fname, 'r') as f: y = yaml.load(f) if y["crowd_sale"]["address"] == "UNDEFINED": cwd = os.getcwd() os.chdir('../token') (contract_address, abi) = solcwrap.tmpl('PRAVOCrowdSale', y['settings']['provider'], {}) y["crowd_sale"]["address"] = contract_address y["crowd_sale"]["abi"] = pickle.dumps(abi) y["crowd_sale"]["sources"] = ['PRAVOCrowdSale.sol.in'] with open(yaml_fname, "w") as f: yaml.dump(y, f) os.chdir(cwd)
def main(yaml_fname): with open(yaml_fname, 'r') as f: y = yaml.load(f) for afactory in y['factories']: for aworker in afactory['workers']: if aworker["address"] == "UNDEFINED": (contract_address, abi) = solcwrap.tmpl('Worker', y['settings']['provider'], {}) print(contract_address) aworker["address"] = contract_address aworker["abi"] = pickle.dumps(abi) aworker["sources"] = ["Worker.sol.in"] with open(yaml_fname, "w") as f: yaml.dump(y, f)
def main(yaml_fname): with open(yaml_fname, 'r') as f: y = yaml.load(f) if y["root"]["address"] == "UNDEFINED": mapdict = {} factories = [] for afactory in y['factories']: factories.append({ "address": afactory['address'], "name": afactory['name'], "micro_ether_price": int(afactory['ether_price'] * 1000000), "token_price": afactory['token_price'], "timeout": afactory['timeout'] }) mapdict['factories'] = factories (contract_address, abi) = solcwrap.tmpl('Root', y["settings"]["provider"], mapdict) print(contract_address) y["root"]["address"] = contract_address y["root"]["abi"] = pickle.dumps(abi) y["root"]["sources"] = ["Root.sol.in"] with open(yaml_fname, "w") as f: yaml.dump(y, f)