def deploy_crowdsale_from_file(project: Project, yaml_filename: str, deployment_name: str, deploy_address: str): """Deploy crowdsale plan.""" chain_data = load_crowdsale_definitions(yaml_filename, deployment_name) chain_name = chain_data["chain"] address = deploy_address with project.get_chain(chain_name) as chain: web3 = chain.web3 print("Web3 provider is", web3.currentProvider) print("Owner address is", address) start_balance = from_wei(web3.eth.getBalance(address), "ether") print("Owner balance is", start_balance, "ETH") runtime_data, statistics, contracts = deploy_crowdsale( project, chain, chain_data, deploy_address) perform_post_actions(chain, runtime_data, contracts) perform_verify_actions(chain, runtime_data, contracts) write_deployment_report(yaml_filename, runtime_data) end_balance = from_wei(web3.eth.getBalance(address), "ether") print("Deployment cost is", start_balance - end_balance, "ETH") return runtime_data, statistics, contracts
def everything_deployed(project, chain, web3, accounts, deploy_address) -> dict: """Deploy our token plan.""" yaml_filename = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "..","crowdsales", "allocated-token-sale-acceptance-test.yml")) deployment_name = "testrpc" chain_data = load_crowdsale_definitions(yaml_filename, deployment_name) runtime_data, statistics, contracts = _deploy_contracts(project, chain, web3, yaml_filename, chain_data, deploy_address) return contracts
def deploy_crowdsale_from_file(project: Project, yaml_filename: str, deployment_name: str, deploy_address: str): """Deploy crowdsale plan.""" chain_data = load_crowdsale_definitions(yaml_filename, deployment_name) chain_name = chain_data["chain"] with project.get_chain(chain_name) as chain: web3 = chain.web3 return _deploy_contracts(project, chain, web3, yaml_filename, chain_data, deploy_address)
def everything_deployed(project, chain, web3, accounts, deploy_address): """Deploy our token plan.""" yaml_filename = os.path.join(os.path.dirname(__file__), "..", "crowdsales", "mysterium-testrpc.yml") deployment_name = "kovan" chain_data = load_crowdsale_definitions(yaml_filename, deployment_name) runtime_data, statistics, contracts = _deploy_contracts( project, chain, web3, yaml_filename, chain_data, deploy_address) return contracts
def test_deploy_crowdsale(project, chain, accounts, example_yaml_filename): """Deploy multiple contracts from a crowdsale definition file.""" chain_data = load_crowdsale_definitions(example_yaml_filename, "unit_test") # Not needed for testrpc chain_data["unlock_deploy_address"] = False runtime_data, statistics, contracts = deploy_crowdsale( project, chain, chain_data, accounts[7]) perform_post_actions(chain, runtime_data, contracts) perform_verify_actions(chain, runtime_data, contracts) write_deployment_report(example_yaml_filename, runtime_data)
def deploy_crowdsale_from_file(project: Project, yaml_filename: str, deployment_name: str, deploy_address: str): """Deploy crowdsale plan.""" if not yaml_filename.endswith(".yml"): # A stop gap fix # Otherwise our backup filename generator may get confused raise RuntimeError("YAML files must have .yml extension") chain_data = load_crowdsale_definitions(yaml_filename, deployment_name) chain_name = chain_data["chain"] with project.get_chain(chain_name) as chain: web3 = chain.web3 return _deploy_contracts(project, chain, web3, yaml_filename, chain_data, deploy_address)
def test_load_yaml(example_yaml_filename): """Load and expand YAML crowdsale defitions.""" defs = load_crowdsale_definitions(example_yaml_filename, "unit_test") pprint(defs)