'Solidity - ImportError: cannot import name 'VRFCoordinatorMock' from 'brownie'
Would really appreciate any help on this error. I've tried several things and reviewed the contracts for VRF, but I can't seem to figure it out. All the other threads seem to solve it by moving their file, but mine is in the correct place. Please let me know if I can provide anything else.
Is it possible I'm pulling from the wrong address in my .yaml file?
Here is my bronwie-config.yaml:
Here is my deploy script:
from brownie import(network, config, accounts, MockV3Aggregator, VRFCoordinatorMock, LinkToken, Contract)
from web3 import Web3
FORKED_LOCAL_ENVIRONMENTS = ['mainnet-fork-dev']
LOCAL_BLOCKCHAIN_ENVIRONMENTS = ['development','ganache-local']
def get_account(index = None, id = None):
if index:
return accounts[index]
if id:
return accounts.load(id)
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS or network.show_active() in FORKED_LOCAL_ENVIRONMENTS:
return accounts[0]
return accounts.add(config['wallets']['from_key'])
contract_to_mock = {
'eth_usd_price_feed': MockV3Aggregator, 'vrf_coordinator': VRFCoordinatorMock, 'link_token': LinkToken
}
def get_contract(contract_name):
'''This function will grab the contract addresses from brownie config if defined.
Otherwise, it will deply a mock version of that contract, and retrun that mock contract.
Args:
contract_name (string)
returns:
brownie.network.contract.ProjectContract: the most recently deployed version of
'''
contract_type = contract_to_mock[contract_name]
if network.show_active() in LOCAL_BLOCKCHAIN_ENVIRONMENTS:
if len(contract_type) <= 0:
deploy_mocks()
contract = contract_type[-1]
#MockV3Aggregator[-1]
else:
contract_address = config['networks'][network.show_active()][contract_name]
contract = Contract.from_abi(contract_type._name, contract_address, contract_type.abi)
#MockV3Aggregator.abi
return contract
DECIMALS = 8
INITIAL_VALUE = 200000000000
def deploy_mocks(decimals= DECIMALS, initial_value= INITIAL_VALUE):
account = get_account()
MockV3Aggregator.deploy(decimals, initial_value, {'from':account})
link_token = LinkToken.deploy({'from':account})
VRFCoordinatorMock.deploy(link_token.address,{'from':account})
print('deployed')
Directory:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|