-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
819cd80
commit 59f4604
Showing
3 changed files
with
99 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( | ||
"optimism:mainnet", | ||
os.environ["RPC_OPTIMISM"], | ||
"FIDDYDEPLOYER", | ||
fork=forkmode, | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters