diff --git a/scripts/deployment_utils.py b/scripts/deployment_utils.py index b7af3632..7242b41e 100644 --- a/scripts/deployment_utils.py +++ b/scripts/deployment_utils.py @@ -17,8 +17,9 @@ @dataclass class CurveNetworkSettings: - dao_ownership_contract: Address - fee_receiver_address: Address + dao_ownership_contract: Address = "" + thin_proxy_contract: Address = "" + fee_receiver_address: Address = "" metaregistry_address: Address = "" base_pool_registry_address: Address = "" address_provider: Address = "0x0000000022d53366457f9d5e68ec105046fc4383" @@ -32,78 +33,81 @@ class CurveNetworkSettings: ), "ethereum:mainnet": CurveNetworkSettings( dao_ownership_contract="0x40907540d8a6C65c637785e8f8B742ae6b0b9968", + thin_proxy_contract="0xEdf2C58E16Cc606Da1977e79E1e69e79C54fe242", fee_receiver_address="0xeCb456EA5365865EbAb8a2661B0c503410e9B347", metaregistry_address="0xF98B45FA17DE75FB1aD0e7aFD971b0ca00e379fC", base_pool_registry_address="0xDE3eAD9B2145bBA2EB74007e58ED07308716B725", ), # Layer 2 "arbitrum:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xb055ebbacc8eefc166c169e9ce2886d0406ab49b", # proxy + dao_ownership_contract="0x452030a5D962d37D97A9D65487663cD5fd9C2B32", + thin_proxy_contract="0xb055ebbacc8eefc166c169e9ce2886d0406ab49b", fee_receiver_address="0xd4f94d0aaa640bbb72b5eec2d85f6d114d81a88e", ), "optimism:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", # proxy + dao_ownership_contract="0x28c4A1Fa47EEE9226F8dE7D6AF0a41C62Ca98267", + thin_proxy_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", fee_receiver_address="0xbF7E49483881C76487b0989CD7d9A8239B20CA41", ), "base:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xe8269B33E47761f552E1a3070119560d5fa8bBD6", # proxy - fee_receiver_address="0xe8269B33E47761f552E1a3070119560d5fa8bBD6", # proxy + thin_proxy_contract="0xe8269B33E47761f552E1a3070119560d5fa8bBD6", + fee_receiver_address="0xe8269B33E47761f552E1a3070119560d5fa8bBD6", ), "linea:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xf3A431008396df8A8b2DF492C913706BDB0874ef", + thin_proxy_contract="0xf3A431008396df8A8b2DF492C913706BDB0874ef", fee_receiver_address="0xf3A431008396df8A8b2DF492C913706BDB0874ef", ), "scroll:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xf3A431008396df8A8b2DF492C913706BDB0874ef", # proxy + thin_proxy_contract="0xf3A431008396df8A8b2DF492C913706BDB0874ef", fee_receiver_address="0xf3A431008396df8A8b2DF492C913706BDB0874ef", ), "zksync:mainnet": CurveNetworkSettings( - dao_ownership_contract="", + thin_proxy_contract="", fee_receiver_address="0x4920088D9a5e5De9c098FCA4960d0DA5f4caa4c1", ), "pzkevm:mainnet": CurveNetworkSettings( - dao_ownership_contract="0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6", + thin_proxy_contract="0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6", fee_receiver_address="0x8b3EFBEfa6eD222077455d6f0DCdA3bF4f3F57A6", ), # Layer 1 "polygon:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", # proxy + thin_proxy_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", fee_receiver_address="0x774D1Dba98cfBD1F2Bc3A1F59c494125e07C48F9", ), "gnosis:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", # proxy - fee_receiver_address="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", # proxy + thin_proxy_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", + fee_receiver_address="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", ), "avax:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", # proxy + thin_proxy_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", fee_receiver_address="0x06534b0BF7Ff378F162d4F348390BDA53b15fA35", ), "ftm:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", # proxy + thin_proxy_contract="0xB055EbbAcc8Eefc166c169e9Ce2886D0406aB49b", fee_receiver_address="0x2B039565B2b7a1A9192D4847fbd33B25b836B950", ), "kava:mainnet": CurveNetworkSettings( - dao_ownership_contract="0x1f0e8445Ebe0D0F60A96A7cd5BB095533cb15B58", + thin_proxy_contract="0x1f0e8445Ebe0D0F60A96A7cd5BB095533cb15B58", fee_receiver_address="0x1f0e8445Ebe0D0F60A96A7cd5BB095533cb15B58", ), "celo:mainnet": CurveNetworkSettings( - dao_ownership_contract="0x56bc95Ded2BEF162131905dfd600F2b9F1B380a4", + thin_proxy_contract="0x56bc95Ded2BEF162131905dfd600F2b9F1B380a4", fee_receiver_address="0x56bc95Ded2BEF162131905dfd600F2b9F1B380a4", ), "aurora:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xf3A431008396df8A8b2DF492C913706BDB0874ef", + thin_proxy_contract="0xf3A431008396df8A8b2DF492C913706BDB0874ef", fee_receiver_address="0xf3A431008396df8A8b2DF492C913706BDB0874ef", ), "bsc:mainnet": CurveNetworkSettings( - dao_ownership_contract="0x98B4029CaBEf7Fd525A36B0BF8555EC1d42ec0B6", + thin_proxy_contract="0x98B4029CaBEf7Fd525A36B0BF8555EC1d42ec0B6", fee_receiver_address="0x98B4029CaBEf7Fd525A36B0BF8555EC1d42ec0B6", ), "tron:mainnet": CurveNetworkSettings( - dao_ownership_contract="", + thin_proxy_contract="", fee_receiver_address="", ), "mantle:mainnet": CurveNetworkSettings( - dao_ownership_contract="0xf3A431008396df8A8b2DF492C913706BDB0874ef", + thin_proxy_contract="0xf3A431008396df8A8b2DF492C913706BDB0874ef", fee_receiver_address="0xf3A431008396df8A8b2DF492C913706BDB0874ef", ), } diff --git a/scripts/transfer_to_dao.py b/scripts/transfer_to_dao.py new file mode 100644 index 00000000..b834abb7 --- /dev/null +++ b/scripts/transfer_to_dao.py @@ -0,0 +1,71 @@ +import os +import sys + +import boa +import deployment_utils as deploy_utils +from boa.network import NetworkEnv +from deploy_infra import deployments +from eth_account import Account +from rich.console import Console as RichConsole + +logger = RichConsole(file=sys.stdout) + + +def transfer_ownership(network, url, account, fork=False): + + logger.log(f"Deploying on {network} ...") + + if fork: + boa.env.fork(url) + logger.log("Forkmode ...") + boa.env.eoa = deploy_utils.FIDDYDEPLOYER # set eoa address here + else: + logger.log("Prodmode ...") + boa.set_env(NetworkEnv(url)) + boa.env.add_account(Account.from_key(os.environ[account])) + + for _network, data in deploy_utils.curve_dao_network_settings.items(): + + if _network in network: + + curve_dao_ownership_agent = data.dao_ownership_contract + factory = boa.load_partial("contracts/main/CurveStableSwapFactoryNG.vy").at(deployments[network]["factory"]) + + current_factory_admin = factory.admin() + assert boa.env.eoa == current_factory_admin + assert curve_dao_ownership_agent != current_factory_admin + + factory.commit_transfer_ownership(curve_dao_ownership_agent) + + assert factory.future_admin() == curve_dao_ownership_agent + logger.log( + f"Committed Ownership transfer of Factory {factory.address} in network {network} " + f"from {current_factory_admin} to {curve_dao_ownership_agent}." + ) + + if fork: + + with boa.reverts(): + factory.accept_transfer_ownership(sender=current_factory_admin) + + factory.accept_transfer_ownership(sender=curve_dao_ownership_agent) + + # as a test, add an asset type in forkmode only: + factory.add_asset_type(9, "TEST", sender=curve_dao_ownership_agent) + logger.log("Successfully transferred ownership!") + + +def main(): + + forkmode = False + + transfer_ownership( + "optimism:mainnet", + os.environ["RPC_OPTIMISM"], + "FIDDYDEPLOYER", + fork=forkmode, + ) + + +if __name__ == "__main__": + main() diff --git a/scripts/vote_utils.py b/scripts/vote_utils.py index fd7defe7..dcfbf688 100644 --- a/scripts/vote_utils.py +++ b/scripts/vote_utils.py @@ -1,14 +1,16 @@ import json import os import pprint +import sys import warnings from typing import Dict, List, Tuple import ape import requests -from ape.logging import logger +from rich.console import Console as RichConsole warnings.filterwarnings("ignore") +logger = RichConsole(file=sys.stdout) ZERO_ADDRESS = "0x0000000000000000000000000000000000000000" CONVEX_VOTERPROXY = "0x989AEB4D175E16225E39E87D0D97A3360524AD80"