Skip to content

Commit

Permalink
Deploy contracts to base
Browse files Browse the repository at this point in the history
  • Loading branch information
danhper committed Apr 9, 2024
1 parent d8276d5 commit 3393437
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 12 deletions.
11 changes: 11 additions & 0 deletions build/deployments/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -338,5 +338,16 @@
"ProxyAdmin": [
"0x4e56F19235FF2a14C76332877a35D6aF5bDE07EC"
]
},
"8453": {
"FreezableTransparentUpgradeableProxy": [
"0x8A5eB9A5B726583a213c7e4de2403d2DfD42C8a6"
],
"GyroConfig": [
"0x9b683cA24B0e013512E2566b68704dBe9677413c"
],
"ProxyAdmin": [
"0xefdE1c764Df6522a068b38106563DE166Ac97f58"
]
}
}
7 changes: 4 additions & 3 deletions scripts/deployment/deploy_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
make_tx_params,
with_deployed,
with_gas_usage,
get_proxy_owner,
)
from tests.support import config_keys, constants

Expand All @@ -28,9 +29,9 @@ def set_initial_config(governance_proxy, gyro_config):

@with_gas_usage
@with_deployed(GyroConfig)
@with_deployed(GovernanceProxy)
def proxy(governance_proxy, gyro_config):
deploy_proxy(gyro_config, gyro_config.initialize.encode_input(governance_proxy))
def proxy(gyro_config):
proxy_owner = get_proxy_owner()
deploy_proxy(gyro_config, gyro_config.initialize.encode_input(proxy_owner))


@with_gas_usage
Expand Down
41 changes: 32 additions & 9 deletions scripts/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
from typing import Any, Dict, cast

import brownie
from brownie import AssetRegistry, GyroConfig, GovernanceProxy, FreezableTransparentUpgradeableProxy, ProxyAdmin, interface # type: ignore
from brownie import (
AssetRegistry,
GyroConfig,
GovernanceProxy,
FreezableTransparentUpgradeableProxy,
ProxyAdmin,
interface,
) # type: ignore
from brownie import accounts, network
from brownie.network.account import ClefAccount, LocalAccount

Expand Down Expand Up @@ -81,27 +88,38 @@ def get_deployer():
return get_clef_account(MAINNET_DEPLOYER_ADDRESS)
else:
return cast(
LocalAccount, accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD) # type: ignore
LocalAccount,
accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD), # type: ignore
)
if chain_id == 137: # polygon
return cast(
LocalAccount, accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD) # type: ignore
LocalAccount,
accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD), # type: ignore
)
if chain_id == 42161: # arbitrum
return cast(
LocalAccount, accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD) # type: ignore
LocalAccount,
accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD), # type: ignore
)
if chain_id == 10: # optimism
return cast(
LocalAccount, accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD) # type: ignore
LocalAccount,
accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD), # type: ignore
)
if chain_id == 1101: # zkevm
return cast(
LocalAccount, accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD) # type: ignore
LocalAccount,
accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD), # type: ignore
)
if chain_id == 8453: # base
return cast(
LocalAccount,
accounts.load("ftl-deployer", BROWNIE_ACCOUNT_PASSWORD), # type: ignore
)
if chain_id == 42: # kovan
return cast(
LocalAccount, accounts.load("kovan-deployer", BROWNIE_ACCOUNT_PASSWORD) # type: ignore
LocalAccount,
accounts.load("kovan-deployer", BROWNIE_ACCOUNT_PASSWORD), # type: ignore
)
raise ValueError(f"chain id {chain_id} not yet supported")

Expand Down Expand Up @@ -160,6 +178,12 @@ def get_asset_registry():
return AssetRegistry[0]


def get_proxy_owner():
if brownie.chain.id == 8453:
return "0xf993e9B46782Edb083d0B1C4F4AE026F20dbeb4E" # params multisig
raise ValueError(f"Proxy owner not available on chain id {brownie.chain.id}")


def with_deployed(Contract):
def wrapped(f):
@wraps(f)
Expand All @@ -184,8 +208,7 @@ def wrapper(*args, **kwargs):

def deploy_proxy(contract, init_data=b"", config_key=None, overwrite_proxy=False):
deployer = get_deployer()
# proxy_admin = ProxyAdmin[0]
proxy_admin = ProxyAdmin.at("0x581aE43498196e3Dc274F3F23FF7718d287BC2C6")
proxy_admin = ProxyAdmin[0]
proxy = deployer.deploy(
FreezableTransparentUpgradeableProxy,
contract,
Expand Down

0 comments on commit 3393437

Please sign in to comment.