Skip to content

Commit

Permalink
deployed infra
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Dec 26, 2023
1 parent 941925b commit d612fde
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 32 deletions.
84 changes: 79 additions & 5 deletions deployments.yaml
Original file line number Diff line number Diff line change
@@ -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'
78 changes: 51 additions & 27 deletions scripts/deploy_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -17,17 +18,23 @@
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):

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:
Expand All @@ -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):
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit d612fde

Please sign in to comment.