-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest_env.py
34 lines (28 loc) · 966 Bytes
/
test_env.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
from brownie import HelloWorld, network, config, accounts, chain
priority = 5_000_000_000
network.priority_fee(priority)
network.max_fee(chain.base_fee + priority)
import logging
logging.basicConfig(filename='operations.log', encoding='utf-8', level=logging.INFO)
if network.show_active() == "development":
account = accounts[0]
else:
account = accounts.add(config["wallets"]["from_key"])
def log(txt):
print(txt)
logging.info(txt)
def deploy():
hello_world = HelloWorld.deploy(
"Welcome to EPFL",
{"from": account},
publish_source=config["networks"][network.show_active()].get("verify")
)
log(f"contract has been deployed successfully to : {hello_world.address}")
return hello_world
def msg(addr):
hello_world = HelloWorld.at(addr)
return hello_world.getMessage()
def main():
contract = deploy()
print("\n---\n")
log(f"HelloWorld has the following message: {msg(contract.address)}")