Skip to content

Commit fbf5507

Browse files
chore: make linter happy
1 parent 205ec21 commit fbf5507

46 files changed

Lines changed: 176 additions & 2203 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scripts/deploy_implementation_and_update.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def fetch_url(network):
2121

2222

2323
def deploy(network, url, account, fork=False):
24-
2524
logger.log(f"Deploying on {network} ...")
2625

2726
if not url:
@@ -47,12 +46,8 @@ def deploy(network, url, account, fork=False):
4746
deployments[network]["factory"]
4847
)
4948

50-
math_contract_obj = boa.load_partial(
51-
"./contracts/main/CurveCryptoMathOptimized2.vy"
52-
)
53-
amm_contract_obj = boa.load_partial(
54-
"./contracts/main/CurveTwocryptoOptimized.vy"
55-
)
49+
math_contract_obj = boa.load_partial("./contracts/main/CurveCryptoMathOptimized2.vy")
50+
amm_contract_obj = boa.load_partial("./contracts/main/CurveTwocryptoOptimized.vy")
5651

5752
math_contract = check_and_deploy(
5853
contract_obj=math_contract_obj,
@@ -74,7 +69,6 @@ def deploy(network, url, account, fork=False):
7469
)
7570

7671
if boa.env.eoa == factory.admin():
77-
7872
# update implementation here
7973
if not factory.pool_implementations(0) == amm_blueprint.address:
8074
logger.log("Setting AMM implementation ...")
@@ -87,12 +81,10 @@ def deploy(network, url, account, fork=False):
8781
logger.log("Done!")
8882

8983
else:
90-
9184
logger.log(f"Could not update implementation for factory on {network}")
9285

9386

9487
def main():
95-
9688
forkmode = False
9789
deploy(
9890
network="",

scripts/deploy_infra.py

Lines changed: 12 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import deployment_utils as deploy_utils
99
import yaml
1010
from boa.network import NetworkEnv
11-
from eth.codecs.abi.exceptions import DecodeError
1211
from eth_account import Account
1312
from eth_utils import keccak
1413
from rich.console import Console as RichConsole
@@ -17,23 +16,18 @@
1716

1817

1918
def 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

3126
def 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

133114
def 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

253229
def main():
254-
255230
forkmode = False
256231
deployer = "FIDDYDEPLOYER"
257232
network = "zksync:mainnet"

scripts/deployment_utils.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def get_create2_deployment_address(
137137
salt,
138138
create2deployer,
139139
blueprint=False,
140-
blueprint_preamble=b"\xFE\x71\x00",
140+
blueprint_preamble=b"\xfe\x71\x00",
141141
):
142142
deployment_bytecode = compiled_bytecode + abi_encoded_ctor
143143
if blueprint:
@@ -146,10 +146,7 @@ def get_create2_deployment_address(
146146
# Add code for blueprint deployment:
147147
len_blueprint_bytecode = len(blueprint_bytecode).to_bytes(2, "big")
148148
deployment_bytecode = (
149-
b"\x61"
150-
+ len_blueprint_bytecode
151-
+ b"\x3d\x81\x60\x0a\x3d\x39\xf3"
152-
+ blueprint_bytecode
149+
b"\x61" + len_blueprint_bytecode + b"\x3d\x81\x60\x0a\x3d\x39\xf3" + blueprint_bytecode
153150
)
154151

155152
return (

0 commit comments

Comments
 (0)