Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy zksync #26

Merged
merged 5 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions contracts/AddressProviderNG.vy
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
12 changes: 10 additions & 2 deletions contracts/registries/BasePoolRegistry.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma version ^0.3.7
# pragma version 0.3.10
# pragma evm-version paris
"""
@title Curve BasePool Registry
@license MIT
Expand Down Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion contracts/registries/CryptoRegistryV1.vy
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma version ^0.3.7
# pragma version 0.3.10
# pragma evm-version paris
"""
@title Curve CryptoSwap Registry
@license MIT
Expand Down
3 changes: 2 additions & 1 deletion contracts/registry_handlers/CryptoFactoryHandler.vy
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion contracts/registry_handlers/CryptoRegistryHandler.vy
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion contracts/registry_handlers/StableFactoryHandler.vy
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion contracts/registry_handlers/StableRegistryHandler.vy
Original file line number Diff line number Diff line change
@@ -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
Expand Down
78 changes: 78 additions & 0 deletions deployments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
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'
zksync:
Metaregistry: '0x48e4b27553e7643E10229ea3cba91c188dc524B1'
StableswapFactoryNGHandler: '0x4Cabf81fbf1F42531d55507F38Be77367481a8dF'
TricryptoFactoryNGHandler: '0xf3f38b1677553789A048FFf4A2CeedCDf063309e'
TwocryptoFactoryNGHandler: '0x0F3d82D719582BcaB662F434D77B089C86D05FAb'
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
titanoboa[forking-recommended] @ git+https://github.com/vyperlang/titanoboa@05ec84ad1decfe23cd4a3ffc588d567fd322a509
git+https://github.com/DanielSchiavini/titanoboa-zksync.git@0121e1f9a59b47f015cef55574b6084599144f20
black
flake8
isort
Expand Down
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)
14 changes: 14 additions & 0 deletions scripts/address_provider_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,4 +306,18 @@
12: "0xd2002373543Ce3527023C75e7518C274A51ce712",
13: "0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F",
},
"zksync": {
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",
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: "0x43cD37CC4B9EC54833c8aC362Dd55E58bFd62b86", # 25: "crvUSD Token"
},
}
22 changes: 22 additions & 0 deletions scripts/deploy_addressprovider_and_setup_zksync.py
Original file line number Diff line number Diff line change
@@ -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()
Loading
Loading