88import deployment_utils as deploy_utils
99import yaml
1010from boa .network import NetworkEnv
11- from eth .codecs .abi .exceptions import DecodeError
1211from eth_account import Account
1312from eth_utils import keccak
1413from rich .console import Console as RichConsole
1716
1817
1918def check_contract_deployed (network , designation ):
20-
2119 with open ("./deployments.yaml" , "r" ) as file :
2220 deployments = yaml .safe_load (file )
2321
24- if (
25- network in deployments .keys ()
26- and designation in deployments [network ].keys ()
27- ):
22+ if network in deployments .keys () and designation in deployments [network ].keys ():
2823 return deployments [network ][designation ]
2924
3025
3126def store_deployed_contract (network , designation , deployment_address ):
32-
3327 with open ("./deployments.yaml" , "r" ) as file :
3428 deployments = yaml .safe_load (file )
3529
36- if not network in deployments .keys ():
30+ if network not in deployments .keys ():
3731 deployments [network ] = {}
3832
3933 deployments [network ][designation ] = deployment_address
@@ -52,10 +46,7 @@ def check_and_deploy(
5246 blueprint : bool = False ,
5347 upkeep_deploy_log : bool = False ,
5448):
55-
56- deployed_contract_address = check_contract_deployed (
57- network , contract_designation
58- )
49+ deployed_contract_address = check_contract_deployed (network , contract_designation )
5950 if deployed_contract_address :
6051 logger .log (f"Contract exists at { deployed_contract_address } ..." )
6152 return contract_obj .at (deployed_contract_address )
@@ -73,7 +64,7 @@ def check_and_deploy(
7364 salt ,
7465 create2deployer = create2deployer ,
7566 blueprint = blueprint ,
76- blueprint_preamble = b"\xFE \x71 \x00 " ,
67+ blueprint_preamble = b"\xfe \x71 \x00 " ,
7768 )
7869 # assert precomputed_address == calculated_address
7970
@@ -84,29 +75,21 @@ def check_and_deploy(
8475 )
8576 deployed_address = precomputed_address
8677
87- except :
88-
89- logger .log (
90- f"No create2deployer found for { network } . Deploying with CREATE."
91- )
78+ except : # noqa: E722
79+ logger .log (f"No create2deployer found for { network } . Deploying with CREATE." )
9280 if blueprint :
93- if not "zksync" in network :
81+ if "zksync" not in network :
9482 c = contract_obj .deploy_as_blueprint ()
9583 else :
9684 # we need special deployment code for zksync
9785 packed_precisions = 340282366920938463463374607431768211457
9886 packed_gamma_A = 136112946768375385385349842972852284582400000
99- packed_fee_params = (
100- 8847341539944400050877843276543133320576000000
101- )
102- packed_rebalancing_params = (
103- 6125082604576892342340742933771827806226
104- )
87+ packed_fee_params = 8847341539944400050877843276543133320576000000
88+ packed_rebalancing_params = 6125082604576892342340742933771827806226
10589 c = contract_obj .deploy_as_blueprint (
10690 "Blueprint" , # _name
10791 "_" , # _symbol
108- ["0x0000000000000000000000000000000000000000" ]
109- * 2 , # _coins
92+ ["0x0000000000000000000000000000000000000000" ] * 2 , # _coins
11093 "0x0000000000000000000000000000000000000000" , # _math
11194 b"\1 " * 32 , # _salt
11295 packed_precisions ,
@@ -123,15 +106,12 @@ def check_and_deploy(
123106 logger .log (f"Deployed! At: { deployed_address } ." )
124107
125108 if upkeep_deploy_log :
126- store_deployed_contract (
127- network , contract_designation , str (deployed_address )
128- )
109+ store_deployed_contract (network , contract_designation , str (deployed_address ))
129110
130111 return contract_obj .at (deployed_address )
131112
132113
133114def deploy_infra (network , url , account , fork = False ):
134-
135115 logger .log (f"Deploying on { network } ..." )
136116 contract_folder = "main"
137117
@@ -147,7 +127,6 @@ def deploy_infra(network, url, account, fork=False):
147127 boa .env .set_eoa (Account .from_key (os .environ [account ]))
148128
149129 else :
150-
151130 if fork :
152131 boa .env .fork (url )
153132 logger .log ("Forkmode ..." )
@@ -162,7 +141,6 @@ def deploy_infra(network, url, account, fork=False):
162141 )
163142
164143 for _network , data in deploy_utils .curve_dao_network_settings .items ():
165-
166144 if _network in network :
167145 fee_receiver = data .fee_receiver_address
168146
@@ -176,9 +154,7 @@ def deploy_infra(network, url, account, fork=False):
176154 views_contract_obj = boa .load_partial (
177155 f"./contracts/{ contract_folder } /CurveCryptoViews2Optimized.vy"
178156 )
179- amm_contract_obj = boa .load_partial (
180- f"./contracts/{ contract_folder } /CurveTwocryptoOptimized.vy"
181- )
157+ amm_contract_obj = boa .load_partial (f"./contracts/{ contract_folder } /CurveTwocryptoOptimized.vy" )
182158 factory_contract_obj = boa .load_partial (
183159 f"./contracts/{ contract_folder } /CurveTwocryptoFactory.vy"
184160 )
@@ -251,7 +227,6 @@ def deploy_infra(network, url, account, fork=False):
251227
252228
253229def main ():
254-
255230 forkmode = False
256231 deployer = "FIDDYDEPLOYER"
257232 network = "zksync:mainnet"
0 commit comments