-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsismondi_test.py
35 lines (29 loc) · 1.09 KB
/
sismondi_test.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
from brownie import SismondiNFT, network, config, accounts, chain
import logging, sys
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():
sismondi_contract = SismondiNFT.deploy(
{"from": account},
publish_source=config["networks"][network.show_active()].get("verify")
)
log(f"contract has been deployed successfully to : {sismondi_contract.address}")
return sismondi_contract
def mint(addr):
sismondi_contract = SismondiNFT.at(addr)
nft = sismondi_contract.makeSismondiNFT({'from': account})
nft_id = nft.events['NewSismondiNFTMinted']['tokenId']
log(f"A new NFT with id {nft_id} has been successfully created in block {nft.block_number} with transaction {nft.txid}")
return nft
def main():
contract = deploy()
print("\n---\n")
nft = mint(contract.address)
print("\n---\n")
nft = mint(contract.address)