def main(): if network.show_active() == 'mainnet-fork' or network.show_active( ) == 'development': return PriceFeed.deploy(mainnet_eth_usd_address, {'from': accounts[0]}) elif network.show_active() == 'kovan': dev = accounts.add(os.getenv('PRIVATE_KEY')) return PriceFeed.deploy(kovan_eth_usd_address, {'from': dev}) else: print('Please pick a supported network, or add the rinkeby config')
def main(): if network.show_active() in ['mainnet-fork', 'binance-fork', 'matic-fork']: price_feed = PriceFeed.deploy( config['networks'][network.show_active()]['eth_usd_price_feed'], {'from': accounts[0]}) print("The current price of ETH is " + str(price_feed.getLatestPrice({'from': accounts[0]}))) return price_feed elif network.show_active() in ['kovan', 'rinkeby', 'mainnet']: dev = accounts.add(os.getenv(config['wallets']['from_key'])) return PriceFeed.deploy( config['networks'][network.show_active()]['eth_usd_price_feed'], {'from': dev}) else: print('Please pick a supported network, or fork a chain')
def test_can_get_latest_price(get_eth_usd_price_feed_address, get_account): # Arrange address = get_eth_usd_price_feed_address # Act price_feed = PriceFeed.deploy(address, {"from": get_account}) # Assert value = price_feed.getLatestPrice({"from": get_account}) assert isinstance(value, int) assert value > 0
def test_can_deploy_contract(mainnet_eth_usd_address): # Arrange if network.show_active() != 'mainnet-fork': pytest.skip('Only works for mainnet-fork network') # Act price_feed = PriceFeed.deploy( mainnet_eth_usd_address, {'from': accounts[0]}) # Assert assert price_feed is not None
def test_can_get_latest_price(mainnet_eth_usd_address): # Arrange if network.show_active() != 'mainnet-fork': pytest.skip('Only works for mainnet-fork network') # Act price_feed = PriceFeed.deploy( mainnet_eth_usd_address, {'from': accounts[0]}) # Assert value = price_feed.getLatestPrice({'from': accounts[0]}) assert isinstance(value, int)
def main(): if network.show_active() in [ "mainnet-fork", "binance-fork", "matic-fork", "development", ]: price_feed = PriceFeed.deploy( config["networks"][network.show_active()]["eth_usd_price_feed"], {"from": accounts[0]}, publish_source=config["verify"], ) print("The current price of ETH is " + str(price_feed.getLatestPrice({"from": accounts[0]}))) return price_feed elif network.show_active() in ["kovan", "rinkeby", "mainnet"]: dev = accounts.add(config["wallets"]["from_key"]) return PriceFeed.deploy( config["networks"][network.show_active()]["eth_usd_price_feed"], {"from": dev}, publish_source=config["verify"], ) else: print("Please pick a supported network, or fork a chain")