Solidity
關鍵錯誤:巧克力蛋糕測試期間的“eth_usd_price_feed”
from brownie import Lottery, accounts, config, network from web3 import Web3 def test_get_entrance_fee(): account = accounts[0] lottery = Lottery.deploy( config["networks"][network.show_active()]["eth_usd_price_feed"], {"from": account}, ) assert lottery.getEntranceFee() > Web3.toWei(0.012, "ether") assert lottery.getEntranceFee() < Web3.toWei(0.015, "ether")
我認為錯誤出在您的布朗尼配置文件中。網路:分支應如下所示:
networks: mainnet-fork-dev: eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419' mainnet-fork: eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419' development: eth_usd_price_feed: '0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419'
networks
即在和之間應該有一個網路名稱eth-usd-price-feed