From daab6a67a0a4b884e0b1d79aa2adeb3dcbf64c8f Mon Sep 17 00:00:00 2001 From: bout3fiddy <11488427+bout3fiddy@users.noreply.github.com> Date: Thu, 30 May 2024 10:43:33 +0200 Subject: [PATCH 1/4] deploy to zksync --- contracts/AddressProviderNG.vy | 4 ++-- requirements.in | 1 + ...deploy_addressprovider_and_setup_zksync.py | 22 +++++++++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 scripts/deploy_addressprovider_and_setup_zksync.py diff --git a/contracts/AddressProviderNG.vy b/contracts/AddressProviderNG.vy index 06b1eff..9b7f2f9 100644 --- a/contracts/AddressProviderNG.vy +++ b/contracts/AddressProviderNG.vy @@ -81,7 +81,7 @@ def __init__(): def ids() -> DynArray[uint256, 1000]: """ @notice returns IDs of active registry items in the AddressProvider. - @returns An array of IDs. + @return An array of IDs. """ _ids: DynArray[uint256, 1000] = [] for _id in self._ids: @@ -280,7 +280,7 @@ def remove_id(_id: uint256) -> bool: def remove_ids(_ids: DynArray[uint256, 20]) -> bool: """ @notice Unset existing identifiers - @param _id DynArray of identifier to unset + @param _ids DynArray of identifier to unset @return bool success """ assert msg.sender == self.admin # dev: admin-only function diff --git a/requirements.in b/requirements.in index 3267103..e26d9ba 100644 --- a/requirements.in +++ b/requirements.in @@ -1,4 +1,5 @@ titanoboa[forking-recommended] @ git+https://github.com/vyperlang/titanoboa@05ec84ad1decfe23cd4a3ffc588d567fd322a509 +git+https://github.com/DanielSchiavini/titanoboa-zksync.git black flake8 isort diff --git a/scripts/deploy_addressprovider_and_setup_zksync.py b/scripts/deploy_addressprovider_and_setup_zksync.py new file mode 100644 index 0000000..b3841d0 --- /dev/null +++ b/scripts/deploy_addressprovider_and_setup_zksync.py @@ -0,0 +1,22 @@ +# AddressProvider deployed on zksync at: 0x54A5a69e17Aa6eB89d77aa3828E38C9Eb4fF263D + +import os + +import boa +import boa_zksync +from eth_account import Account + +zksync_rpc = "https://mainnet.era.zksync.io" + +boa_zksync.set_zksync_env(zksync_rpc) + + +def main(): + boa.env.add_account( + Account.from_key(os.environ["FIDDYDEPLOYER"]), force_eoa=True + ) + boa.load("contracts/AddressProviderNG.vy") + + +if __name__ == "__main__": + main() From 994c75cb8f91107ea7336babb381a738f5c410ae Mon Sep 17 00:00:00 2001 From: bout3fiddy <11488427+bout3fiddy@users.noreply.github.com> Date: Thu, 30 May 2024 10:54:12 +0200 Subject: [PATCH 2/4] update titanoboa-zksync package --- requirements.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.in b/requirements.in index e26d9ba..0522e83 100644 --- a/requirements.in +++ b/requirements.in @@ -1,5 +1,5 @@ titanoboa[forking-recommended] @ git+https://github.com/vyperlang/titanoboa@05ec84ad1decfe23cd4a3ffc588d567fd322a509 -git+https://github.com/DanielSchiavini/titanoboa-zksync.git +git+https://github.com/DanielSchiavini/titanoboa-zksync.git@0121e1f9a59b47f015cef55574b6084599144f20 black flake8 isort From 74e4d5c82d9aa8a4cd57a52213a457755b309f9a Mon Sep 17 00:00:00 2001 From: bout3fiddy <11488427+bout3fiddy@users.noreply.github.com> Date: Tue, 25 Jun 2024 20:19:54 +0200 Subject: [PATCH 3/4] deploy legacy metaregistries and integrate --- contracts/registries/BasePoolRegistry.vy | 12 +- contracts/registries/CryptoRegistryV1.vy | 3 +- .../registry_handlers/CryptoFactoryHandler.vy | 3 +- .../CryptoRegistryHandler.vy | 3 +- .../registry_handlers/StableFactoryHandler.vy | 3 +- .../StableRegistryHandler.vy | 3 +- deployments.yaml | 73 +++++ scripts/address_provider_constants.py | 16 ++ scripts/deploy_metaregistry_sidechain_l2s.py | 128 --------- scripts/deploy_metaregistryl2.py | 265 ++++++++++++++++++ scripts/legacy_base_pools.py | 125 +++++++++ scripts/utils/__init__.py | 3 +- 12 files changed, 500 insertions(+), 137 deletions(-) create mode 100644 deployments.yaml delete mode 100644 scripts/deploy_metaregistry_sidechain_l2s.py create mode 100644 scripts/deploy_metaregistryl2.py create mode 100644 scripts/legacy_base_pools.py diff --git a/contracts/registries/BasePoolRegistry.vy b/contracts/registries/BasePoolRegistry.vy index f600dda..9dcd2c7 100644 --- a/contracts/registries/BasePoolRegistry.vy +++ b/contracts/registries/BasePoolRegistry.vy @@ -1,4 +1,5 @@ -#pragma version ^0.3.7 +# pragma version 0.3.10 +# pragma evm-version paris """ @title Curve BasePool Registry @license MIT @@ -222,7 +223,14 @@ def is_lending(_pool: address) -> bool: @external -def add_base_pool(_pool: address, _lp_token: address, _n_coins: uint256, _is_legacy: bool, _is_lending: bool, _is_v2: bool): +def add_base_pool( + _pool: address, + _lp_token: address, + _n_coins: uint256, + _is_legacy: bool, + _is_lending: bool, + _is_v2: bool +): """ @notice Add a base pool to the registry @param _pool Address of the base pool diff --git a/contracts/registries/CryptoRegistryV1.vy b/contracts/registries/CryptoRegistryV1.vy index ef1690a..bd0e20c 100644 --- a/contracts/registries/CryptoRegistryV1.vy +++ b/contracts/registries/CryptoRegistryV1.vy @@ -1,4 +1,5 @@ -#pragma version ^0.3.7 +# pragma version 0.3.10 +# pragma evm-version paris """ @title Curve CryptoSwap Registry @license MIT diff --git a/contracts/registry_handlers/CryptoFactoryHandler.vy b/contracts/registry_handlers/CryptoFactoryHandler.vy index cb45cf6..408ec2f 100644 --- a/contracts/registry_handlers/CryptoFactoryHandler.vy +++ b/contracts/registry_handlers/CryptoFactoryHandler.vy @@ -1,4 +1,5 @@ -#pragma version ^0.3.7 +# pragma version 0.3.10 +# pragma evm-version paris """ @title Curve Registry Handler for v2 Factory @license MIT diff --git a/contracts/registry_handlers/CryptoRegistryHandler.vy b/contracts/registry_handlers/CryptoRegistryHandler.vy index a008331..2cbc003 100644 --- a/contracts/registry_handlers/CryptoRegistryHandler.vy +++ b/contracts/registry_handlers/CryptoRegistryHandler.vy @@ -1,4 +1,5 @@ -#pragma version ^0.3.7 +# pragma version 0.3.10 +# pragma evm-version paris """ @title Curve Registry Handler for v2 Crypto Registry @license MIT diff --git a/contracts/registry_handlers/StableFactoryHandler.vy b/contracts/registry_handlers/StableFactoryHandler.vy index ddd5a2e..e944ffd 100644 --- a/contracts/registry_handlers/StableFactoryHandler.vy +++ b/contracts/registry_handlers/StableFactoryHandler.vy @@ -1,4 +1,5 @@ -#pragma version ^0.3.7 +# pragma version 0.3.10 +# pragma evm-version paris """ @title Curve Registry Handler for v1 Factory (latest) @license MIT diff --git a/contracts/registry_handlers/StableRegistryHandler.vy b/contracts/registry_handlers/StableRegistryHandler.vy index 80c0ad8..6f219b2 100644 --- a/contracts/registry_handlers/StableRegistryHandler.vy +++ b/contracts/registry_handlers/StableRegistryHandler.vy @@ -1,4 +1,5 @@ -#pragma version ^0.3.7 +# pragma version 0.3.10 +# pragma evm-version paris """ @title Curve Registry Handler for v1 Registry @license MIT diff --git a/deployments.yaml b/deployments.yaml new file mode 100644 index 0000000..29a8edd --- /dev/null +++ b/deployments.yaml @@ -0,0 +1,73 @@ +arbitrum: + BasePoolRegistry: '0x1b0882f15efD4FF36C3E23C887518080ECe28B2B' + CryptoRegistryHandler: '0x4bf079cAC8AA62253978f6382aeBB73feDDAeD35' + Metaregistry: '0x13526206545e2DC7CcfBaF28dC88F440ce7AD3e0' + StableFactoryHandler: '0x39FFd8A06E80c12AC9151c57b72E709b0d735B9f' + StableRegistryHandler: '0x04A59aaD6b7EE48e6A4F7978cABB52CaedCCE4b2' + StableswapFactoryNGHandler: '0xdfdD8365e8D5823836427cFd8d54Dd390181477C' + TricryptoFactoryNGHandler: '0xb29841F457B102ce42b40eB8E602AEbc2fE6C2a2' + TwocryptoFactoryNGHandler: '0xBC397375a6Ae7A397010860f5a4b9fE65A3d6843' +aurora: + BasePoolRegistry: '0xe548590f9fAe7a23EA6501b144B0D58b74Fc4B53' + Metaregistry: '0xFf02cBD91F57A778Bab7218DA562594a680B8B61' + StableRegistryHandler: '0xA54f3c1DFa5f7DbF2564829d14b3B74a65d26Ae2' + StableswapFactoryNGHandler: '0xf2eff2Cd0d9C82b7b2f17FbBed703fA7931dB1da' + TricryptoFactoryNGHandler: '0xb47988aD49DCE8D909c6f9Cf7B26caF04e1445c8' + TwocryptoFactoryNGHandler: '0x64AFA95e0C3D8410240a4262df9Fd82B12b64eDd' +avalanche: + BasePoolRegistry: '0xb47988aD49DCE8D909c6f9Cf7B26caF04e1445c8' + Metaregistry: '0xB6845b562F01eB02ef20CBB63553d2a768e5a1Cb' + StableFactoryHandler: '0x33e72383472f77B0C6d8F791D1613C75aE2C5915' + StableRegistryHandler: '0x64AFA95e0C3D8410240a4262df9Fd82B12b64eDd' +base: + BasePoolRegistry: '0xB6845b562F01eB02ef20CBB63553d2a768e5a1Cb' + CryptoFactoryHandler: '0x64AFA95e0C3D8410240a4262df9Fd82B12b64eDd' + StableFactoryHandler: '0xf2eff2Cd0d9C82b7b2f17FbBed703fA7931dB1da' +bsc: + BasePoolRegistry: '0x64891ab20392A029c0f231656ff13C5ee64b730C' + CryptoFactoryHandler: '0xA04511C09E493eD36895b665d43d452aBB042579' + StableFactoryHandler: '0x8A00365Ae28D75B92ec695D5a041b744f140438D' +celo: + BasePoolRegistry: '0xB6845b562F01eB02ef20CBB63553d2a768e5a1Cb' + StableFactoryHandler: '0xf2eff2Cd0d9C82b7b2f17FbBed703fA7931dB1da' +fantom: + BasePoolRegistry: '0xA04511C09E493eD36895b665d43d452aBB042579' + CryptoRegistryHandler: '0xc65CB3156225380BEda366610BaB18D5835A1647' + Metaregistry: '0x803de445F0C272Bb6a036495F531a828D538Ab9A' + StableFactoryHandler: '0x452b9481fe83deadAf9f35226Cf79a53B26032da' + StableRegistryHandler: '0xfb37b8D939FFa77114005e61CFc2e543d6F49A81' + StableswapFactoryNGHandler: '0xf46D25696677898454dfDd644830C821243A1188' + TricryptoFactoryNGHandler: '0x08390C76DFDaB74249754C8e71cC2747351bd388' + TwocryptoFactoryNGHandler: '0x9d3975070768580f755D405527862ee126d0eA08' +gnosis: + BasePoolRegistry: '0x3f4a2bffa78d50cd61401a440526378e2155a8ae' + CryptoRegistryHandler: '0x550574e33b81c45d3d69250b46ae30c7bc40d330' + Metaregistry: '0xb6265659d7e9FEccB59e076e949Da556FC5E1429' + StableFactoryHandler: '0xF493Cd722951346E646eE666f0525e7cDcde9c03' + StableRegistryHandler: '0x6DCD097C0639ebF7dD932808C6965E43638AE6D2' + StableswapFactoryNGHandler: '0x4b00E8c997AeBACeEf6B8c6F89eE2bf99b2CA846' + TricryptoFactoryNGHandler: '0xc9621394A73A071d8084CB9a15b04F182a7C9634' + TwocryptoFactoryNGHandler: '0xD8D569f74D3Ea07708d92802dD3f60353Ef1d8a8' +kava: + BasePoolRegistry: '0x64AFA95e0C3D8410240a4262df9Fd82B12b64eDd' + StableFactoryHandler: '0x21688e843a99B0a47E750e7dDD2b5dAFd9269d30' + StableRegistryHandler: '0x72DbDFA64965C9ADbcdD7343bEe4AEC1370d35bd' +optimism: + BasePoolRegistry: '0xa0EC67a3C483674f77915893346A8CA3AbE2b785' + CryptoRegistryHandler: '0xB00E89EaBD59cD3254c88E390103Cf17E914f678' + Metaregistry: '0xc65CB3156225380BEda366610BaB18D5835A1647' + StableFactoryHandler: '0x9d3975070768580f755D405527862ee126d0eA08' + StableRegistryHandler: '0xf46D25696677898454dfDd644830C821243A1188' + StableswapFactoryNGHandler: '0xDCc91f930b42619377C200BA05b7513f2958b202' + TricryptoFactoryNGHandler: '0xc9CBC565A9F4120a2740ec6f64CC24AeB2bB3E5E' + TwocryptoFactoryNGHandler: '0x442B22fd19A25c1582Dc1Bc3949fb364ad7f34F4' +polygon: + BasePoolRegistry: '0xDD7EBB1C49780519dD9755B8B1A23a6f42CE099E' + CryptoFactoryHandler: '0x08390c76dfdab74249754c8e71cc2747351bd388' + CryptoRegistryHandler: '0xc65cb3156225380beda366610bab18d5835a1647' + Metaregistry: '0x296d2B5C23833A70D07c8fCBB97d846c1ff90DDD' + StableFactoryHandler: '0x452b9481fe83deadAf9f35226Cf79a53B26032da' + StableRegistryHandler: '0xfb37b8D939FFa77114005e61CFc2e543d6F49A81' + StableswapFactoryNGHandler: '0x9d3975070768580f755D405527862ee126d0eA08' + TricryptoFactoryNGHandler: '0xf46D25696677898454dfDd644830C821243A1188' + TwocryptoFactoryNGHandler: '0xb00e89eabd59cd3254c88e390103cf17e914f678' diff --git a/scripts/address_provider_constants.py b/scripts/address_provider_constants.py index 2d99997..849f7ff 100644 --- a/scripts/address_provider_constants.py +++ b/scripts/address_provider_constants.py @@ -306,4 +306,20 @@ 12: "0xd2002373543Ce3527023C75e7518C274A51ce712", 13: "0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F", }, + "zksync": { + 2: "", # 2: "Exchange Router", + 4: "", # 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", + 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" + }, } diff --git a/scripts/deploy_metaregistry_sidechain_l2s.py b/scripts/deploy_metaregistry_sidechain_l2s.py deleted file mode 100644 index 531358b..0000000 --- a/scripts/deploy_metaregistry_sidechain_l2s.py +++ /dev/null @@ -1,128 +0,0 @@ -import os -import sys - -import boa -from eth_account import Account -from rich.console import Console as RichConsole - -sys.path.append("./") - -FIDDY_DEPLOYER = "" -ADDRESS_PROVIDER = "0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98" -GAUGE_TYPE = { - "arbitrum": 7, - "optimism": 11, - "polygon": 2, - "base": 0, - "fraxtal": 11, - "bsc": 12, - "gnosis": 4, - "fantom": 1, - "avalanche": 8, - "aurora": -1, - "celo": -1, - "kava": 9, - "mantle": -1, - "linea": -1, - "scroll": -1, - "polygon-zkevm": -1, - "xlayer": -1, -} - - -def fetch_url(network): - return os.getenv("DRPC_URL") % (network, os.getenv("DRPC_KEY")) - - -def main(network, fork, url=""): - """ - Deploy the AddressProvider to the network. - """ - assert "ethereum" not in network - console = RichConsole() - if not url: - url = fetch_url(network) - - if not fork: - # Prodmode - console.log("Running script in prod mode...") - boa.set_network_env(url) - boa.env.add_account(Account.from_key(os.environ["FIDDYDEPLOYER"])) - boa.env.suppress_debug_tt(True) - - else: - # Forkmode - console.log("Simulation Mode. Writing to mainnet-fork.") - boa.env.fork(url=url) - boa.env.eoa = FIDDY_DEPLOYER - - address_provider = boa.load_partial("contracts/AddressProviderNG.vy").at( - ADDRESS_PROVIDER - ) - - # deploy metaregistry - # console.log("Deploying Metaregistry ...") - # gauge_factory = address_provider.get_address(20) # 20 is for Gauge Factory - # gauge_type = GAUGE_TYPE[network] - # metaregistry = boa.load("contracts/MetaregistryL2.vy", gauge_factory, gauge_type) - # console.log( - # "Constructor arguments: ", - # encode(["address", "int128"], [gauge_factory, gauge_type]).hex(), - # ) - - # xlayer - metaregistry = boa.load_partial("contracts/MetaregistryL2.vy").at( - "0x87DD13Dd25a1DBde0E1EdcF5B8Fa6cfff7eABCaD" - ) - - # set up tricrypto ng factory handler - console.log("Deploy Tricrypto Factory Handler ...") - tricrypto_ng_factory = address_provider.get_address(11) - tricrypto_ng_factory_handler = boa.load( - "contracts/registry_handlers/ng/CurveTricryptoFactoryHandler.vy", - tricrypto_ng_factory, - ) - - # set up stableswap ng factory handler - console.log("Deploy Stableswap Factory Handler ...") - stableswap_ng_factory = address_provider.get_address(12) - stableswap_ng_factory_handler = boa.load( - "contracts/registry_handlers/ng/CurveStableSwapFactoryNGHandler.vy", - stableswap_ng_factory, - ) - - # set up twocrypto ng factory handler - console.log("Deploy Twocrypto Factory Handler ...") - twocrypto_ng_factory = address_provider.get_address(13) - twocrypto_ng_factory_handler = boa.load( - "contracts/registry_handlers/ng/CurveTwocryptoFactoryHandler.vy", - twocrypto_ng_factory, - ) - - # Add registry handlers to the metaregistry - console.log("Add Factory Handlers to Metaregistry ...") - metaregistry.add_registry_handler(stableswap_ng_factory_handler.address) - metaregistry.add_registry_handler(twocrypto_ng_factory_handler.address) - metaregistry.add_registry_handler(tricrypto_ng_factory_handler.address) - - # add metaregistry to address provider - console.log("Add Metaregistry to AddressProvider ...") - address_provider.add_new_id(7, metaregistry.address, "Metaregistry") - - console.log("Deployment and integration of the Metaregistry completed.") - - -if __name__ == "__main__": - # not deployed: - # aurora - - network = "" - fork = False - url = "" - - if network == "xlayer": - url = "https://rpc.xlayer.tech" - elif network == "fraxtal": - url = "https://rpc.frax.com" - - main(network, fork, url=url) diff --git a/scripts/deploy_metaregistryl2.py b/scripts/deploy_metaregistryl2.py new file mode 100644 index 0000000..bafa04d --- /dev/null +++ b/scripts/deploy_metaregistryl2.py @@ -0,0 +1,265 @@ +# flake8: noqa + +import os +import sys + +import boa +import yaml +from boa.network import NetworkEnv +from eth.constants import ZERO_ADDRESS +from eth_account import Account +from rich import console as rich_console + +sys.path.append("./") +from scripts.deploy_addressprovider_and_setup import fetch_url +from scripts.legacy_base_pools import base_pools as BASE_POOLS +from scripts.utils.constants import FIDDY_DEPLOYER + +console = rich_console.Console() + +ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" +ADDRESS_PROVIDER = "0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98" +GAUGE_TYPE = { + "arbitrum": 7, + "optimism": 11, + "polygon": 2, + "base": 0, + "fraxtal": 11, + "bsc": 12, + "gnosis": 4, + "fantom": 1, + "avalanche": 8, + "aurora": -1, + "celo": -1, + "kava": 9, + "mantle": -1, + "linea": -1, + "scroll": -1, + "polygon-zkevm": -1, + "xlayer": -1, +} + + +def check_contract_deployed(network, designation): + with open("./deployments.yaml", "r") as file: + deployments = yaml.safe_load(file) + + if deployments is None: + deployments = {} + + if ( + network in deployments.keys() + and designation in deployments[network].keys() + ): + contract_address = deployments[network][designation] + console.log( + f"{designation} deployed already at {network}: {contract_address}" + ) + return contract_address + + return ZERO_ADDRESS + + +def store_deployed_contract(network, designation, deployment_address): + with open("./deployments.yaml", "r") as file: + deployments = yaml.safe_load(file) + + if deployments is None: + deployments = {} + + if not network in deployments.keys(): + deployments[network] = {} + + deployments[network][designation] = str(deployment_address) + with open("./deployments.yaml", "w") as file: + yaml.dump(deployments, file) + + +def deploy_and_cache_contracts(network, designation, contract_file, args): + contract_address = check_contract_deployed(network, designation) + if contract_address != ZERO_ADDRESS: + return boa.load_partial(contract_file).at(contract_address) + + deployed_contract = boa.load(contract_file, *args) + store_deployed_contract(network, designation, deployed_contract.address) + + return deployed_contract + + +def main(network, fork, url, deploy_ng_handlers): + assert "ethereum" not in network + + if not url: + url = fetch_url(network) + + if not fork: + # Prodmode + console.log("Running script in prod mode...") + boa.set_env(NetworkEnv(url)) + boa.env.add_account(Account.from_key(os.environ["FIDDYDEPLOYER"])) + + else: + # Forkmode + console.log("Simulation Mode. Writing to mainnet-fork.") + boa.env.fork(url=url) + boa.env.eoa = FIDDY_DEPLOYER + + address_provider = boa.load_partial("contracts/AddressProviderNG.vy").at( + ADDRESS_PROVIDER + ) + metaregistry_address = address_provider.get_address(7) + + # deploy metaregistry + console.log("Deploying Metaregistry ...") + gauge_factory = address_provider.get_address(20) # 20 is for Gauge Factory + gauge_type = GAUGE_TYPE[network] + + if metaregistry_address == ZERO_ADDRESS: + metaregistry = deploy_and_cache_contracts( + network, + "Metaregistry", + "contracts/MetaregistryL2.vy", + [gauge_factory, gauge_type], + ) + deploy_ng_handlers = True + else: + metaregistry = boa.load_partial("contracts/MetaRegistryL2.vy").at( + metaregistry_address + ) + + # deploy base pool registry (even if there are no legacy base pools): + console.log("Deploying base pool registry ...") + base_pools = [] + if network in BASE_POOLS.keys(): + base_pools = BASE_POOLS[network] + + base_pools_registry = deploy_and_cache_contracts( + network, + "BasePoolRegistry", + "contracts/registries/BasePoolRegistry.vy", + [], + ) + + registry_list = [ + metaregistry.get_registry(i) + for i in range(metaregistry.registry_length()) + ] + + if not len(base_pools) == base_pools_registry.base_pool_count(): + console.log("Adding base pools to the base pool registry ...") + added_base_pools = [ + base_pools_registry.base_pool_list(i) + for i in range(len(base_pools)) + ] + for base_pool in base_pools: + if not base_pool[0] in added_base_pools: + base_pools_registry.add_base_pool(*base_pool) + + # deploy stableswap registry and factory handlers + stableswap_custom_pool_registry = address_provider.get_address(0) + if stableswap_custom_pool_registry != ZERO_ADDRESS: + console.log( + "Adding stableswap custom pool registry to the Metaregistry ..." + ) + registry_handler = deploy_and_cache_contracts( + network, + "StableRegistryHandler", + "contracts/registry_handlers/StableRegistryHandler.vy", + [stableswap_custom_pool_registry], + ) + if registry_handler.address not in registry_list: + metaregistry.add_registry_handler(registry_handler.address) + + stableswap_factory = address_provider.get_address(3) + if stableswap_factory != ZERO_ADDRESS: + console.log("Adding stableswap factory to the Metaregistry ...") + registry_handler = deploy_and_cache_contracts( + network, + "StableFactoryHandler", + "contracts/registry_handlers/StableFactoryHandler.vy", + [stableswap_factory, base_pools_registry.address], + ) + if registry_handler.address not in registry_list: + metaregistry.add_registry_handler(registry_handler.address) + + # deploy cryptoswap registry and factory handlers + cryptoswap_custom_pool_registry = address_provider.get_address(5) + if cryptoswap_custom_pool_registry != ZERO_ADDRESS: + console.log( + "Adding cryptoswap custom pool registry to the Metaregistry ..." + ) + registry_handler = deploy_and_cache_contracts( + network, + "CryptoRegistryHandler", + "contracts/registry_handlers/CryptoRegistryHandler.vy", + [cryptoswap_custom_pool_registry], + ) + if registry_handler.address not in registry_list: + metaregistry.add_registry_handler(registry_handler.address) + + cryptoswap_factory = address_provider.get_address(6) + if cryptoswap_factory != ZERO_ADDRESS: + console.log("Adding cryptoswap factory to the Metaregistry ...") + registry_handler = deploy_and_cache_contracts( + network, + "CryptoFactoryHandler", + "contracts/registry_handlers/CryptoFactoryHandler.vy", + [cryptoswap_factory, base_pools_registry.address], + ) + if registry_handler.address not in registry_list: + metaregistry.add_registry_handler(registry_handler.address) + + # since we bricked a few contracts: + if deploy_ng_handlers: + # set up tricrypto ng factory handler + console.log("Deploy Tricrypto Factory NG Handler ...") + tricrypto_ng_factory = address_provider.get_address(11) + registry_handler = deploy_and_cache_contracts( + network, + "TricryptoFactoryNGHandler", + "contracts/registry_handlers/ng/CurveTricryptoFactoryHandler.vy", + [tricrypto_ng_factory], + ) + if registry_handler.address not in registry_list: + metaregistry.add_registry_handler(registry_handler.address) + + # set up stableswap ng factory handler + console.log("Deploy Stableswap Factory NG Handler ...") + stableswap_ng_factory = address_provider.get_address(12) + registry_handler = deploy_and_cache_contracts( + network, + "StableswapFactoryNGHandler", + "contracts/registry_handlers/ng/CurveStableSwapFactoryNGHandler.vy", + [stableswap_ng_factory], + ) + if registry_handler.address not in registry_list: + metaregistry.add_registry_handler(registry_handler.address) + + # set up twocrypto ng factory handler + console.log("Deploy Twocrypto Factory NG Handler ...") + twocrypto_ng_factory = address_provider.get_address(13) + registry_handler = deploy_and_cache_contracts( + network, + "TwocryptoFactoryNGHandler", + "contracts/registry_handlers/ng/CurveTwocryptoFactoryHandler.vy", + [twocrypto_ng_factory], + ) + if registry_handler.address not in registry_list: + metaregistry.add_registry_handler(registry_handler.address) + + # add metaregistry to address provider + console.log("Add Metaregistry to AddressProvider ...") + address_provider.add_new_id(7, metaregistry.address, "Metaregistry") + + console.log( + f"Deployment and integration of the Metaregistry on {network} completed." + ) + + +if __name__ == "__main__": + network = "" + url = "" + fork = False + deploy_ng_handlers = False + + main(network, fork, url, deploy_ng_handlers) diff --git a/scripts/legacy_base_pools.py b/scripts/legacy_base_pools.py new file mode 100644 index 0000000..ede3703 --- /dev/null +++ b/scripts/legacy_base_pools.py @@ -0,0 +1,125 @@ +# pool +# lp_token +# n_coins +# is_legacy +# is_lending +# is_v2 + +base_pools = { + "arbitrum": [ + [ + "0x7f90122BF0700F9E7e1F688fe926940E8839F353", # 2pool + "0x7f90122BF0700F9E7e1F688fe926940E8839F353", + 2, + False, + False, + False, + ], + [ + "0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb", # wbtc/renbtc + "0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb", + 2, + False, + False, + False, + ], + [ + "0xC9B8a3FDECB9D5b218d02555a8Baf332E5B740d5", # fraxbp + "0xC9B8a3FDECB9D5b218d02555a8Baf332E5B740d5", + 2, + False, + False, + False, + ], + ], + "optimism": [ + [ + "0x1337BedC9D22ecbe766dF105c9623922A27963EC", # 3pool + "0x1337BedC9D22ecbe766dF105c9623922A27963EC", + 3, + False, + False, + False, + ], + [ + "0x29A3d66B30Bc4AD674A4FDAF27578B64f6afbFe7", # fraxbp + "0x29A3d66B30Bc4AD674A4FDAF27578B64f6afbFe7", + 2, + False, + False, + False, + ], + ], + "polygon": [ + [ + "0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67", # aave btc + "0xf8a57c1d3b9629b77b6726a042ca48990A84Fb49", + 2, + False, + True, # aave atokens + False, + ], + [ + "0x445FE580eF8d70FF569aB36e80c647af338db351", # aave 3pool + "0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171", + 3, + False, + True, # aave atokens + False, + ], + ], + "fantom": [ + [ + "0x27E611FD27b276ACbd5Ffd632E5eAEBEC9761E40", # dai <> usdc + "0x27E611FD27b276ACbd5Ffd632E5eAEBEC9761E40", + 2, + False, + False, + False, + ], + [ + "0x3eF6A01A0f81D6046290f3e2A8c5b843e738E604", # renbtc + "0x5B5CFE992AdAC0C9D48E05854B2d91C73a003858", + 2, + False, + False, + False, + ], + [ + "0x0fa949783947Bf6c1b171DB13AEACBB488845B3f", # geist 3pool + "0xD02a30d33153877BC20e5721ee53DeDEE0422B2F", + 3, + False, + True, + False, + ], + ], + "gnosis": [ + [ + "0x7f90122BF0700F9E7e1F688fe926940E8839F353", # x3pool + "0x1337BedC9D22ecbe766dF105c9623922A27963EC", + 3, + False, + False, + False, + ], + ], + "avalanche": [ + [ + "0x7f90122BF0700F9E7e1F688fe926940E8839F353", # av3pool + "0x1337BedC9D22ecbe766dF105c9623922A27963EC", + 3, + False, + True, + False, + ], + [ + "0x16a7DA911A4DD1d83F3fF066fE28F3C792C50d90", # aave renbtc/wbtc + "0xC2b1DF84112619D190193E48148000e3990Bf627", + 2, + False, + True, + False, + ], + ], +} diff --git a/scripts/utils/__init__.py b/scripts/utils/__init__.py index d1b5f1c..dbaa4c1 100644 --- a/scripts/utils/__init__.py +++ b/scripts/utils/__init__.py @@ -3,7 +3,6 @@ import boa from boa.network import NetworkEnv -from boa.vyper.contract import VyperContract from eth_account import Account from eth_utils import keccak from rich.console import Console as RichConsole @@ -67,7 +66,7 @@ def setup_environment(console: RichConsole): return False -def get_deployed_contract(contract_name: str, address: str) -> VyperContract: +def get_deployed_contract(contract_name: str, address: str): """ Loads a contract and retrieves a deployed instance of it with the given address. :param contract_name: The name of the contract ABI to load. From 2f70312d7d94556eb294025855496d42c7ad35c6 Mon Sep 17 00:00:00 2001 From: bout3fiddy <11488427+bout3fiddy@users.noreply.github.com> Date: Thu, 4 Jul 2024 21:23:50 +0200 Subject: [PATCH 4/4] zksync deployment --- .gitignore | 1 + deployments.yaml | 5 + scripts/add_new_id_addressprovider.py | 58 ++++++--- scripts/address_provider_constants.py | 10 +- scripts/deploy_metaregistryl2.py | 179 +++++++++++++++++--------- 5 files changed, 164 insertions(+), 89 deletions(-) diff --git a/.gitignore b/.gitignore index 173eb82..c4993e4 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ bvenv/ .hypothesis/ .gz .json.gz +era_test_node.log diff --git a/deployments.yaml b/deployments.yaml index 29a8edd..d78fe13 100644 --- a/deployments.yaml +++ b/deployments.yaml @@ -71,3 +71,8 @@ polygon: StableswapFactoryNGHandler: '0x9d3975070768580f755D405527862ee126d0eA08' TricryptoFactoryNGHandler: '0xf46D25696677898454dfDd644830C821243A1188' TwocryptoFactoryNGHandler: '0xb00e89eabd59cd3254c88e390103cf17e914f678' +zksync: + Metaregistry: '0x48e4b27553e7643E10229ea3cba91c188dc524B1' + StableswapFactoryNGHandler: '0x4Cabf81fbf1F42531d55507F38Be77367481a8dF' + TricryptoFactoryNGHandler: '0xf3f38b1677553789A048FFf4A2CeedCDf063309e' + TwocryptoFactoryNGHandler: '0x0F3d82D719582BcaB662F434D77B089C86D05FAb' diff --git a/scripts/add_new_id_addressprovider.py b/scripts/add_new_id_addressprovider.py index a9e5f39..db716ab 100644 --- a/scripts/add_new_id_addressprovider.py +++ b/scripts/add_new_id_addressprovider.py @@ -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) @@ -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" @@ -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) diff --git a/scripts/address_provider_constants.py b/scripts/address_provider_constants.py index 849f7ff..f7c25ea 100644 --- a/scripts/address_provider_constants.py +++ b/scripts/address_provider_constants.py @@ -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" }, } diff --git a/scripts/deploy_metaregistryl2.py b/scripts/deploy_metaregistryl2.py index bafa04d..0c87d8b 100644 --- a/scripts/deploy_metaregistryl2.py +++ b/scripts/deploy_metaregistryl2.py @@ -18,7 +18,11 @@ console = rich_console.Console() ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" -ADDRESS_PROVIDER = "0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98" +ADDRESS_PROVIDER = ( + "0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98" # gets replaced for zksync +) + +# if -1: no gauge type known just yet GAUGE_TYPE = { "arbitrum": 7, "optimism": 11, @@ -37,6 +41,7 @@ "scroll": -1, "polygon-zkevm": -1, "xlayer": -1, + "zksync": -1, } @@ -75,58 +80,23 @@ def store_deployed_contract(network, designation, deployment_address): yaml.dump(deployments, file) -def deploy_and_cache_contracts(network, designation, contract_file, args): +def deploy_and_cache_contracts( + network, designation, contract_file, args, fork=False +): contract_address = check_contract_deployed(network, designation) if contract_address != ZERO_ADDRESS: return boa.load_partial(contract_file).at(contract_address) deployed_contract = boa.load(contract_file, *args) - store_deployed_contract(network, designation, deployed_contract.address) - - return deployed_contract - - -def main(network, fork, url, deploy_ng_handlers): - assert "ethereum" not in network - - if not url: - url = fetch_url(network) - if not fork: - # Prodmode - console.log("Running script in prod mode...") - boa.set_env(NetworkEnv(url)) - boa.env.add_account(Account.from_key(os.environ["FIDDYDEPLOYER"])) - - else: - # Forkmode - console.log("Simulation Mode. Writing to mainnet-fork.") - boa.env.fork(url=url) - boa.env.eoa = FIDDY_DEPLOYER - - address_provider = boa.load_partial("contracts/AddressProviderNG.vy").at( - ADDRESS_PROVIDER - ) - metaregistry_address = address_provider.get_address(7) + store_deployed_contract( + network, designation, deployed_contract.address + ) - # deploy metaregistry - console.log("Deploying Metaregistry ...") - gauge_factory = address_provider.get_address(20) # 20 is for Gauge Factory - gauge_type = GAUGE_TYPE[network] + return deployed_contract - if metaregistry_address == ZERO_ADDRESS: - metaregistry = deploy_and_cache_contracts( - network, - "Metaregistry", - "contracts/MetaregistryL2.vy", - [gauge_factory, gauge_type], - ) - deploy_ng_handlers = True - else: - metaregistry = boa.load_partial("contracts/MetaRegistryL2.vy").at( - metaregistry_address - ) +def deploy_base_pool_registry(network, fork): # deploy base pool registry (even if there are no legacy base pools): console.log("Deploying base pool registry ...") base_pools = [] @@ -138,13 +108,10 @@ def main(network, fork, url, deploy_ng_handlers): "BasePoolRegistry", "contracts/registries/BasePoolRegistry.vy", [], + fork, ) - registry_list = [ - metaregistry.get_registry(i) - for i in range(metaregistry.registry_length()) - ] - + # will add new base pools if registry does not have it: if not len(base_pools) == base_pools_registry.base_pool_count(): console.log("Adding base pools to the base pool registry ...") added_base_pools = [ @@ -155,6 +122,10 @@ def main(network, fork, url, deploy_ng_handlers): if not base_pool[0] in added_base_pools: base_pools_registry.add_base_pool(*base_pool) + return base_pools_registry + + +def legacy_deployment(address_provider, metaregistry, registry_list): # deploy stableswap registry and factory handlers stableswap_custom_pool_registry = address_provider.get_address(0) if stableswap_custom_pool_registry != ZERO_ADDRESS: @@ -166,18 +137,23 @@ def main(network, fork, url, deploy_ng_handlers): "StableRegistryHandler", "contracts/registry_handlers/StableRegistryHandler.vy", [stableswap_custom_pool_registry], + fork, ) if registry_handler.address not in registry_list: metaregistry.add_registry_handler(registry_handler.address) stableswap_factory = address_provider.get_address(3) if stableswap_factory != ZERO_ADDRESS: + # we need the base pools registry for legacy deployments + base_pools_registry = deploy_base_pool_registry(network, fork) + console.log("Adding stableswap factory to the Metaregistry ...") registry_handler = deploy_and_cache_contracts( network, "StableFactoryHandler", "contracts/registry_handlers/StableFactoryHandler.vy", [stableswap_factory, base_pools_registry.address], + fork, ) if registry_handler.address not in registry_list: metaregistry.add_registry_handler(registry_handler.address) @@ -193,6 +169,7 @@ def main(network, fork, url, deploy_ng_handlers): "CryptoRegistryHandler", "contracts/registry_handlers/CryptoRegistryHandler.vy", [cryptoswap_custom_pool_registry], + fork, ) if registry_handler.address not in registry_list: metaregistry.add_registry_handler(registry_handler.address) @@ -205,51 +182,114 @@ def main(network, fork, url, deploy_ng_handlers): "CryptoFactoryHandler", "contracts/registry_handlers/CryptoFactoryHandler.vy", [cryptoswap_factory, base_pools_registry.address], + fork, ) if registry_handler.address not in registry_list: metaregistry.add_registry_handler(registry_handler.address) - # since we bricked a few contracts: - if deploy_ng_handlers: - # set up tricrypto ng factory handler - console.log("Deploy Tricrypto Factory NG Handler ...") - tricrypto_ng_factory = address_provider.get_address(11) + +def ng_deployment(address_provider, metaregistry, registry_list): + # set up tricrypto ng factory handler + tricrypto_ng_factory = address_provider.get_address(11) + if tricrypto_ng_factory != ZERO_ADDRESS: + console.log("Adding Tricrypto Factory NG Handler ...") registry_handler = deploy_and_cache_contracts( network, "TricryptoFactoryNGHandler", "contracts/registry_handlers/ng/CurveTricryptoFactoryHandler.vy", [tricrypto_ng_factory], + fork, ) if registry_handler.address not in registry_list: metaregistry.add_registry_handler(registry_handler.address) - # set up stableswap ng factory handler - console.log("Deploy Stableswap Factory NG Handler ...") - stableswap_ng_factory = address_provider.get_address(12) + # set up stableswap ng factory handler + stableswap_ng_factory = address_provider.get_address(12) + if stableswap_ng_factory != ZERO_ADDRESS: + console.log("Adding Stableswap Factory NG Handler ...") registry_handler = deploy_and_cache_contracts( network, "StableswapFactoryNGHandler", "contracts/registry_handlers/ng/CurveStableSwapFactoryNGHandler.vy", [stableswap_ng_factory], + fork, ) if registry_handler.address not in registry_list: metaregistry.add_registry_handler(registry_handler.address) - # set up twocrypto ng factory handler - console.log("Deploy Twocrypto Factory NG Handler ...") - twocrypto_ng_factory = address_provider.get_address(13) + # set up twocrypto ng factory handler + twocrypto_ng_factory = address_provider.get_address(13) + if twocrypto_ng_factory != ZERO_ADDRESS: + console.log("Adding Twocrypto Factory NG Handler ...") registry_handler = deploy_and_cache_contracts( network, "TwocryptoFactoryNGHandler", "contracts/registry_handlers/ng/CurveTwocryptoFactoryHandler.vy", [twocrypto_ng_factory], + fork, ) if registry_handler.address not in registry_list: metaregistry.add_registry_handler(registry_handler.address) - # add metaregistry to address provider + +def main(network, fork, url): + 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: + 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 = boa.load_partial("contracts/AddressProviderNG.vy").at( + ADDRESS_PROVIDER + ) + metaregistry_address = address_provider.get_address(7) + + # deploy metaregistry or fetch if it doesnt exist: + console.log("Deploying Metaregistry ...") + gauge_factory = address_provider.get_address(20) # 20 is for Gauge Factory + gauge_type = GAUGE_TYPE[network] + + if metaregistry_address == ZERO_ADDRESS: + metaregistry = deploy_and_cache_contracts( + network, + "Metaregistry", + "contracts/MetaregistryL2.vy", + [gauge_factory, gauge_type], + fork, + ) + + # Add Metaregistry to AddressProvider console.log("Add Metaregistry to AddressProvider ...") address_provider.add_new_id(7, metaregistry.address, "Metaregistry") + else: + metaregistry = boa.load_partial("contracts/MetaRegistryL2.vy").at( + metaregistry_address + ) + + registry_list = [ + metaregistry.get_registry(i) + for i in range(metaregistry.registry_length()) + ] + + # legacy registry handlers deployment: + legacy_deployment(address_provider, metaregistry, registry_list) + + # ng registry handlers deployment: + ng_deployment(address_provider, metaregistry, registry_list) console.log( f"Deployment and integration of the Metaregistry on {network} completed." @@ -257,9 +297,20 @@ def main(network, fork, url, deploy_ng_handlers): if __name__ == "__main__": - network = "" + network = "zksync" url = "" fork = False - deploy_ng_handlers = False - main(network, fork, url, deploy_ng_handlers) + 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)