Skip to content

Commit

Permalink
zksync deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Jul 4, 2024
1 parent 74e4d5c commit 2f70312
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 89 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ bvenv/
.hypothesis/
.gz
.json.gz
era_test_node.log
5 changes: 5 additions & 0 deletions deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@ polygon:
StableswapFactoryNGHandler: '0x9d3975070768580f755D405527862ee126d0eA08'
TricryptoFactoryNGHandler: '0xf46D25696677898454dfDd644830C821243A1188'
TwocryptoFactoryNGHandler: '0xb00e89eabd59cd3254c88e390103cf17e914f678'
zksync:
Metaregistry: '0x48e4b27553e7643E10229ea3cba91c188dc524B1'
StableswapFactoryNGHandler: '0x4Cabf81fbf1F42531d55507F38Be77367481a8dF'
TricryptoFactoryNGHandler: '0xf3f38b1677553789A048FFf4A2CeedCDf063309e'
TwocryptoFactoryNGHandler: '0x0F3d82D719582BcaB662F434D77B089C86D05FAb'
58 changes: 39 additions & 19 deletions scripts/add_new_id_addressprovider.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,41 @@
)

FIDDY_DEPLOYER = "0x2d12D0907A388811e3AA855A550F959501d303EE"
ADDRESS_PROVIDER = "0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98"
ADDRESS_PROVIDER = (
"0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98" # gets replaced for zksync
)


def fetch_url(network):
return os.getenv("DRPC_URL") % (network, os.getenv("DRPC_KEY"))


def main(network, fork):
def main(network, fork, url):
"""
Deploy the AddressProvider to the network.
"""

console = RichConsole()
if network == "fraxtal":
network_url = "https://rpc.frax.com"
elif network == "kava":
network_url = "https://rpc.ankr.com/kava_evm"
else:
network_url = fetch_url(network)

if not fork:
# Prodmode
console.log("Running script in prod mode...")
boa.set_env(NetworkEnv(network_url))
boa.env.add_account(Account.from_key(os.environ["FIDDYDEPLOYER"]))
if network == "zksync":
if not fork:
boa_zksync.set_zksync_env(url)
console.log("Prodmode on zksync Era ...")
else:
boa_zksync.set_zksync_fork(url)
console.log("Forkmode on zksync Era ...")

boa.env.set_eoa(Account.from_key(os.environ["FIDDYDEPLOYER"]))

else:
# Forkmode
console.log("Simulation Mode. Writing to mainnet-fork.")
boa.env.fork(url=network_url)
boa.env.eoa = FIDDY_DEPLOYER
if fork:
boa.env.fork(url)
console.log("Forkmode ...")
boa.env.eoa = FIDDY_DEPLOYER # set eoa address here
else:
console.log("Prodmode ...")
boa.set_env(NetworkEnv(url))
boa.env.add_account(Account.from_key(os.environ["FIDDYDEPLOYER"]))

address_provider_obj = boa.load_partial("contracts/AddressProviderNG.vy")
address_provider = address_provider_obj.at(ADDRESS_PROVIDER)
Expand All @@ -61,6 +65,9 @@ def main(network, fork):
description = ADDRESS_PROVIDER_MAPPING[id]
existing_id = address_provider.get_id_info(id)

if not address:
continue

if (
existing_id[0].lower()
== "0x0000000000000000000000000000000000000000"
Expand All @@ -85,7 +92,20 @@ def main(network, fork):


if __name__ == "__main__":
network = "mantle"
network = "zksync"
url = ""
fork = False

main(network, fork)
if network == "zksync":
import boa_zksync

url = "https://mainnet.era.zksync.io"
ADDRESS_PROVIDER = "0x54A5a69e17Aa6eB89d77aa3828E38C9Eb4fF263D"
elif network == "fraxtal":
network_url = "https://rpc.frax.com"
elif network == "kava":
network_url = "https://rpc.ankr.com/kava_evm"
else:
network_url = fetch_url(network)

main(network, fork, url)
10 changes: 4 additions & 6 deletions scripts/address_provider_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,19 +307,17 @@
13: "0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F",
},
"zksync": {
2: "", # 2: "Exchange Router",
4: "", # 4: "Fee Distributor",
2: "0x7C915390e109CA66934f1eB285854375D1B127FA", # 2: "Exchange Router",
4: "0xCb8799BFF48bb549F7B69Bb9BE60DbA7cd4F1BB7", # 4: "Fee Distributor",
11: "0x5044112fDf6c8DCc788a669c17345cfDB06549fa", # 11: "TricryptoNG Factory",
12: "0x375444aeDEb6C3db897f293E1DBa85D7422A6859", # 12: "StableswapNG Factory",
13: "0x24992A09E2257AF325102Cefa1F09E80E9062d49", # 13: "TwocryptoNG Factory",
14: "", # 14: "Stableswap Calculations Contract",
15: "", # 15: "Cryptoswap calculations Contract",
19: "", # 19: "CRV Token",
19: "0x5945932099f124194452a4c62d34bB37f16183B2", # 19: "CRV Token",
20: "", # 20: "Gauge Factory",
21: "", # 21: "Ownership Admin",
22: "", # 22: "Parameter Admin",
23: "", # 23: "Emergency Admin",
24: "", # 24: "CurveDAO Vault", # Holds funds
25: "", # 25: "crvUSD Token"
25: "0x43cD37CC4B9EC54833c8aC362Dd55E58bFd62b86", # 25: "crvUSD Token"
},
}
Loading

0 comments on commit 2f70312

Please sign in to comment.