I did the script to to send brownie-config.yaml to front_end and when I run in the terminal deploy.py I get this error:
I don't know if it's something bad in the code or with the programs that I have installed, because I get the same error when I try to run codes in the previous projects as well.
Thank you for the help!
1.Deploy.py
from scripts.helpful_scripts import get_account, get_contract
from brownie import DappToken, TokenFarm, network, config
from web3 import Web3
import yaml
import json
import os
import shutil
#copy_folders_to_front_end("./build", "./front_end/src/chain-info")
# Sending the front end our config in JSON format
with open("brownie-config.yaml", "r") as brownie_config:
config_dict = yaml.load(brownie_config, Loader=yaml.FullLoader)
with open("./front_end/src/brownie-config.json", "w") as brownie_config_json:
json.dump(config_dict, brownie_config_json)
print("Front end updated!")
def get_account(index=None, id=None):
if index:
return accounts[index]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
return accounts[0]
if id:
return accounts.load(id)
return accounts.add(config["wallets"]["from_key"])
def get_contract(contract_name):
contract_type = contract_to_mock[contract_name]
if network.show_active() in NON_FORKED_LOCAL_BLOCKCHAIN_ENVIRONMENTS:
if len(contract_type) <= 0:
deploy_mocks()
contract = contract_type[-1]
else:
try:
contract_address = config["networks"][network.show_active()][contract_name]
contract = Contract.from_abi(
contract_type._name, contract_address, contract_type.abi
)
except KeyError:
print(
f"{network.show_active()} address not found, perhaps you should add it to the config or deploy mocks?"
)
print(
f"brownie run scripts/deploy_mocks.py --network {network.show_active()}"
)
return contract
I did the script to to send brownie-config.yaml to front_end and when I run in the terminal deploy.py I get this error:
I don't know if it's something bad in the code or with the programs that I have installed, because I get the same error when I try to run codes in the previous projects as well. Thank you for the help!
1.Deploy.py
from scripts.helpful_scripts import get_account, get_contract from brownie import DappToken, TokenFarm, network, config from web3 import Web3 import yaml import json import os import shutil
KEPT_BALANCE = Web3.toWei(100, "ether")
def deploy_token_farm_and_dapp_token(front_end_update=False): account = get_account() dapp_token = DappToken.deploy({"from": account}) token_farm = TokenFarm.deploy( dapp_token.address, {"from": account}, publish_source=config["networks"][network.show_active()]["verify"], ) tx = dapp_token.transfer( token_farm.address, dapp_token.totalSupply() - KEPT_BALANCE, {"from": account} ) tx.wait(1)
dapp_token, weth_token, fau_token/dai
def add_allowed_tokens(token_farm, dict_of_allowed_tokens, account): for token in dict_of_allowed_tokens: add_tx = token_farm.addAllowedTokens(token.address, {"from": account}) add_tx.wait(1) set_tx = token_farm.setPriceFeedContract( token.address, dict_of_allowed_tokens[token], {"from": account} ) set_tx.wait(1) return token_farm
def update_front_end():
Send the build folder
def main(): deploy_token_farm_and_dapp_token(front_end_update=True)
2.Update_front_end.py
from scripts.deploy import update_front_end
def main(): update_front_end()
from brownie import ( network, accounts, config, interface, LinkToken, MockV3Aggregator, MockWETH, MockDAI, Contract, )
INITIAL_PRICE_FEED_VALUE = 2000000000000000000000 DECIMALS = 18
NON_FORKED_LOCAL_BLOCKCHAIN_ENVIRONMENTS = ["hardhat", "development", "ganache"] LOCAL_BLOCKCHAIN_ENVIRONMENTS = NON_FORKED_LOCAL_BLOCKCHAIN_ENVIRONMENTS + [ "mainnet-fork", "binance-fork", "matic-fork", ]
contract_to_mock = { "eth_usd_price_feed": MockV3Aggregator, "dai_usd_price_feed": MockV3Aggregator, "fau_token": MockDAI, "weth_token": MockWETH, }
def get_account(index=None, id=None): if index: return accounts[index] if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS: return accounts[0] if id: return accounts.load(id) return accounts.add(config["wallets"]["from_key"])
def get_contract(contract_name):
def deploy_mocks(decimals=DECIMALS, initial_value=INITIAL_PRICE_FEED_VALUE):