forked from kkrt-labs/kakarot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_kakarot.py
More file actions
69 lines (58 loc) · 1.98 KB
/
deploy_kakarot.py
File metadata and controls
69 lines (58 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import logging
from asyncio import run
from math import ceil, log
from scripts.constants import CHAIN_ID, COMPILED_CONTRACTS, EVM_ADDRESS, GATEWAY_CLIENT
from scripts.utils.starknet import (
declare,
deploy,
deploy_and_fund_evm_address,
dump_declarations,
dump_deployments,
get_declarations,
get_eth_contract,
get_starknet_account,
invoke,
)
logging.basicConfig()
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)
async def main():
logger.info(
f"ℹ️ Connected to CHAIN_ID {CHAIN_ID.value.to_bytes(ceil(log(CHAIN_ID.value, 256)), 'big')} "
f"with GATEWAY {GATEWAY_CLIENT.net}"
)
account = await get_starknet_account()
logger.info(f"ℹ️ Using account {hex(account.address)} as deployer")
class_hash = {
contract["contract_name"]: await declare(contract["contract_name"])
for contract in COMPILED_CONTRACTS
}
dump_declarations(class_hash)
class_hash = get_declarations()
eth = await get_eth_contract()
deployments = {}
deployments["kakarot"] = await deploy(
"kakarot",
account.address, # owner
eth.address, # native_token_address_
class_hash["contract_account"], # contract_account_class_hash_
class_hash["externally_owned_account"], # externally_owned_account_class_hash
class_hash["proxy"], # account_proxy_class_hash
)
deployments["blockhash_registry"] = await deploy(
"blockhash_registry",
deployments["kakarot"]["address"],
)
dump_deployments(deployments)
logger.info("⏳ Configuring Contracts...")
await invoke(
"kakarot",
"set_blockhash_registry",
deployments["blockhash_registry"]["address"],
)
logger.info("✅ Configuration Complete")
if EVM_ADDRESS:
logger.info(f"ℹ️ Found default EVM address {EVM_ADDRESS} to deploy an EOA for")
await deploy_and_fund_evm_address(EVM_ADDRESS, 0.1)
if __name__ == "__main__":
run(main())