def deploy_public_court(): print("Deployment Initiated. \n") compiled = attempt(compile_contracts, [SOLIDITY_SOURCES], "Compiling contracts...") court_abi = compiled['PublicCourt']['abi'] havven_contract, havven_txr = attempt_deploy(compiled, 'PublicHavven', MASTER, [MASTER]) nomin_contract, nomin_txr = attempt_deploy( compiled, 'EtherNomin', MASTER, [havven_contract.address, MASTER, MASTER, 1000 * UNIT, MASTER]) court_contract, court_txr = attempt_deploy( compiled, 'PublicCourt', MASTER, [havven_contract.address, nomin_contract.address, MASTER]) txs = [ havven_contract.functions.setNomin(nomin_contract.address).transact( {'from': MASTER}), nomin_contract.functions.setCourt(court_contract.address).transact( {'from': MASTER}) ] attempt(mine_txs, [txs], "Linking contracts... ") print("\nDeployment complete.\n") return havven_contract, nomin_contract, court_contract, court_abi
def deploy_public_contracts(): print("Deployment initiated.\n") compiled = attempt(compile_contracts, [SOLIDITY_SOURCES], "Compiling contracts... ") # Deploy contracts havven_contract, hvn_txr = attempt_deploy(compiled, 'PublicHavven', MASTER, [MASTER]) nomin_contract, nom_txr = attempt_deploy( compiled, 'PublicEtherNomin', MASTER, [havven_contract.address, MASTER, MASTER, 1000 * UNIT, MASTER]) court_contract, court_txr = attempt_deploy( compiled, 'FakeCourt', MASTER, [havven_contract.address, nomin_contract.address, MASTER]) # Hook up each of those contracts to each other txs = [ havven_contract.functions.setNomin(nomin_contract.address).transact( {'from': MASTER}), nomin_contract.functions.setCourt(court_contract.address).transact( {'from': MASTER}) ] attempt(mine_txs, [txs], "Linking contracts... ") print("\nDeployment complete.\n") return havven_contract, nomin_contract, court_contract
def deploy_public_havven(): print("Deployment initiated.\n") compiled = attempt(compile_contracts, [SOLIDITY_SOURCES], "Compiling contracts... ") # Deploy contracts havven_contract, hvn_txr = attempt_deploy(compiled, 'PublicHavven', MASTER, [MASTER]) hvn_block = W3.eth.blockNumber nomin_contract, nom_txr = attempt_deploy( compiled, 'EtherNomin', MASTER, [havven_contract.address, MASTER, MASTER, 1000 * UNIT, MASTER]) court_contract, court_txr = attempt_deploy( compiled, 'Court', MASTER, [havven_contract.address, nomin_contract.address, MASTER]) escrow_contract, escrow_txr = attempt_deploy( compiled, 'HavvenEscrow', MASTER, [MASTER, havven_contract.address, nomin_contract.address]) # Hook up each of those contracts to each other txs = [ havven_contract.functions.setNomin(nomin_contract.address).transact( {'from': MASTER}), nomin_contract.functions.setCourt(court_contract.address).transact( {'from': MASTER}) ] attempt(mine_txs, [txs], "Linking contracts... ") havven_event_dict = generate_topic_event_map( compiled['PublicHavven']['abi']) print("\nDeployment complete.\n") return havven_contract, nomin_contract, court_contract, escrow_contract, hvn_block, havven_event_dict
def deploy_public_havven(): print("Deployment initiated.\n") compiled = attempt(compile_contracts, [SOLIDITY_SOURCES], "Compiling contracts... ") # Deploy contracts havven_contract, hvn_txr = attempt_deploy(compiled, 'PublicHavven', MASTER, [ZERO_ADDRESS, MASTER]) hvn_block = W3.eth.blockNumber nomin_contract, nom_txr = attempt_deploy(compiled, 'EtherNomin', MASTER, [ havven_contract.address, MASTER, MASTER, 1000 * UNIT, MASTER, ZERO_ADDRESS ]) court_contract, court_txr = attempt_deploy( compiled, 'Court', MASTER, [havven_contract.address, nomin_contract.address, MASTER]) escrow_contract, escrow_txr = attempt_deploy( compiled, 'PublicHavvenEscrow', MASTER, [MASTER, havven_contract.address]) # Install proxies havven_proxy, _ = attempt_deploy(compiled, 'Proxy', MASTER, [havven_contract.address, MASTER]) mine_tx( havven_contract.functions.setProxy(havven_proxy.address).transact( {'from': MASTER})) proxy_havven = W3.eth.contract(address=havven_proxy.address, abi=compiled['PublicHavven']['abi']) nomin_proxy, _ = attempt_deploy(compiled, 'Proxy', MASTER, [nomin_contract.address, MASTER]) mine_tx( nomin_contract.functions.setProxy(nomin_proxy.address).transact( {'from': MASTER})) proxy_nomin = W3.eth.contract(address=nomin_proxy.address, abi=compiled['EtherNomin']['abi']) # Hook up each of those contracts to each other txs = [ proxy_havven.functions.setNomin(nomin_contract.address).transact( {'from': MASTER}), proxy_nomin.functions.setCourt(court_contract.address).transact( {'from': MASTER}), proxy_havven.functions.setEscrow(escrow_contract.address).transact( {'from': MASTER}) ] attempt(mine_txs, [txs], "Linking contracts... ") escrow_event_dict = generate_topic_event_map( compiled['HavvenEscrow']['abi']) print("\nDeployment complete.\n") return proxy_havven, proxy_nomin, havven_proxy, nomin_proxy, havven_contract, nomin_contract, court_contract, escrow_contract, hvn_block, escrow_event_dict
def compileAndMapEvents(cls, source_paths, remappings=None): if remappings is None: remappings = [] compiled = attempt(compile_contracts, [source_paths], "Compiling contracts...", func_kwargs={'remappings': remappings}) event_maps = { name: generate_topic_event_map(compiled[name]['abi']) for name in compiled } return compiled, event_maps
def deploy_havven(print_addresses=False): print("Deployment initiated.\n") compiled = attempt(compile_contracts, [SOLIDITY_SOURCES], "Compiling contracts... ") # Deploy contracts havven_contract, hvn_txr = attempt_deploy(compiled, 'Havven', MASTER, [ZERO_ADDRESS, OWNER]) nomin_contract, nom_txr = attempt_deploy(compiled, 'EtherNomin', MASTER, [ havven_contract.address, ORACLE, LIQUIDATION_BENEFICIARY, INITIAL_ETH_PRICE, OWNER, ZERO_ADDRESS ]) court_contract, court_txr = attempt_deploy( compiled, 'Court', MASTER, [havven_contract.address, nomin_contract.address, OWNER]) escrow_contract, escrow_txr = attempt_deploy( compiled, 'HavvenEscrow', MASTER, [OWNER, havven_contract.address]) # Wrap contracts with proxies havven_proxy, _ = attempt_deploy(compiled, 'Proxy', MASTER, [havven_contract.address, MASTER]) nomin_proxy, _ = attempt_deploy(compiled, 'Proxy', MASTER, [nomin_contract.address, MASTER]) txs = [ havven_contract.functions.setProxy(havven_proxy.address).transact( {'from': MASTER}), nomin_contract.functions.setProxy(nomin_proxy.address).transact( {'from': MASTER}) ] attempt(mine_txs, [txs], "Deploying Proxies...") proxy_havven = W3.eth.contract(address=havven_proxy.address, abi=compiled['Havven']['abi']) proxy_nomin = W3.eth.contract(address=nomin_proxy.address, abi=compiled['EtherNomin']['abi']) # Hook up each of those contracts to each other txs = [ havven_contract.functions.setNomin(nomin_contract.address).transact( {'from': MASTER}), havven_contract.functions.setEscrow(escrow_contract.address).transact( {'from': MASTER}), nomin_contract.functions.setCourt(court_contract.address).transact( {'from': MASTER}) ] attempt(mine_txs, [txs], "Linking contracts... ") print("\nDeployment complete.\n") if print_addresses: print("Addresses") print("========\n") print(f"Havven: {havven_contract.address}") print(f"Havven Proxy: {havven_proxy.address}") print(f"Nomin: {nomin_contract.address}") print(f"Nomin Proxy: {nomin_proxy.address}") print(f"Court: {court_contract.address}") print(f"Escrow: {escrow_contract.address}") print() return havven_contract, nomin_contract, havven_proxy, nomin_proxy, court_contract, escrow_contract, hvn_txr, nom_txr, court_txr