From d612fdea4eb1a04a9360b22c21ed468c113ba06d Mon Sep 17 00:00:00 2001 From: bout3fiddy <11488427+bout3fiddy@users.noreply.github.com> Date: Tue, 26 Dec 2023 10:04:31 +0530 Subject: [PATCH] deployed infra --- deployments.yaml | 84 ++++++++++++++++++++++++++++++++++++++--- scripts/deploy_infra.py | 78 +++++++++++++++++++++++++------------- 2 files changed, 130 insertions(+), 32 deletions(-) diff --git a/deployments.yaml b/deployments.yaml index f8fcf9ca..1af844ae 100644 --- a/deployments.yaml +++ b/deployments.yaml @@ -1,7 +1,81 @@ +arbitrum:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: 0x2005995a71243be9FB995DaB4742327dc76564Df. + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +aurora:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +avax:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +base:mainnet: + amm: '0x1A83348F9cCFD3Fe1A8C0adBa580Ac4e267Fe495' + factory: '0xc9Fe0C63Af9A39402e8a5514f9c43Af0322b665F' + math: '0x64379C265Fc6595065D7d835AAaa731c0584dB80' + views: '0xd3B17f862956464ae4403cCF829CE69199856e1e' +bsc:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +celo:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' ethereum:mainnet: - gauge: "0x38D9BdA812da2C68dFC6aDE85A7F7a54E77F8325" + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + gauge: '0x38D9BdA812da2C68dFC6aDE85A7F7a54E77F8325' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +ethereum:sepolia: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +ftm:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' gnosis:mainnet: - amm: "0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223" - factory: "0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F" - math: "0x2005995a71243be9FB995DaB4742327dc76564Df" - views: "0x07CdEBF81977E111B08C126DEFA07818d0045b80" + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +kava:mainnet: + amm: '0x64379C265Fc6595065D7d835AAaa731c0584dB80' + factory: '0xd3B17f862956464ae4403cCF829CE69199856e1e' + math: '0x7Ca46A636b02D4aBC66883D7FF164bDE506DC66a' + views: '0x0C9D8c7e486e822C29488Ff51BFf0167B4650953' +mantle:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +optimism:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +polygon:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +pzkevm:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' +scroll:mainnet: + amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223' + factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F' + math: '0x2005995a71243be9FB995DaB4742327dc76564Df' + views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80' diff --git a/scripts/deploy_infra.py b/scripts/deploy_infra.py index d3d83609..dc522a20 100644 --- a/scripts/deploy_infra.py +++ b/scripts/deploy_infra.py @@ -7,6 +7,7 @@ import deployment_utils as deploy_utils import yaml from boa.network import NetworkEnv +from eth.codecs.abi.exceptions import DecodeError from eth_account import Account from eth_utils import keccak from rich.console import Console as RichConsole @@ -17,10 +18,13 @@ def check_contract_deployed(network, designation): with open("./deployments.yaml", "r") as file: - deployments = yaml.safe_load(file)[network] + deployments = yaml.safe_load(file) - if designation in deployments.keys(): - return deployments[designation] + if ( + network in deployments.keys() + and designation in deployments[network].keys() + ): + return deployments[network][designation] def store_deployed_contract(network, designation, deployment_address): @@ -28,6 +32,9 @@ def store_deployed_contract(network, designation, deployment_address): with open("./deployments.yaml", "r") as file: deployments = yaml.safe_load(file) + if not network in deployments.keys(): + deployments[network] = {} + deployments[network][designation] = deployment_address with open("./deployments.yaml", "w") as file: @@ -49,37 +56,54 @@ def check_and_deploy( network, contract_designation ) if deployed_contract_address: - logger.log(f"Contract exists at {calculated_address} ...") - return contract_obj.at(calculated_address) + logger.log(f"Contract exists at {deployed_contract_address} ...") + return contract_obj.at(deployed_contract_address) logger.log(f"Deploying {contract_designation} contract ...") salt = keccak(42069) compiled_bytecode = contract_obj.compiler_data.bytecode - ( - precomputed_address, - deployment_bytecode, - ) = deploy_utils.get_create2_deployment_address( - compiled_bytecode, - abi_encoded_args, - salt, - create2deployer=create2deployer, - blueprint=blueprint, - blueprint_preamble=b"\xFE\x71\x00", - ) - assert precomputed_address == calculated_address - deploy_utils.deploy_via_create2_factory( - deployment_bytecode, - salt, - create2deployer=create2deployer, - ) - logger.log(f"Deployed! At: {precomputed_address}.") + try: + ( + precomputed_address, + deployment_bytecode, + ) = deploy_utils.get_create2_deployment_address( + compiled_bytecode, + abi_encoded_args, + salt, + create2deployer=create2deployer, + blueprint=blueprint, + blueprint_preamble=b"\xFE\x71\x00", + ) + assert precomputed_address == calculated_address + + deploy_utils.deploy_via_create2_factory( + deployment_bytecode, + salt, + create2deployer=create2deployer, + ) + deployed_address = precomputed_address + + except DecodeError: + + logger.log( + f"No create2deployer found for {network}. Deploying with CREATE." + ) + if blueprint: + c = contract_obj.deploy_as_blueprint() + else: + c = contract_obj.deploy() + + deployed_address = c.address + + logger.log(f"Deployed! At: {deployed_address}.") + if upkeep_deploy_log: store_deployed_contract( - network, contract_designation, calculated_address + network, contract_designation, str(deployed_address) ) - return contract_obj.at(calculated_address) + return contract_obj.at(deployed_address) def deploy_infra(network, url, account, fork=False): @@ -192,8 +216,8 @@ def main(): forkmode = False deploy_infra( - "gnosis:mainnet", - os.environ["RPC_GNOSIS"], + "ethereum:sepolia", + os.environ["RPC_ETHEREUM_SEPOLIA"], "FIDDYDEPLOYER", fork=forkmode, )