-
Notifications
You must be signed in to change notification settings - Fork 0
/
deployGuild_factory.py
56 lines (46 loc) · 1.28 KB
/
deployGuild_factory.py
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
from multiversx_sdk import (
TransactionComputer,
)
from pathlib import Path
import time
import yaml
from utilities import get_default_data, tx_success
(
config,
test_address,
guild_factory_address,
provider,
network_config,
signer,
nonce_holder,
sc_factory,
) = get_default_data()
# Call deployGuild function
deploy_guild_tx = sc_factory.create_transaction_for_execute(
sender=test_address,
contract=guild_factory_address,
function="deployGuild",
gas_limit=42000000,
arguments=[],
)
deploy_guild_tx.nonce = nonce_holder.get_nonce_then_increment()
deploy_guild_tx.signature = signer.sign(
TransactionComputer().compute_bytes_for_signing(deploy_guild_tx)
)
result = provider.send_transaction(deploy_guild_tx)
print("Deploy Guild transaction hash:", result)
time.sleep(3)
# Get deployed guild address
deployed_guild_address = ""
if tx_success(result, provider):
deployed_guild_address = (
provider.get_transaction(result).logs.events[1].address.to_bech32()
)
print("Deployed Guild address:", deployed_guild_address)
else:
print("Deploy Guild transaction failed")
exit(1)
config["deployedGuildAddress"] = deployed_guild_address
# Write config
with open("config_file.yaml", "w") as file:
yaml.dump(config, file)