-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsismondi.py
44 lines (37 loc) · 1.45 KB
/
sismondi.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
from brownie import SismondiNFT, network, config, accounts, chain
priority = 5_000_000_000
network.priority_fee(priority)
network.max_fee(chain.base_fee + priority)
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 deploy_mint():
contract = deploy()
print("\n---\n")
nft = mint(contract.address)
print("\n---\n")
nft = mint(contract.address)
def main():
print("Please choose one of the following actions:")
print("deploy - a new contract. Add --network development to deploy on local development network")
print("mint #contractid - mints a new NFT. It prints the id of the NFT")
sys.exit(1)