deploy_mocks()
Iteration 1
from brownie import FundMe
from brownie import network, config
from scripts.helpful_scripts import *
from scripts.helpful_scripts import LOCAL_BLOCKCHAIN_ENV
def deploy_fund_me():
account = get_account()
print(f"Deploying on ....{network.show_active()}")
if network.show_active() not in LOCAL_BLOCKCHAIN_ENV:
price_feed_address = config["networks"][network.show_active()]["eth_usd_price_feed"]
else: #deploy mock of price feed on internal chain: development
deploy_mocks()
price_feed_address = MockV3Aggregator[-1].address from brownie import MockV3Aggregator
DECIMAL_PLACES = 8 #to resemble eth/usd price feed on mainnet aggregator
STARTING_PRICE = (2000*10**8)
def deploy_mocks():
print(f"The active network is {network.show_active()}")
print("Deploying.....")
if len(MockV3Aggregator) <= 0:
MockV3Aggregator.deploy(DECIMAL_PLACES,STARTING_PRICE,{"from":get_account()}) #contract object
print(f"Mocks Deployed at: {MockV3Aggregator[-1].address}")If deploying to live chain (mainnet, rinkeby), price_feed_address will reference the chainlink ethusd contract address on the corresponding deployed.
If deploying to internal chain, like development
Iteration 2: get_contract() + deploy_mocks()
Explanation
if deploying to LOCAL_BLOCKCHAIN_ENV
Else: no mocks needed
Last updated