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

dao transfer script #36

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
40 changes: 21 additions & 19 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
MIT License
(c) Curve.Fi, 2023

Copyright (c) 2022 fiddy
Except as otherwise provided in the header of a specific source code
file in this repository: (a) all intellectual property (including all
source code, designs and protocols) contained in this repository has been
published for informational purposes only; (b) no license, right of
reproduction or distribution or other right with respect thereto is
granted or implied; and (c) all moral, intellectual property and other
rights are hereby reserved by the copyright holder.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
THE SOFTWARE AND INTELLECTUAL PROPERTY INCLUDED IN THIS REPOSITORY
IS PROVIDED BY THE COPYRIGHT HOLDERS "AS IS," AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE OR
INTELLECTUAL PROPERTY (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION), HOWEVER CAUSED OR CLAIMED (WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)), EVEN IF
SUCH DAMAGES WERE REASONABLY FORESEEABLE OR THE COPYRIGHT HOLDERS WERE
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48 changes: 27 additions & 21 deletions scripts/deployment_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -32,78 +33,83 @@ 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
dao_ownership_contract="0x2c163fe0f079d138b9c04f780d735289344C8B80",
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",
dao_ownership_contract="0xfe87a6CDCa1EEb90987c6A196a1C5F5C76F5F2b0",
thin_proxy_contract="0xf3A431008396df8A8b2DF492C913706BDB0874ef",
fee_receiver_address="0xf3A431008396df8A8b2DF492C913706BDB0874ef",
),
}
Expand Down
71 changes: 71 additions & 0 deletions scripts/transfer_to_dao.py
Original file line number Diff line number Diff line change
@@ -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(
"base:mainnet",
os.environ["RPC_BASE"],
"FIDDYDEPLOYER",
fork=forkmode,
)


if __name__ == "__main__":
main()
4 changes: 3 additions & 1 deletion scripts/vote_utils.py
Original file line number Diff line number Diff line change
@@ -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"
Expand Down