Skip to content

Commit

Permalink
final deployment script
Browse files Browse the repository at this point in the history
  • Loading branch information
bout3fiddy committed Dec 25, 2023
1 parent d6755cb commit 7caca5d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
43 changes: 29 additions & 14 deletions scripts/deploy_infra.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import boa
import deployment_utils as deploy_utils
from boa.network import NetworkEnv
from eth_abi import encode
from eth_account import Account
from eth_utils import keccak
from rich.console import Console as RichConsole
Expand Down Expand Up @@ -127,8 +126,9 @@
def check_and_deploy(
contract_obj,
contract_designation,
calculated_address,
network,
abi_encoded_args,
abi_encoded_args=b"",
blueprint: bool = False,
):

Expand All @@ -149,11 +149,10 @@ def check_and_deploy(
blueprint=blueprint,
blueprint_preamble=b"\xFE\x71\x00",
)
assert precomputed_address == calculated_address

contract = deploy_utils.deploy_via_create2_factory(
deployment_bytecode, salt
)

deploy_utils.deploy_via_create2_factory(deployment_bytecode, salt)
contract = contract_obj.at(precomputed_address)
logger.log(f"Deployed! At: {precomputed_address}.")

else:
Expand Down Expand Up @@ -202,26 +201,42 @@ def deploy_infra(network, url, account, fork=False):
)

# deploy non-blueprint contracts:
math_contract = check_and_deploy(math_contract_obj, "math", network)
views_contract = check_and_deploy(views_contract_obj, "views", network)
math_contract = check_and_deploy(
contract_obj=math_contract_obj,
contract_designation="math",
network=network,
calculated_address="0x2005995a71243be9FB995DaB4742327dc76564Df",
)
views_contract = check_and_deploy(
contract_obj=views_contract_obj,
contract_designation="views",
network=network,
calculated_address="0x07CdEBF81977E111B08C126DEFA07818d0045b80",
)

# deploy blueprint:
plain_blueprint = check_and_deploy(
amm_contract_obj, "amm", network, blueprint=True
amm_blueprint = check_and_deploy(
contract_obj=amm_contract_obj,
contract_designation="amm",
network=network,
calculated_address="0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223",
blueprint=True,
)

# Factory:
factory = check_and_deploy(
factory_contract_obj, "factory", network, False, b""
contract_obj=factory_contract_obj,
contract_designation="factory",
network=network,
calculated_address="0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F",
)

# initialise ownership addresses: this is so we can do create2
# addresses across multiple chains (where args are different)
factory.initialise_ownership(fee_receiver, deploy_utils.FIDDYDEPLOYER)

# Set up implementation addresses in the factory:
# This also checks if create2 deployment went well.
factory.set_pool_implementation(plain_blueprint, 0)
# Set up implementation addresses in the factory.
factory.set_pool_implementation(amm_blueprint, 0)
factory.set_views_implementation(views_contract)
factory.set_math_implementation(math_contract)

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_create2_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def factory(
boa.load_partial("contracts/main/CurveTwocryptoFactory.vy"),
abi_encoded_args=b"",
create2deployer=createxdeployer,
calculated_address="0x187CDD894d3ee916A10c50831e418F8eF54f8560",
calculated_address="0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F",
deployer=deployer,
blueprint=False,
)
Expand Down

0 comments on commit 7caca5d

Please sign in to comment.