Ran the code as shown and my constructor is public but I keep getting "Cannot import Lottery from brownie" as the error. The Lottery.sol code is below;
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.6;
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
contract lottery {
address payable[] public players;
uint256 public usdEntryFee;
AggregatorV3Interface internal ethUsdPriceFeed;
constructor(address _priceFeedAddress) public {
usdEntryFee = 50 * (10**18);
ethUsdPriceFeed = AggregatorV3Interface(_priceFeedAddress);
}
function enter() public payable {
//$50 minimum
players.push(msg.sender);
}
function getEntranceFee() public view returns (uint256) {
//
(, int256 price, , , ) = ethUsdPriceFeed.latestRoundData();
uint256 adjustedPrice = uint256(price) * 10**10;
uint256 costToEnter = (usdEntryFee * 10**18) / adjustedPrice;
return costToEnter;
}
function startLottery() public {}
function endLottery() public {}
}
The deploy.py code is below:
#0.0317789204065159
#310000000000000000
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.showactive()]["eth_usd_price_feed"],
{"from": account},
)
assert lottery.getEntranceFee() > Web3.toWei(0.028, "ether")
assert lottery.getEntranceFee() < Web3.toWei(0.038, "ether")